don't deep copy psets for optimization

Related to #5291

pset.edit_pset should cover it since it does support unsharing shared properties
This commit is contained in:
Andrej730
2024-09-10 12:15:29 +05:00
parent 5f8fdf233f
commit 5616367a03
2 changed files with 3 additions and 2 deletions
@@ -42,6 +42,6 @@ def copy_profile(file: ifcopenshell.file, profile: ifcopenshell.entity_instance)
inverses = file.get_inverse(profile)
psets = [i for i in inverses if i.is_a("IfcProfileProperties")]
for pset in psets:
new_pset = ifcopenshell.util.element.copy_deep(file, pset, exclude=["IfcProfileDef"])
new_pset = ifcopenshell.util.element.copy(file, pset)
new_pset.ProfileDefinition = new_profile
return new_profile
@@ -87,7 +87,8 @@ def unshare_pset(
for product in products:
# No need to consider about profile/material properties since
# they are assigned to 1 element directly and therefore cannot be shared.
pset_copy = ifcopenshell.util.element.copy_deep(file, pset)
# Don't copy_deep to keep it light - edit_pset supports unsharing shared props.
pset_copy = ifcopenshell.util.element.copy(file, pset)
pset_copies.append(pset_copy)
ifcopenshell.api.pset.assign_pset(file, [product], pset_copy)