How to properly merge mesh vertices in python...

Scripting in Blender with Python, and working on the API

Moderators: jesterKing, stiv

Post Reply
dvochin
Posts: 0
Joined: Mon Aug 20, 2012 9:39 pm

How to properly merge mesh vertices in python...

Post by dvochin »

Hi all,

I'm trying to select all vertices of a mesh just-converted from a spline using a call to:

bpy.ops.view3d.edit_mesh_extrude_move_normal()

and then a call to :
bpy.ops.mesh.merge(type='COLLAPSE')

But the problem is that my python script leaves Blender in a mode where it awaits user mouse input to move the merged vert into position. If I could cancel that mode I would be ok (maybe by sending an 'Esc' key?) but I don't know how.

As a hint, the call to edit_mesh_extrude_move_normal() yields "convertViewVec: called in an invalid context" in the console when I happen to move the mouse in the view... possibly a hint that I'm invoking a view function when I should be invoking bpy.ops.mesh.extrude_vertices_move() instead.

However, bpy.ops.mesh.extrude_vertices_move() doesn't give the results I want (it only extrudes the verts without creating triangles between them like the view3d call), and if I invoke object mode blender crashes.

How can I either 1) extrude then merge without blender awaiting UI mouse movement or 2) send a 'cancel looking for mouse movement' to blender in order to get past this?

Thanks for any hint you can offer... have been stuck on this the entire day!!

Dan,

dvochin
Posts: 0
Joined: Mon Aug 20, 2012 9:39 pm

Re: How to properly merge mesh vertices in python...

Post by dvochin »

Never mind the above, by changing to a call to bpy.ops.mesh.extrude_edges_move() blender does what I want... :)

Post Reply