【发布时间】:2016-02-05 05:26:39
【问题描述】:
我正在尝试在 Revit 2014 中使用宏绘制墙壁。首先我获取材料,然后获取墙壁的面,但是当我选择墙壁时没有任何反应。这是 Python 中的代码:
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曾经是Solid吗?你应该发现这一点 - 它会很容易地解释为什么你没有得到任何结果。 -
达人,谢谢你的提示,很有用。