ScriptSpot

Forum topic · General Scripting

vertex order

By titane357 · 2011-08-27

Description

hello, still have problem with vertex order.
I made a little script to distribute linearly selected vertexes on z axis.
But when the selected vertexes are not in the good order, there is a problem...
If I select the corresponding edges and "create shape from selection", max create a line with "correct" vertex order.
Is there a way to correct or reorder the object vertex order according the line vertexes ?
Thanks.

Comments (2)

titane357 · 2011-08-30

thanks for answer anubis. It is very annoying that max can't automatically keep selection order... :-(

Hi Titane

Anubis · 2011-08-27

Well, no way to reorder the vertices. Each vert is a part of minimum 1 face, and even in a single face (with 3 verts) the order of the verts is important.

About the selection ordering on sub-obj level, as I remember this was discussed somewhere here. Max use BitArray which is always auto-sort itself.

If your selected verts are linear (as you said), then you need to identify only the first/start vert (by amount of binded edges, by pos, or if no other way - by picking it with the mouse). Next (multi)-step would be to compare distance between 1st and verts into your SelArray; finding most closer; move it by Z (or what needed); remove it from the SelArray; and now compare distance between those current vert and the rest remaining into the array - i.e. repeat previous steps.