mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-16 10:34:31 +00:00
Simplify IfcStore.relink_object
This commit is contained in:
@@ -225,27 +225,13 @@ class IfcStore:
|
||||
def relink_object(obj: IFC_CONNECTED_TYPE) -> None:
|
||||
if not obj:
|
||||
return
|
||||
if isinstance(obj, bpy.types.Object):
|
||||
ifc_definition_id = obj.BIMObjectProperties.ifc_definition_id
|
||||
if not ifc_definition_id:
|
||||
return
|
||||
try:
|
||||
element = IfcStore.get_file().by_id(ifc_definition_id)
|
||||
except RuntimeError:
|
||||
return
|
||||
data = OperationData(id=element.id(), obj=obj.name)
|
||||
if hasattr(element, "GlobalId"):
|
||||
data["guid"] = element.GlobalId
|
||||
IfcStore.commit_link_element(data)
|
||||
element = tool.Ifc.get_entity(obj)
|
||||
if not element:
|
||||
return
|
||||
else: # bpy.types.Material
|
||||
ifc_definition_id = obj.BIMStyleProperties.ifc_definition_id
|
||||
try:
|
||||
element = IfcStore.get_file().by_id(ifc_definition_id)
|
||||
except RuntimeError:
|
||||
return
|
||||
data = OperationData(id=element.id(), obj=obj.name)
|
||||
IfcStore.commit_link_element(data)
|
||||
data = OperationData(id=element.id(), obj=obj.name)
|
||||
if hasattr(element, "GlobalId"):
|
||||
data["guid"] = element.GlobalId
|
||||
IfcStore.commit_link_element(data)
|
||||
|
||||
@staticmethod
|
||||
def link_element(
|
||||
|
||||
Reference in New Issue
Block a user