您应该导入
ObjectType当前范围:
>>> from Autodesk.Revit.UI.Selection import ObjectType>>> picked = uidoc.Selection.PickObject(ObjectType.Element)
我刚刚在RevitPythonShell中进行了尝试,并注意到它不起作用,因为外壳仍在前台。因此,该技术将适用于您添加到功能区中的脚本,但不能直接从Shell中添加…我还不确定如何解决此问题。抱歉。
编辑: 使用像这样的功能来完成技巧:
def pickobject(): from Autodesk.Revit.UI.Selection import ObjectType __window__.Hide() picked = uidoc.Selection.PickObject(ObjectType.Element) __window__.Show() __window__.Topmost = True return picked
您可以通过将其粘贴到底部的编辑器窗格中并单击F5或将其添加到您的Init-
script或任何其他方式来运行它。然后
pickobject()在需要选择元素时调用。



