mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-11 18:16:40 +00:00
append_asset - keep preexisting contexts valid #4280
issue occurred with ifcpatch ExtractElements - it was adding project from other ifc file (with the contexts) and then adding some elements from it using `append_asset`. During `append_asset` it was considering existing context with the duplicated one and was partially purging it.
This commit is contained in:
@@ -84,12 +84,12 @@ class Usecase:
|
||||
# Now we can easily append our wall type from our libary
|
||||
wall_type = ifcopenshell.api.run("project.append_asset", model, library=library, element=wall_type)
|
||||
"""
|
||||
self.file = file
|
||||
self.file: ifcopenshell.file = file
|
||||
self.settings = {"library": library, "element": element}
|
||||
|
||||
def execute(self):
|
||||
# mapping of old element ids to new elements
|
||||
self.added_elements:dict[int, ifcopenshell.entity_instance] = {}
|
||||
self.added_elements: dict[int, ifcopenshell.entity_instance] = {}
|
||||
self.whitelisted_inverse_attributes = {}
|
||||
if self.settings["element"].is_a("IfcTypeProduct"):
|
||||
self.target_class = "IfcTypeProduct"
|
||||
@@ -268,6 +268,7 @@ class Usecase:
|
||||
|
||||
def reuse_existing_contexts(self):
|
||||
added_contexts = set([e for e in self.added_elements.values() if e.is_a("IfcGeometricRepresentationContext")])
|
||||
added_contexts -= set(self.existing_contexts)
|
||||
for added_context in added_contexts:
|
||||
equivalent_existing_context = self.get_equivalent_existing_context(added_context)
|
||||
if not equivalent_existing_context:
|
||||
|
||||
Reference in New Issue
Block a user