Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed error importing .ifc that has element aggregated by ifcproject
In case if some element (not another aggregate) was aggregated by IfcProject directly, importing IFC was resulting in error below since the project's collection was never added to `self.collections`. Traceback: ``` File "\scripts\addons\blenderbim\bim\module\project\operator.py", line 732, in execute ifc_importer.execute() File "\scripts\addons\blenderbim\bim\import_ifc.py", line 292, in execute self.place_objects_in_collections() File "\scripts\addons\blenderbim\bim\import_ifc.py", line 1668, in place_objects_in_collections self.place_object_in_collection(self.file.by_id(ifc_definition_id), obj) File "\scripts\addons\blenderbim\bim\import_ifc.py", line 1672, in place_object_in_collection self.place_object_in_decomposition_collection(element, obj) File "\scripts\addons\blenderbim\bim\import_ifc.py", line 1689, in place_object_in_decomposition_collection return self.collections[aggregate.GlobalId].objects.link(obj) KeyError: '2bKVb8E7L6e89EQYJUk8BM' ```
- Loading branch information
2557580
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is actually allowed I.e. regular walls and elements cannot be aggregated to the IfcProject directly.
2557580
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not? It's not producing validation errors. Here's the example file:
elements_aggregated_by_ifcproject.ifc.txt
2557580
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2557580
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@aothms Found it, thank you, makes sense.
But shouldn't there be some kind of express validation rule for IfcRelAggregates that if RelatingObject is IfcProject then RelatedObjects cannot have IfcElements or something?
2557580
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Express is likely not the right place, but i've added a proposal here buildingSMART/ifc-gherkin-rules#111