Fix bug where copying objects with profiles should only share profiles if the profile is named.

This commit is contained in:
Dion Moult
2023-01-28 21:51:00 +11:00
parent 1a05fae826
commit 6a2307308c
5 changed files with 32 additions and 9 deletions
@@ -654,7 +654,7 @@ class EditExtrusionProfile(bpy.types.Operator, tool.Ifc.Operator):
if not profile:
def msg(self, context):
self.layout.label(text="INVALID PROFILE: " + indices[1])
self.layout.label(text="INVALID PROFILE")
bpy.context.window_manager.popup_menu(msg, title="Error", icon="ERROR")
DecorationsHandler.install(context)
@@ -667,6 +667,7 @@ class EditExtrusionProfile(bpy.types.Operator, tool.Ifc.Operator):
ifcopenshell.util.element.remove_deep2(tool.Ifc.get(), old_profile)
blenderbim.core.geometry.switch_representation(
tool.Ifc,
tool.Geometry,
obj=obj,
representation=representation,
+5 -2
View File
@@ -50,18 +50,21 @@ class Root(blenderbim.core.tool.Root):
@classmethod
def copy_representation(cls, source, dest):
def exclude_callback(attribute):
return attribute.is_a("IfcProfileDef") and attribute.ProfileName
if dest.is_a("IfcProduct"):
if not source.Representation:
return
dest.Representation = ifcopenshell.util.element.copy_deep(
tool.Ifc.get(), source.Representation, exclude=["IfcGeometricRepresentationContext", "IfcProfileDef"]
tool.Ifc.get(), source.Representation, exclude=["IfcGeometricRepresentationContext"], exclude_callback=exclude_callback
)
elif dest.is_a("IfcTypeProduct"):
if not source.RepresentationMaps:
return
dest.RepresentationMaps = [
ifcopenshell.util.element.copy_deep(
tool.Ifc.get(), m, exclude=["IfcGeometricRepresentationContext", "IfcProfileDef"]
tool.Ifc.get(), m, exclude=["IfcGeometricRepresentationContext"], exclude_callback=exclude_callback
)
for m in source.RepresentationMaps
]