Fix #3366. Fix crash in IfcDiff if you are comparing a model with no geometry.

This commit is contained in:
Dion Moult
2023-07-03 17:28:20 +10:00
parent 847d30fdaa
commit 4845242769
+5 -3
View File
@@ -29,9 +29,10 @@ import multiprocessing
import ifcopenshell import ifcopenshell
import ifcopenshell.geom import ifcopenshell.geom
import ifcopenshell.util.element import ifcopenshell.util.element
import ifcopenshell.util.selector
import ifcopenshell.util.placement import ifcopenshell.util.placement
import ifcopenshell.util.classification import ifcopenshell.util.classification
import ifcopenshell.util.selector import ifcopenshell.util.representation
from deepdiff import DeepDiff from deepdiff import DeepDiff
@@ -141,8 +142,9 @@ class IfcDiff:
continue continue
if should_check_geometry: if should_check_geometry:
# Option 1: check everything heuristically using the iterator (seems faster) # Option 1: check everything heuristically using the iterator (seems faster)
potential_old_changes.append(old) if ifcopenshell.util.representation.get_representation(new, "Model", "Body", "MODEL_VIEW"):
potential_new_changes.append(new) potential_old_changes.append(old)
potential_new_changes.append(new)
# Option 2: check first using Python, then fallback to iterator (twice as slow) # Option 2: check first using Python, then fallback to iterator (twice as slow)
# diff = self.diff_element_basic_geometry(old, new) # diff = self.diff_element_basic_geometry(old, new)
# if diff: # if diff: