Scripting Reverse Boolean So how would I script something that basically duplicated an object and took the last boolean modifier and reversed it while keeping the original modifier order? For example difference to intersect and vice versa?
import bpy
context = bpy.context
scene = context.scene

obj = context.object.copy()

bool_mods = [m for m in obj.modifiers if m.type == 'BOOLEAN']

if len(bool_mods):
    mod = bool_mods[-1]
    if mod.operation == 'DIFFERENCE':
        mod.operation = 'INTERSECT'
    elif mod.operation == 'INTERSECT':
        mod.operation = 'DIFFERENCE'

scene.objects.link(obj)