我有一个包含许多元素的模型,这些元素被归类为 ifcbuildingelementproxy(或未分类,因为这是 ifc 导出软件又名 ifcObject 的标准)。我有一个代码可以找到我想要更改其分类的所有元素,但我似乎找不到更改它的方法。我想要做的是让我的脚本将所有名称以“whatever”开头的元素重新分类为 IfcWindow 而不是 IfcBuildingElementProxy。
def re_classify():
ifc_loc='thefile.ifc'
ifcfile = ifcopenshell.open(ifc_loc)
create_guid = lambda: ifcopenshell.guid.compress(uuid.uuid1().hex)
owner_history = ifcfile.by_type("IfcOwnerHistory")[0]
element = ifcfile.by_type("IfcElement")
sets = ifcfile.by_type("IfcPropertySet")
search_word_in_name='M_Muntin'
for e in element:
if e.is_a('IfcBuildingElementProxy'):
if e.Name.startswith(search_word_in_name,0,len(search_word_in_name)):
e.is_a()==e.is_a('IfcWindow') #<--- THIS DOES NOTHING
print (e)
print(e.Name,' - ', e.is_a())
re_classify()
我希望 f.ex
13505=IfcBuildingElementProxy('3OAbz$kW1DyuZY2KLwUwkk',#41,'M_Muntin Pattern_2x2:M_Muntin Pattern_2x2:346152',$,'M_Muntin Pattern_2x2',#13504,#13499,'346152',$)
将会呈现