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