mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 17:31:45 +00:00
Fix bug where element types wouldn't load if a filter was applied
This commit is contained in:
@@ -245,8 +245,8 @@ class IfcImporter:
|
|||||||
self.create_structural_items()
|
self.create_structural_items()
|
||||||
self.profile_code("Create structural items")
|
self.profile_code("Create structural items")
|
||||||
if not self.ifc_import_settings.is_coordinating:
|
if not self.ifc_import_settings.is_coordinating:
|
||||||
self.create_type_products()
|
self.create_element_types()
|
||||||
self.profile_code("Create type products")
|
self.profile_code("Create element types")
|
||||||
self.place_objects_in_collections()
|
self.place_objects_in_collections()
|
||||||
self.profile_code("Place objects in collections")
|
self.profile_code("Place objects in collections")
|
||||||
self.add_project_to_scene()
|
self.add_project_to_scene()
|
||||||
@@ -326,6 +326,7 @@ class IfcImporter:
|
|||||||
self.elements = [e for e in self.elements if e.Representation and not e.is_a("IfcFeatureElement")]
|
self.elements = [e for e in self.elements if e.Representation and not e.is_a("IfcFeatureElement")]
|
||||||
|
|
||||||
self.elements = set(self.elements[offset:offset_limit])
|
self.elements = set(self.elements[offset:offset_limit])
|
||||||
|
self.element_types = set([ifcopenshell.util.element.get_type(e) for e in self.elements])
|
||||||
|
|
||||||
if self.ifc_import_settings.has_filter and self.ifc_import_settings.should_filter_spatial_elements:
|
if self.ifc_import_settings.has_filter and self.ifc_import_settings.should_filter_spatial_elements:
|
||||||
self.spatial_elements = self.get_spatial_elements_filtered_by_elements(self.elements)
|
self.spatial_elements = self.get_spatial_elements_filtered_by_elements(self.elements)
|
||||||
@@ -576,19 +577,13 @@ class IfcImporter:
|
|||||||
self.set_matrix_world(obj, grid_obj.matrix_world)
|
self.set_matrix_world(obj, grid_obj.matrix_world)
|
||||||
grid_collection.objects.link(obj)
|
grid_collection.objects.link(obj)
|
||||||
|
|
||||||
def create_type_products(self):
|
def create_element_types(self):
|
||||||
# TODO allow filtering of spatial elements too
|
for element_type in self.element_types:
|
||||||
if self.ifc_import_settings.has_filter:
|
if not element_type:
|
||||||
type_products = set([ifcopenshell.util.element.get_type(e) for e in self.elements])
|
|
||||||
else:
|
|
||||||
type_products = self.file.by_type("IfcTypeProduct")
|
|
||||||
|
|
||||||
for type_product in type_products:
|
|
||||||
if not type_product:
|
|
||||||
continue
|
continue
|
||||||
self.create_type_product(type_product)
|
self.create_element_type(element_type)
|
||||||
|
|
||||||
def create_type_product(self, element):
|
def create_element_type(self, element):
|
||||||
self.ifc_import_settings.logger.info("Creating object %s", element)
|
self.ifc_import_settings.logger.info("Creating object %s", element)
|
||||||
representation_map = self.get_type_product_body_representation_map(element)
|
representation_map = self.get_type_product_body_representation_map(element)
|
||||||
mesh = None
|
mesh = None
|
||||||
|
|||||||
Reference in New Issue
Block a user