(self, old, new)
| 291 | return True |
| 292 | |
| 293 | def diff_element_relationships(self, old, new): |
| 294 | if not self.relationships: |
| 295 | return |
| 296 | for relationship in self.relationships: |
| 297 | if relationship == "type": |
| 298 | old_type = ifcopenshell.util.element.get_type(old) |
| 299 | new_type = ifcopenshell.util.element.get_type(new) |
| 300 | if old_type is not None and new_type is not None: |
| 301 | if old_type.GlobalId != new_type.GlobalId: |
| 302 | self.change_register.setdefault(new.GlobalId, {}).update({"type_changed": True}) |
| 303 | return True |
| 304 | elif old_type != new_type: |
| 305 | # one of the types is None while the other is not None |
| 306 | self.change_register.setdefault(new.GlobalId, {}).update({"type_changed": True}) |
| 307 | return True |
| 308 | elif relationship == "property": |
| 309 | old_psets = ifcopenshell.util.element.get_psets(old) |
| 310 | new_psets = ifcopenshell.util.element.get_psets(new) |
| 311 | try: |
| 312 | diff = DeepDiff( |
| 313 | old_psets, |
| 314 | new_psets, |
| 315 | math_epsilon=self.precision, |
| 316 | ignore_string_type_changes=True, |
| 317 | ignore_numeric_type_changes=True, |
| 318 | exclude_regex_paths=[r".*id$"], |
| 319 | ) |
| 320 | except: |
| 321 | diff = True |
| 322 | if diff and new.GlobalId: |
| 323 | self.change_register.setdefault(new.GlobalId, {}).update({"properties_changed": diff}) |
| 324 | return True |
| 325 | elif relationship == "container": |
| 326 | if ifcopenshell.util.element.get_container(old) != ifcopenshell.util.element.get_container(new): |
| 327 | self.change_register.setdefault(new.GlobalId, {}).update({"container_changed": True}) |
| 328 | return True |
| 329 | elif relationship == "aggregate": |
| 330 | if ifcopenshell.util.element.get_aggregate(old) != ifcopenshell.util.element.get_aggregate(new): |
| 331 | self.change_register.setdefault(new.GlobalId, {}).update({"aggregate_changed": True}) |
| 332 | return True |
| 333 | elif relationship == "classification": |
| 334 | old_id = "ItemReference" if self.old.schema == "IFC2X3" else "Identification" |
| 335 | new_id = "ItemReference" if self.new.schema == "IFC2X3" else "Identification" |
| 336 | old_refs = [getattr(r, old_id) for r in ifcopenshell.util.classification.get_references(old)] |
| 337 | new_refs = [getattr(r, new_id) for r in ifcopenshell.util.classification.get_references(new)] |
| 338 | if old_refs != new_refs: |
| 339 | self.change_register.setdefault(new.GlobalId, {}).update({"classification_changed": True}) |
| 340 | return True |
| 341 | |
| 342 | def diff_element_basic_geometry(self, old, new): |
| 343 | old_placement = ifcopenshell.util.placement.get_local_placement(old.ObjectPlacement) |
no test coverage detected