# merge vertices at center bmesh

I have a script that makes 2 circles extrude them then bridge loop them and finally solidify.

After solidify is done I noticed that the inner vertices are overlapping instead of merged. (See screenshot.)

I tried Automerge editing but does not work.

I tried bmesh.ops.remove_doubles but I am getting this error:

TypeError: verts: expected (BMVert), not 'list'


The variable that holds all the vertices (multiple variables) looks like this:

[<BMVert(0x0000022F5872FC20), index=96>,
<BMVert(0x0000022F5872FC58), index=97>,
<BMVert(0x0000022F5872FC90), index=98>,
<BMVert(0x0000022F5872FCC8), index=99>,
<BMVert(0x0000022F5872FD00), index=100>,
<BMVert(0x0000022F5872FD38), index=101>,]


The vertices that needs to be merged are coming from 2 different variables.

I tried to convert the list to an array but this did not work either.

If I take a look at the API https://docs.blender.org/api/master/bmesh.ops.html?highlight=bmesh%20ops%20bridge_loops#bmesh.ops.remove_doubles it says:

bmesh.ops.remove_doubles(bm, verts, dist)

Remove Doubles.

Finds groups of vertices closer then dist and merges them together, using the weld verts bmop.

Parameters:

• bm (bmesh.types.BMesh) – The bmesh to operate on.
• verts (list of (bmesh.types.BMVert)) – input verts
• dist (float) – minimum distance

So I give remove_doubles a list but it errors out on me. How can I solve this?

In the screenshot you see 1 circle (blue) that is how the vertices are now and the square is how I want it:

This is the remove doubles as how I tried it:

bmesh.ops.remove_doubles(bm,
verts=[myarray, myarray1],
dist=d)


Selecting the edge loops and then merge by distance gives the correct result So if that is possible that would be great

As far as I see in your screenshot it seems like your solidifying the faces apart of eachother. The faces of the circle and i assume the bridge loop?

Besides that if you want to combine multiple lists and use them in an operator you need to use the + character.

Assuming now because your code is missing, Try this

bmesh.ops.remove_doubles(bm,
verts=myarray + myarray1,
dist=d)


Instead of the myarray variable use the variable that holds the vertices. The variable you used to get the vertices in the first place.

• seems to work in my script Thanks @DGRL – cexoso Dec 29 '19 at 21:44

It's a python type error

Python error is telling you that a type in this line is wrong. It's getting a list instead of BMVert

Note this piece of code comes from your question and is WRONG

verts=[myarray, myarray1]


since verts is expecting a list of BMVerts (as pointed out in the documentation you linked) without even seeing your code it suggests myarray, myarray1 are both lists. Agree with sentiment here to post code

Recommended change

If both myarray, myarray1 are lists of verts sum them

verts = myarray + myarray1


I did google for few hours and could not find any usefull help Anyway your code gives me the same error verts=[myarray, myarray1] TypeError: verts: expected (BMVert), not 'list'

I used your piece of code to combine the variables vertstomerge = [verts_start_a, verts_start_b, verts_start_c] Then I did this bmesh.ops.remove_doubles(bm, verts=vertstomerge dist=0.001 ) Error TypeError: verts: expected (BMVert), not 'list'

No I recommended adding them together. Could it be that type(verts_start_a) b, c, d is a list?, if it is it will lead to a type error, getting a list, expecting a BMVert. .

Tip: Search stackoverflow, or google on the cause of errors. Probably find the solution quicker than writing this question.

• I did google for few hours and could not find any usefull help Anyway your code gives me the same error verts=[myarray, myarray1] TypeError: verts: expected (BMVert), not 'list' – cexoso Dec 29 '19 at 15:48
• That's your code??????? Any suggestion re code in answer is purely speculative on what the variables are. Post all your code and we'll see .. and if it happens that the type of either myarray or myarray1 is list then??? – batFINGER Dec 29 '19 at 16:23
• I used your piece of code to combine the variables vertstomerge = [verts_start_a, verts_start_b, verts_start_c] Then I did this bmesh.ops.remove_doubles(bm, verts=vertstomerge dist=0.001 ) Error TypeError: verts: expected (BMVert), not 'list' – cexoso Dec 29 '19 at 16:37