mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-15 18:14:08 +00:00
fix duplicated ifcstyleditems using append_asset
since we don't use `file.add` to add inverse items and we use `file.create_entity` it was duplicating new elements, added optional parameter that makes it possible to track already added relationships between `append_asset`s.
This commit is contained in:
@@ -56,6 +56,7 @@ class Patcher:
|
||||
self.aggregates = {}
|
||||
self.new = ifcopenshell.file(schema=self.file.wrapped_data.schema)
|
||||
self.owner_history = None
|
||||
self.reuse_identities: dict[int, ifcopenshell.entity_instance] = {}
|
||||
for owner_history in self.file.by_type("IfcOwnerHistory"):
|
||||
self.owner_history = self.new.add(owner_history)
|
||||
break
|
||||
@@ -83,7 +84,9 @@ class Patcher:
|
||||
pass
|
||||
if element.is_a("IfcProject"):
|
||||
return self.new.add(element)
|
||||
return ifcopenshell.api.run("project.append_asset", self.new, library=self.file, element=element)
|
||||
return ifcopenshell.api.run(
|
||||
"project.append_asset", self.new, library=self.file, element=element, reuse_identities=self.reuse_identities
|
||||
)
|
||||
|
||||
def add_decomposition_parents(self, element, new_element) -> None:
|
||||
for rel in element.Decomposes:
|
||||
|
||||
Reference in New Issue
Block a user