If objects are not selected, export entire project to IFC

This commit is contained in:
Dion Moult
2020-09-06 10:21:12 +10:00
parent dae5adc38b
commit 14c824dfee
2 changed files with 10 additions and 3 deletions
@@ -151,6 +151,7 @@ def do_cut(process_data):
class IfcCutter:
def __init__(self):
self.time = None
self.selector = ifcopenshell.util.selector.Selector()
self.product_shapes = []
self.background_elements = []
@@ -212,8 +213,6 @@ class IfcCutter:
self.sort_background_elements()
def profile_code(self, message):
if not self.ifc_import_settings.should_import_with_profiling:
return
if not self.time:
self.time = time.time()
print('{} :: {:.2f}'.format(message, time.time() - self.time))
@@ -86,8 +86,9 @@ class IfcParser():
if not self.projects:
self.setup_project()
self.projects = self.get_projects()
self.project = self.projects[0]
if not selected_objects:
selected_objects = self.get_all_objects_in_project(self.project['raw'])
self.units = self.get_units()
self.unit_scale = self.get_unit_scale()
self.people = self.get_people()
@@ -862,6 +863,13 @@ class IfcParser():
})
return results
def get_all_objects_in_project(self, collection):
results = []
results.extend(list(collection.objects))
for child in collection.children:
results.extend(self.get_all_objects_in_project(child))
return results
def setup_project(self):
bpy.ops.bim.quick_project_setup()
for collection in bpy.data.collections: