如何获得Name of a WallType in PyRevit?我可以到达FamilyName,但这不是我想要的,我想知道墙的确切名称(例如,300毫米混凝土)。我使用的代码:
from Autodesk.Revit.DB import *
doc = __revit__.ActiveUIDocument.Document
walls = FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Walls).\
WhereElementIsElementType().ToElements()
for wall in walls:
print(wall.Name)发布于 2022-01-19 10:36:03
您不能从Name获得WallType,因为它是从ElementType继承的,而且这个类不包括用于Name的getter。
检索名称的方法是访问对象的overriden属性,如所见的in this other question。
您可以轻松地适应您的代码,如:
from Autodesk.Revit.DB import *
doc = __revit__.ActiveUIDocument.Document
walls = FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Walls).\
WhereElementIsElementType().ToElements()
for wall in walls:
print(Element.Name.GetValue(wall))https://stackoverflow.com/questions/70768336
复制相似问题