revit java 接口_如何使用Revit API获取axis属性?
我試圖使用Revit Interactive Python Shell在Revit中旋轉對象 . 我掛了如何指定旋轉軸 . 我不知道如何使用API創建一行,然后在ElementTransformUtils.RotateElement()中指定一個軸
RotateElement()中的第三個參數是軸 . 我正在創建一條線,但我不確定我是否在.RotateElement()的第三個參數中指定了它的軸
當我運行此代碼時沒有任何反應 . 如果我選擇了墻,情況就是如此 . 如果有任何需要澄清,請告訴我 .
謝謝,
import clr
import math
clr.AddReference('RevitAPI')
clr.AddReference('RevitAPIUI')
from Autodesk.Revit.DB import *
def pickobject():
from Autodesk.Revit.UI.Selection import ObjectType
__window__.Hide()
picked = uidoc.Selection.PickObject(ObjectType.Element)
__window__.Show()
__window__.Topmost = True
return picked
#set the active Revit application and document
app = __revit__.Application
doc = __revit__.ActiveUIDocument.Document
#define a transaction variable and describe the transaction
t = Transaction(doc, 'This is my new transaction')
#start a transaction in the Revit database
t.Start()
#perform some action here...
el = pickobject()
p1 = XYZ(0,0,0)
p2 = XYZ(0,0,1)
myLine = Line.CreateBound(p1, p2)
ElementTransformUtils.RotateElement(doc, el.ElementId, myLine, math.pi / 2)
#commit the transaction to the Revit database
t.Commit()
#close the script window
__window__.Close()
事實證明我沒有正確選擇元素或將度數轉換為弧度 . 做完這些事后,我能夠使我選擇的元素旋轉90度 . 我現在面臨的唯一問題是選擇元素旋轉的原點 .
創作挑戰賽新人創作獎勵來咯,堅持創作打卡瓜分現金大獎總結
以上是生活随笔為你收集整理的revit java 接口_如何使用Revit API获取axis属性?的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Python大神告诉你,学习Python
- 下一篇: Java高级应用开发之Servlet