mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-30 03:59:55 +00:00
Fix bug where deletion syncing may fail on freshly created objects
This commit is contained in:
@@ -77,19 +77,19 @@ class IfcExporter:
|
|||||||
self.unit_scale = ifcopenshell.util.unit.calculate_unit_scale(self.file)
|
self.unit_scale = ifcopenshell.util.unit.calculate_unit_scale(self.file)
|
||||||
to_delete = []
|
to_delete = []
|
||||||
|
|
||||||
for guid, obj in IfcStore.guid_map.items():
|
for ifc_definition_id, obj in IfcStore.id_map.items():
|
||||||
try:
|
try:
|
||||||
self.sync_object_placement(obj)
|
self.sync_object_placement(obj)
|
||||||
self.sync_object_container(guid, obj)
|
self.sync_object_container(ifc_definition_id, obj)
|
||||||
except ReferenceError:
|
except ReferenceError:
|
||||||
pass # The object is likely deleted
|
pass # The object is likely deleted
|
||||||
if self.should_delete(obj):
|
if self.should_delete(obj):
|
||||||
to_delete.append(guid)
|
to_delete.append(ifc_definition_id)
|
||||||
|
|
||||||
SpatialData.purge()
|
SpatialData.purge()
|
||||||
|
|
||||||
for guid in to_delete:
|
for ifc_definition_id in to_delete:
|
||||||
product = self.file.by_id(guid)
|
product = self.file.by_id(ifc_definition_id)
|
||||||
IfcStore.unlink_element(product)
|
IfcStore.unlink_element(product)
|
||||||
ifcopenshell.api.run("root.remove_product", self.file, **{"product": product})
|
ifcopenshell.api.run("root.remove_product", self.file, **{"product": product})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user