0
我试图用Revit 2014中的宏绘制墙。首先获取材质和墙的面,但是当我选择墙时没有任何反应。这是Python中的代码:Revit API |如何画一面墙?
def PaintFace(self):
uidoc = self.ActiveUIDocument
doc = uidoc.Document
collector = FilteredElementCollector(doc)
materials = collector.WherePasses(ElementClassFilter(Material)).ToElements()
for material in materials:
if material.Name == 'Copper':
matName = material
break
elRef = uidoc.Selection.PickObject(ObjectType.Element)
wall = doc.GetElement(elRef)
geomElement = wall.get_Geometry(Options())
for geomObject in geomElement:
if geomObject == Solid:
solid = geomObject
for face in solid.Faces:
if doc.IsPainted(wall.Id, face) == False:
doc.Paint(wall.Id, face, matName.Id)
任何人都可以帮我弄清楚为什么会发生这种情况?
你可以用'print'语句来帮助调试。或者一行一行地在shell中尝试一下。 “geomObject”是否是“固体”?你应该发现 - 这很容易解释你为什么没有得到任何结果。 –
达人,谢谢你的提示,非常有用。 – CADesigner