# connect vertex from edges

hello
I was very proud of my script (!) to connect vertex from edges.
It works great when vertex id are in good order.
When it is not it can't work. :-( In fact vertex id are in general not in good order...
If somebody could do a tool like that, or point me to an existing solution.
Thanks.
(show and hide the vertex numbers is written by Jason Redway, September 2013)

AttachmentSize
1.jpg68.6 KB
2.jpg58.51 KB
3.jpg48.88 KB
connect.txt1.35 KB

## Comment viewing options

### .

Try to write a script following next steps

1) get first edge loop(loop1) with verts verts01BA = #{1,4,5,7,10,11,14,16}
2) get second edge loop(loop2) with verts verts02BA = #{2,3,5,6,8,9,13,15}
3) on first loop find which verts is "first vert". It will belobgs to only one edge of the first edge loop. The "last vert" also can be found. All other edges will have 2 edges from the verts01BA.
4) on second loop find which verts is "first vert". It will belobgs to only one edge of the first edge loop. The "last vert" also can be found. All other edges will have 2 edges from the verts02BA.
5) so you have:
loop1 -> first vert = 5, or first vert can be vert 16
loop2 -> first vert = 6, or first vert can be vert 15
6) for the first vert of loop1 find the closest first vert of loop2: you will haveverts 5<->6 or 15<->16
7) for vert 5 of loop1 find the next vert of the same loop. It will belong to the edge that vert 5 belongs. You will find that next vert is 4, then find the next vert of vert 4(it belong to the edge that the vert 4 belong and that edge is a part of loop1). Do this until you will find the verts order of loop1. Let say that the verts are stored in verts01OrederArr
8) repeat 7) but for loop2. The start vert is vert 6 - closest to the start vert of loop1. Let say that the verts are stored in verts02OrederArr
9) Both verts order must be stored in array. IF you use bitarray the verts will be rearanged and you will loose the verts order.
10) In best case in both arrays(verts02OrederArr and verts01OrederArr) you will have the same amount of vertices.
11) Now, start connecting the verts from verts01OrederArr with the verts from verts02OrederArr. The first vert connect to the first vert, the second vert connect do the second vert and so on.
12) if the amount of verts in both arrays(verts02OrederArr and verts01OrederArr) are different, start connecting the verts from the array with lower verts count to the verts from the array with higher verts count.

:)

### Thanks for answer Miauu. I

Thanks for answer Miauu. I think you know How much I like arrays and bittarrays... If I have enough time (at last one year) I'll try to make this script with your indications... but I don't script very much at the moment.
As I wrote earlier, I'll use another method... :-)

### .

I hope quadify will works in all situations. :)
If I have time I will write this as a script.

Thanks

### mmmfff... Just connect wanted

mmmfff...
Just connect wanted selected vertex, then quadrify selection...
More easy :-)