Thank you for your feedback. It sounds really promessing that it can be done, however i do feel embarrassed as i do need more assistance. I am not familiar with programing at all beside making one mathematical script in Octave. The way i read your suggestion is to simply copy the entire section where this bim.create_all_shapes is used, and combine the first set of code. I can only imagine that
failed_elements = failures = []
I am confident i have done this inaccurately, may i ask for more help?
import blenderbim.tool as tool
import bpy
class CreateAllShapes(bpy.types.Operator):
bl_idname = "bim.create_all_shapes"
bl_label = "Test All Shapes"
bl_description = "Look for errors in all the shapes contained in the file"
**@classmethod**
def poll(cls, context):
return IfcStore.get_file()
def execute(self, context):
self.file = IfcStore.get_file()
elements = self.file.by_type("IfcElement") + self.file.by_type("IfcSpace")
total = len(elements)
settings = ifcopenshell.geom.settings()
settings_2d = ifcopenshell.geom.settings()
settings_2d.set(settings_2d.INCLUDE_CURVES, True)
failures = []
excludes = () # For the developer to debug with
for i, element in enumerate(elements, 1):
if element.GlobalId in excludes:
continue
print(f"{i}/{total}:", element)
start = time.time()
shape = None
try:
shape = ifcopenshell.geom.create_shape(settings, element)
except:
try:
shape = ifcopenshell.geom.create_shape(settings_2d, element)
except:
failures.append(element)
print("***** FAILURE *****")
if shape:
print(
"Success",
time.time() - start,
len(shape.geometry.verts),
len(shape.geometry.edges),
len(shape.geometry.faces),
)
self.report({"INFO"}, f"Failed shapes: {len(failures)}, check the system console for details.")
for failure in failures:
print(failure)
return {"FINISHED"}
failed_elements = failures = []
ifc_file = tool.Ifc.get()
failed_elements = [ifc_file.by_id(i) for i in failed_elements]
failed_objects = [tool.Ifc.get_object(element) for element in failed_elements]
tool.Blender.set_objects_selection(bpy.context, None, failed_objects)
bpy.ops.bim.override_object_delete(is_batch=True)