From a1eff64aecaf4edb2c87ee572827738cf751a927 Mon Sep 17 00:00:00 2001 From: Dion Moult Date: Thu, 6 Apr 2023 21:18:36 +1000 Subject: [PATCH] Fix #2935. Duplicating objects clear any parametric array relationships. --- src/blenderbim/blenderbim/bim/module/geometry/operator.py | 8 ++++++++ src/blenderbim/blenderbim/bim/module/type/operator.py | 2 -- src/blenderbim/blenderbim/bim/module/type/ui.py | 3 ++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/blenderbim/blenderbim/bim/module/geometry/operator.py b/src/blenderbim/blenderbim/bim/module/geometry/operator.py index 82d3925d01..8b46ab4464 100644 --- a/src/blenderbim/blenderbim/bim/module/geometry/operator.py +++ b/src/blenderbim/blenderbim/bim/module/geometry/operator.py @@ -555,6 +555,10 @@ class OverrideDuplicateMove(bpy.types.Operator): # Copy the actual class new = blenderbim.core.root.copy_class(tool.Ifc, tool.Collector, tool.Geometry, tool.Root, obj=new_obj) if new: + array_pset = ifcopenshell.util.element.get_pset(new, "BBIM_Array") + if array_pset: + array_pset = tool.Ifc.get().by_id(array_pset["id"]) + ifcopenshell.api.run("pset.remove_pset", tool.Ifc.get(), product=new, pset=array_pset) old_to_new[tool.Ifc.get_entity(obj)] = [new] # Recreate decompositions tool.Root.recreate_decompositions(relationships, old_to_new) @@ -615,6 +619,10 @@ class OverrideDuplicateMoveLinked(bpy.types.Operator): # Copy the actual class new = blenderbim.core.root.copy_class(tool.Ifc, tool.Collector, tool.Geometry, tool.Root, obj=new_obj) if new: + array_pset = ifcopenshell.util.element.get_pset(new, "BBIM_Array") + if array_pset: + array_pset = tool.Ifc.get().by_id(array_pset["id"]) + ifcopenshell.api.run("pset.remove_pset", tool.Ifc.get(), product=new, pset=array_pset) old_to_new[tool.Ifc.get_entity(obj)] = new # Recreate decompositions tool.Root.recreate_decompositions(relationships, old_to_new) diff --git a/src/blenderbim/blenderbim/bim/module/type/operator.py b/src/blenderbim/blenderbim/bim/module/type/operator.py index 3f46fe4c5e..094fd5f033 100644 --- a/src/blenderbim/blenderbim/bim/module/type/operator.py +++ b/src/blenderbim/blenderbim/bim/module/type/operator.py @@ -86,10 +86,8 @@ class UnassignType(bpy.types.Operator): for representation in element.Representation.Representations: resolved_representation = ifcopenshell.util.representation.resolve_representation(representation) if representation == resolved_representation: - print('appending', representation) representations.append(representation) else: - print('copying', representation) # We must unmap representations. copied_representation = ifcopenshell.util.element.copy_deep( tool.Ifc.get(), resolved_representation, exclude=["IfcGeometricRepresentationContext"], exclude_callback=exclude_callback diff --git a/src/blenderbim/blenderbim/bim/module/type/ui.py b/src/blenderbim/blenderbim/bim/module/type/ui.py index b4cd2c4160..d2a1d8b2ae 100644 --- a/src/blenderbim/blenderbim/bim/module/type/ui.py +++ b/src/blenderbim/blenderbim/bim/module/type/ui.py @@ -20,6 +20,7 @@ import blenderbim.tool as tool import blenderbim.bim.module.type.prop as type_prop from bpy.types import Panel from blenderbim.bim.ifc import IfcStore +from blenderbim.bim.helper import prop_with_search from blenderbim.bim.module.type.data import TypeData @@ -69,7 +70,7 @@ class BIM_PT_type(Panel): row.prop(props, "relating_type_class", text="") if type_prop.get_relating_type(None, context): - row.prop(props, "relating_type", text="") + prop_with_search(row, props, "relating_type", text="") row.operator("bim.assign_type", icon="CHECKMARK", text="") else: row.label(text="No Types Found")