Select by edge loop and then reuse to select using lasso

Scripting in Blender with Python, and working on the API

Moderators: jesterKing, stiv

Darius
Posts: 3
Joined: Wed Nov 21, 2012 10:54 am

Select by edge loop and then reuse to select using lasso

Postby Darius » Wed Nov 21, 2012 11:14 am

Hello,
It is possible to do that?:
Separate by loosed parts and export them to dxf files.
The question:
It is possible to apply lasso selection using detected loosed part edges and create for example rectangle and circle inside them as one loosed part and then export to dxf?


Thank you

CoDEmanX
Posts: 894
Joined: Sun Apr 05, 2009 7:42 pm
Location: Germany

Postby CoDEmanX » Wed Nov 21, 2012 2:12 pm

you can select lose edges and verts, and you can separate by loose parts.

I don't understand what you wanna do after that...
I'm sitting, waiting, wishing, building Blender in superstition...

Darius
Posts: 3
Joined: Wed Nov 21, 2012 10:54 am

Postby Darius » Wed Nov 21, 2012 2:44 pm

I want to to this using script.
It must be exported to dxf when is separated

CoDEmanX
Posts: 894
Joined: Sun Apr 05, 2009 7:42 pm
Location: Germany

Postby CoDEmanX » Wed Nov 21, 2012 4:18 pm

well, how about

Code: Select all

import bpy

if bpy.context.object:
    bpy.ops.object.mode_set(mode='OBJECT')
    bpy.ops.object.select_all(action='DESELECT')

    ob = bpy.data.objects['YourUnseparatedOb']

    bpy.context.scene.objects.active = ob
    ob.select = True

    bpy.ops.object.mode_set(mode='EDIT')
    bpy.ops.mesh.separate(type='LOOSE')

    if not bpy.context.user_preferences.addons.get('io_export_dxf', False):
        bpy.ops.wm.addon_enable(module="io_export_dxf")

    bpy.ops.export.dxf(filepath="C:\\the\\filepath\\filename.ext", projectionThrough='NO', onlySelected=True, apply_modifiers=True, mesh_as='3DFACEs', entitylayer_from='obj.data.name', entitycolor_from='default_COLOR', entityltype_from='CONTINUOUS', layerName_from='LAYERNAME_DEF', verbose=False)

I'm sitting, waiting, wishing, building Blender in superstition...

Darius
Posts: 3
Joined: Wed Nov 21, 2012 10:54 am

Postby Darius » Wed Nov 21, 2012 8:49 pm

Coll!
That are first and last steps I want to do.
I need to save separated parts to different dxf files, after object is separated using command bpy.ops.mesh.separate(type='LOOSE').
Object like in the example below must be joined again and saved as one object.
Image
This is description why do I need this script:
1. I want to import puzzle dxf file for laser cutting
2. Later, I want to separate object into separated puzzle elements
3. Object like this wheel (picture above) must be joined again, because that is one puzzle element.
4. Objects must be saved to different dxf files. Later that dxf files will be imported to ProNest for cutting area optimization and this process is not related with Blender.

....................not be included in my script..................
5. In the next step on the puzzle elements (already separated) will be added faces.
6. Then they will be extruded.
7. Then will be added textures and will be created puzzle assembly animation
....................not be included in my script..................


Return to “Python”

Who is online

Users browsing this forum: No registered users and 1 guest