mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-18 22:33:33 +00:00
If objects are not selected, export entire project to IFC
This commit is contained in:
@@ -151,6 +151,7 @@ def do_cut(process_data):
|
|||||||
|
|
||||||
class IfcCutter:
|
class IfcCutter:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
self.time = None
|
||||||
self.selector = ifcopenshell.util.selector.Selector()
|
self.selector = ifcopenshell.util.selector.Selector()
|
||||||
self.product_shapes = []
|
self.product_shapes = []
|
||||||
self.background_elements = []
|
self.background_elements = []
|
||||||
@@ -212,8 +213,6 @@ class IfcCutter:
|
|||||||
self.sort_background_elements()
|
self.sort_background_elements()
|
||||||
|
|
||||||
def profile_code(self, message):
|
def profile_code(self, message):
|
||||||
if not self.ifc_import_settings.should_import_with_profiling:
|
|
||||||
return
|
|
||||||
if not self.time:
|
if not self.time:
|
||||||
self.time = time.time()
|
self.time = time.time()
|
||||||
print('{} :: {:.2f}'.format(message, time.time() - self.time))
|
print('{} :: {:.2f}'.format(message, time.time() - self.time))
|
||||||
|
|||||||
@@ -86,8 +86,9 @@ class IfcParser():
|
|||||||
if not self.projects:
|
if not self.projects:
|
||||||
self.setup_project()
|
self.setup_project()
|
||||||
self.projects = self.get_projects()
|
self.projects = self.get_projects()
|
||||||
|
|
||||||
self.project = self.projects[0]
|
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.units = self.get_units()
|
||||||
self.unit_scale = self.get_unit_scale()
|
self.unit_scale = self.get_unit_scale()
|
||||||
self.people = self.get_people()
|
self.people = self.get_people()
|
||||||
@@ -862,6 +863,13 @@ class IfcParser():
|
|||||||
})
|
})
|
||||||
return results
|
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):
|
def setup_project(self):
|
||||||
bpy.ops.bim.quick_project_setup()
|
bpy.ops.bim.quick_project_setup()
|
||||||
for collection in bpy.data.collections:
|
for collection in bpy.data.collections:
|
||||||
|
|||||||
Reference in New Issue
Block a user