mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-28 19:27:10 +00:00
Fix issue assigning bsdd classification in ifc2x3 #5073
This commit is contained in:
@@ -117,17 +117,20 @@ class AddClassificationFromBSDD(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
bl_options = {"REGISTER", "UNDO"}
|
bl_options = {"REGISTER", "UNDO"}
|
||||||
|
|
||||||
def _execute(self, context):
|
def _execute(self, context):
|
||||||
|
is_ifc2x3 = tool.Ifc.get_schema() == "IFC2X3"
|
||||||
|
|
||||||
props = context.scene.BIMBSDDProperties
|
props = context.scene.BIMBSDDProperties
|
||||||
domain = [d for d in props.domains if d.name == props.active_domain][0]
|
domain = [d for d in props.domains if d.name == props.active_domain][0]
|
||||||
for element in tool.Ifc.get().by_type("IfcClassification"):
|
for element in tool.Ifc.get().by_type("IfcClassification"):
|
||||||
if element.Name == props.active_domain or element.Location == domain.uri:
|
if element.Name == props.active_domain or (not is_ifc2x3 and element.Location == domain.uri):
|
||||||
return
|
return
|
||||||
classification = ifcopenshell.api.run(
|
classification = ifcopenshell.api.run(
|
||||||
"classification.add_classification", tool.Ifc.get(), classification=props.active_domain
|
"classification.add_classification", tool.Ifc.get(), classification=props.active_domain
|
||||||
)
|
)
|
||||||
classification.Source = domain.organization_name_owner
|
classification.Source = domain.organization_name_owner
|
||||||
classification.Location = domain.uri
|
|
||||||
classification.Edition = domain.version
|
classification.Edition = domain.version
|
||||||
|
if not is_ifc2x3:
|
||||||
|
classification.Location = domain.uri
|
||||||
|
|
||||||
|
|
||||||
class EnableAddingManualClassification(bpy.types.Operator):
|
class EnableAddingManualClassification(bpy.types.Operator):
|
||||||
@@ -397,6 +400,8 @@ class AddClassificationReferenceFromBSDD(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
obj_type: bpy.props.StringProperty()
|
obj_type: bpy.props.StringProperty()
|
||||||
|
|
||||||
def _execute(self, context):
|
def _execute(self, context):
|
||||||
|
is_ifc2x3 = tool.Ifc.get_schema() == "IFC2X3"
|
||||||
|
|
||||||
if self.obj_type == "Object":
|
if self.obj_type == "Object":
|
||||||
if context.selected_objects:
|
if context.selected_objects:
|
||||||
objects = [o.name for o in context.selected_objects]
|
objects = [o.name for o in context.selected_objects]
|
||||||
@@ -413,7 +418,7 @@ class AddClassificationReferenceFromBSDD(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
for element in tool.Ifc.get().by_type("IfcClassification"):
|
for element in tool.Ifc.get().by_type("IfcClassification"):
|
||||||
if (
|
if (
|
||||||
element.Name == bsdd_classification.domain_name
|
element.Name == bsdd_classification.domain_name
|
||||||
or element.Location == bsdd_classification.domain_namespace_uri
|
or (not is_ifc2x3 and element.Location == bsdd_classification.domain_namespace_uri)
|
||||||
):
|
):
|
||||||
classification = element
|
classification = element
|
||||||
break
|
break
|
||||||
@@ -422,7 +427,8 @@ class AddClassificationReferenceFromBSDD(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
classification = ifcopenshell.api.run(
|
classification = ifcopenshell.api.run(
|
||||||
"classification.add_classification", tool.Ifc.get(), classification=bsdd_classification.domain_name
|
"classification.add_classification", tool.Ifc.get(), classification=bsdd_classification.domain_name
|
||||||
)
|
)
|
||||||
classification.Location = bsdd_classification.domain_namespace_uri
|
if not is_ifc2x3:
|
||||||
|
classification.Location = bsdd_classification.domain_namespace_uri
|
||||||
|
|
||||||
for obj in objects:
|
for obj in objects:
|
||||||
ifc_definition_id = tool.Blender.get_obj_ifc_definition_id(obj, self.obj_type, context)
|
ifc_definition_id = tool.Blender.get_obj_ifc_definition_id(obj, self.obj_type, context)
|
||||||
|
|||||||
Reference in New Issue
Block a user