I have several objects which have boolean relationships to each other. The end object still depends on all sub-objects, so that if I delete one of them it goes away in the end object. Is there a way to convert the end object to a single independent mesh? I tried this but it didn't work:

    end_mesh = end_object.data
    bm_end = bmesh.new()

You can also use bpy.ops (to change a little), so it is simply:

import bpy


This script will add a copy of all selected objects in the scene's main collection with all modifiers applied.

It works with objects that have geometry, not only mesh objects. (Don't select a lamp or camera)

import bpy

context = bpy.context

for obj in context.selected_objects:
    depsgraph = context.evaluated_depsgraph_get()
    m = obj.evaluated_get(depsgraph).to_mesh()
    o = bpy.data.objects.new(obj.name + "_applied", m.copy())
    o.matrix_world = obj.matrix_world.copy()
    # Link the new object to the scene collection if it isn't yet :
    coll = context.scene.collection
    coll.objects.get(o.name, coll.objects.link(o))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.