Spaces are now always imported, and consistent with the rest of the spatial tree. Yes, I don't know why I held off for so long. Deprecate "import spaces". Spaces are important.

This commit is contained in:
Dion Moult
2021-04-15 19:56:18 +10:00
parent bcfc97037c
commit f4e6e924b1
2 changed files with 2 additions and 21 deletions
+2 -19
View File
@@ -780,9 +780,6 @@ class IfcImporter:
if element is None:
return
if not self.ifc_import_settings.should_import_spaces and element.is_a("IfcSpace"):
return
self.ifc_import_settings.logger.info("Creating object %s", element)
if mesh:
@@ -1084,8 +1081,6 @@ class IfcImporter:
def add_related_objects(self, parent, related_objects):
for element in related_objects:
if element.is_a("IfcSpace"):
continue
global_id = element.GlobalId
collection = bpy.data.collections.new(self.get_name(element))
self.spatial_structure_elements[global_id] = {"blender": collection}
@@ -1129,8 +1124,6 @@ class IfcImporter:
container = element.ContainedInStructure[0].RelatingStructure
elif hasattr(element, "Decomposes") and element.Decomposes:
container = element.Decomposes[0].RelatingObject
if container.is_a("IfcSpace"):
return self.get_aggregate_container(container)
return container
def create_openings_collection(self):
@@ -1179,9 +1172,7 @@ class IfcImporter:
and element.ContainedInStructure[0].RelatingStructure
):
container = element.ContainedInStructure[0].RelatingStructure
if container.is_a("IfcSpace"):
return self.place_object_in_spatial_tree(container, obj)
elif element.is_a("IfcGrid"):
if element.is_a("IfcGrid"):
grid_collection = bpy.data.collections.get(obj.name)
if grid_collection: # Just in case we ran into invalid grids from Revit
self.spatial_structure_elements[container.GlobalId]["blender"].children.link(grid_collection)
@@ -1193,22 +1184,15 @@ class IfcImporter:
if element.Decomposes[0].RelatingObject.is_a("IfcProject"):
collection = self.project["blender"]
elif element.Decomposes[0].RelatingObject.is_a("IfcSpatialStructureElement"):
if element.is_a("IfcSpatialStructureElement") and not element.is_a("IfcSpace"):
if element.is_a("IfcSpatialStructureElement"):
global_id = element.GlobalId
else:
global_id = element.Decomposes[0].RelatingObject.GlobalId
if global_id in self.spatial_structure_elements:
if (
element.is_a("IfcSpatialStructureElement")
and not element.is_a("IfcSpace")
and "blender_obj" in self.spatial_structure_elements[global_id]
):
bpy.data.objects.remove(self.spatial_structure_elements[global_id]["blender_obj"])
collection = self.spatial_structure_elements[global_id]["blender"]
# This may occur if we are nesting an IfcSpace (which is special
# since it does not have a collection within an IfcSpace
if not collection:
return self.place_object_in_spatial_tree(element.Decomposes[0].RelatingObject, obj)
else:
collection = self.aggregates[element.Decomposes[0].RelatingObject.GlobalId]["blender"]
if collection:
@@ -1432,7 +1416,6 @@ class IfcImportSettings:
self.logger = None
self.input_file = None
self.diff_file = None
self.should_import_spaces = False
self.should_auto_set_workarounds = True
self.should_use_cpu_multiprocessing = True
self.should_merge_by_class = False
@@ -115,7 +115,6 @@ class ImportIFC(bpy.types.Operator, ImportHelper):
filename_ext = ".ifc"
filter_glob: bpy.props.StringProperty(default="*.ifc;*.ifczip;*.ifcxml", options={"HIDDEN"})
should_import_spaces: bpy.props.BoolProperty(name="Import Spaces", default=False)
should_auto_set_workarounds: bpy.props.BoolProperty(name="Automatically Set Vendor Workarounds", default=True)
should_use_cpu_multiprocessing: bpy.props.BoolProperty(name="Import with CPU Multiprocessing", default=True)
should_merge_by_class: bpy.props.BoolProperty(name="Import and Merge by Class", default=False)
@@ -140,7 +139,6 @@ class ImportIFC(bpy.types.Operator, ImportHelper):
)
settings = import_ifc.IfcImportSettings.factory(context, self.filepath, logger)
settings.should_import_spaces = self.should_import_spaces
settings.should_auto_set_workarounds = self.should_auto_set_workarounds
settings.should_use_cpu_multiprocessing = self.should_use_cpu_multiprocessing
settings.should_merge_by_class = self.should_merge_by_class