Currently I only know of one way to join meshes - using the join operator:
bpy.ops.object.join()
This has an annoying overhead of additional operations required to select the objects you want to join, etc.
But what if I only want to join elements from two different meshes? This will be even more cumbersome with traditional methods: select the object, go to edit mode, select the relevant elements, duplicate them, separate them to a new mesh, join the new mesh with the other mesh...
It would be much nicer if I could just create two bmesh objects, then directly copy elements from one to the other. Something like this currently illegal code:
for v in bm1.verts:
bm2.verts.add( v )
# or:
bm2.edges.add( bm1.edges[5] )
At the moment this requires adding the vertices first via their coordinates, then adding faces or edges by referencing the relevant new verts.
# Example for adding all the edges from another bmesh object
current_last_vert_index = len( bm2.verts ) - 1
for v in bm1.verts:
bm2.verts.new( v.co )
for e in bm1.edges:
verts = [ bm2.verts[ current_last_vert_index + v.index ] for v in e.verts ]
bm2.edges.new( verts )
So, any better way to do this?
bmesh.ops.duplicate
that unfortunately is also unimplemented when using dest. Maybe a friendly word to some devs can get this working in the next release. I think I'll go add it to rightclickselect.com $\endgroup$