I have a simple script which performs Boolean union on multiple meshes. I can manually trace modifier errors in the console and exclude meshes which leads to union artifacts. Here's the script:
import bpy
wm = bpy.context.window_manager
act_obj = bpy.context.active_object
union_list = []
for sel_obj in bpy.context.selected_objects:
if sel_obj.type == 'MESH':
if sel_obj != act_obj:
bpy.ops.object.modifier_add(type="BOOLEAN")
union_list.append(sel_obj)
k=0
union_list_len = len(union_list)
wm.progress_begin(0, union_list_len)
for mod in act_obj.modifiers:
if mod.type == "BOOLEAN":
print(k,union_list_len,union_list[k].name)
wm.progress_update(k)
mod.operation = "UNION"
mod.object = union_list[k]
bpy.ops.object.modifier_apply(modifier=mod.name)
k=k+1
act_obj.select = False
bpy.ops.object.delete()
wm.progress_end()
Is there a way to catch Boolean modifier error in python and skip meshes which produce those errors?