Results 1 to 4 of 4
  1. #1

    Select / or delete small objects (dimension > ...) - script

    Hello,

    how can I select objects that have a smaller dimension X value then 0.02 or so!?

    I only found the py.ops.object.select_pattern(pattern="*Name*"), but how can I select or delete by dimension !?

    THANXS



  2. #2
    Member SterlingRoth's Avatar
    Join Date
    Mar 2006
    Location
    Portland, OR
    Posts
    1,805
    You're going to need a little bit more advanced scripting for that. The bpy.ops functions are rather limited in their scope.

    This code steps through each object in the scene and compares the x dimension to a fixed value, selecting the smallest objects:

    Code:
    import bpy
    
    for i in bpy.data.objects:
        if i.dimensions.x < .02:
            i.select = True
    The BlenderArtist formerly known as Mexicoxican



  3. #3
    Here's something for just mesh objects. Remove last line not to delete.

    Code:
    import bpy
    
    
    scene = bpy.context.scene
    
    for ob in scene.objects:
        x = ob.dimensions[0]    
        y = ob.dimensions[1]
        z = ob.dimensions[2]
                
        if ob.type == 'MESH':
            if x < 0.02:
                ob.select = True
            else: 
                ob.select = False
    
    bpy.ops.object.delete()



  4. #4
    python rocks



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •