See #4727. Load alignments (linear elements, linear positioning elements, and referents) by default.

This commit is contained in:
Dion Moult
2024-06-27 21:49:44 +10:00
parent 599ca56496
commit 3469a9caad
2 changed files with 27 additions and 4 deletions
+18 -4
View File
@@ -241,8 +241,8 @@ class IfcImporter:
self.profile_code("Create elements")
self.create_generic_elements(self.annotations)
self.profile_code("Create annotations")
self.create_grids()
self.profile_code("Create grids")
self.create_positioning_elements()
self.profile_code("Create positioning elements")
self.create_spatial_elements()
self.profile_code("Create spatial elements")
self.create_structural_items()
@@ -506,11 +506,25 @@ class IfcImporter:
if not props.has_blender_offset:
tool.Loader.guess_false_origin(self.file)
def create_positioning_elements(self):
self.create_grids()
self.create_alignments()
def create_alignments(self):
if not self.ifc_import_settings.should_load_geometry:
return
if self.file.schema in ("IFC2X3", "IFC4"):
return
self.create_generic_elements(set(self.file.by_type("IfcLinearPositioningElement")))
self.create_generic_elements(set(self.file.by_type("IfcReferent")))
# Loading IfcLinearElement for test purposes for now only.
# In the future we will make it lazy loaded and toggleable with a special UI.
self.create_generic_elements(set(self.file.by_type("IfcLinearElement")))
def create_grids(self):
if not self.ifc_import_settings.should_load_geometry:
return
grids = self.file.by_type("IfcGrid")
for grid in grids:
for grid in self.file.by_type("IfcGrid"):
shape = None
if not grid.UAxes or not grid.VAxes:
# Revit can create invalid grids
@@ -45,6 +45,14 @@ class Collector(blenderbim.core.tool.Collector):
elif element.is_a("IfcStructuralItem"):
collection = cls._create_project_child_collection("IfcStructuralItem")
cls.link_to_collection_safe(obj, collection)
elif element.is_a("IfcLinearPositioningElement"):
collection = cls._create_project_child_collection("IfcLinearPositioningElement")
collection.hide_viewport = False
cls.link_to_collection_safe(obj, collection)
elif element.is_a("IfcReferent"):
collection = cls._create_project_child_collection("IfcReferent")
collection.hide_viewport = False
cls.link_to_collection_safe(obj, collection)
elif tool.Ifc.get_schema() == "IFC2X3" and element.is_a("IfcSpatialStructureElement"):
if collection := cls._create_own_collection(obj):
cls.link_to_collection_safe(obj, collection)
@@ -77,6 +85,7 @@ class Collector(blenderbim.core.tool.Collector):
cls.link_to_collection_safe(obj, drawing_obj.BIMObjectProperties.collection)
else:
collection = cls._create_project_child_collection("Unsorted")
collection.hide_viewport = False
cls.link_to_collection_safe(obj, collection)
@classmethod