mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-26 10:11:46 +00:00
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:
@@ -42,6 +42,6 @@ def copy_profile(file: ifcopenshell.file, profile: ifcopenshell.entity_instance)
|
|||||||
inverses = file.get_inverse(profile)
|
inverses = file.get_inverse(profile)
|
||||||
psets = [i for i in inverses if i.is_a("IfcProfileProperties")]
|
psets = [i for i in inverses if i.is_a("IfcProfileProperties")]
|
||||||
for pset in psets:
|
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
|
new_pset.ProfileDefinition = new_profile
|
||||||
return new_profile
|
return new_profile
|
||||||
|
|||||||
@@ -87,7 +87,8 @@ def unshare_pset(
|
|||||||
for product in products:
|
for product in products:
|
||||||
# No need to consider about profile/material properties since
|
# No need to consider about profile/material properties since
|
||||||
# they are assigned to 1 element directly and therefore cannot be shared.
|
# 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)
|
pset_copies.append(pset_copy)
|
||||||
ifcopenshell.api.pset.assign_pset(file, [product], pset_copy)
|
ifcopenshell.api.pset.assign_pset(file, [product], pset_copy)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user