1
$\begingroup$

I am generating rubble with cell fracture. This means I have hundreds of objects. For various reasons, I want to select all of the larger pieces. Is there a way to select all objects above a certain size, or deselect all below a certain size?

Scripts are good too.

$\endgroup$
4
$\begingroup$

enter image description here

This script will select all the objects that have a similar volume to the selected object (by similar I mean the same rough scale - tens, hundreds, thousands, etc):

import bpy, bmesh

bm = bmesh.new()
bm.from_mesh( bpy.context.object.data )

ref_obj_name     = bpy.context.object.name
reference_volume = float( bm.calc_volume() )
ref_vol_scale    = ( '%.0E' % reference_volume )[-3:]

# Select all the objects in the scene that have a similar volume (of the same scale)
for o in [ m for m in bpy.context.scene.objects if m.type == 'MESH' ]:
    if o.name == ref_obj_name: continue

    bm = bmesh.new()
    bm.from_mesh( o.data )

    vol       = float( bm.calc_volume() )
    vol_scale = ( '%.0E' % vol )[-3:]

    if vol_scale == ref_vol_scale:
        o.select = True
$\endgroup$

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.