Selected vertex attracts it's nearest neighbor to weld into it.
Hello guys,
I am in need of a script:
Selected vertex attracts it's nearest neighbor to weld into it.
If more than one vertex is selected, each selected vertex should attract to it the nearest neighbor. Only one vertex to be welded to the original vertex.
Would appreciate if anybody could help on this :)
Comments
Because you shows me the
Because you shows me the right direction. :)
My son is fill better, but still have temperature(tonsillitis).
Tools and Scripts for Autodesk 3dsMax
...
This can be done using get/set VDataValue polyop methods
bga
Thanks Branko for the
Thanks Branko for the suggestion! :)
The problem is that when Max
The problem is that when Max weld vertices the index of the new vert is changed. If you select only one vert and run the script then is easy to get the resulting vert index - it is always the smaller index(I hope) of the vertices that are welded. So this will works only when you weld 2 verts(one is selected, the script find other one)
The method above can't be used when you want to weld 2 or more verts. Welding the first pair of verts will change their indexes, so the next pair will have new indexes and the rule with the smaller index can't work. This is why the I not weld verts pair by pair - after the first weld process the cript will loose track of the next verts that have to be welded. So I use weld by threshold, which welds all verts at once and there is no problem with verts indexes. The code below will select the resulting vertices when you weld 1,2 or more pairs.
Tools and Scripts for Autodesk 3dsMax
Small addition if
Small addition if possible..
Script to keep the original vertices selected after the welding process?
At the end I have added:
(
Selection = SelVertsBA
)
It does work only in certain areas, and sometimes not at all.
I also tried the other way around with keeping the selection with the numbers of the vertices that were to be welded but it does not work as well.
I am very new to maxscript as you can guess :)
Thanks for the quick
Thanks for the quick help!
The script does its job in no time :)
It is easy to write a script
It is easy to write a script that do what you want.
Tools and Scripts for Autodesk 3dsMax
Another option..
If that's tricky another option that would also work is to convert that selection (one vertex, or few vertices placed in different places on the mesh) to edges, but only the shortest connected edge to each vertex. Then I could add collapse to the script :)