Hello
I "made" a simple script to align poly vertexes to first selected vertex.
But it don't align (always) to first selected vertex...
Dummy is just here to see which vertex is taken for align...
Please if somebody can help....
(
global vertPosition
selectedVert = polyOp.getVertSelection $ as array
vertPosition = polyOp.getVert $ selectedVert[1]
Dummy pos:[vertPosition.x , vertPosition.y , vertPosition.z]
for loopVerts = 1 to selectedVert.count do
(
tempVert = polyOp.getVert $ selectedVert[loopVerts]
polyOp.setVert $ selectedVert[loopVerts] [tempVert.x, tempVert.y, vertPosition.z ]
)
)
Comments (8)
Comment policy
yes, Max auto-sort them so just collect your wanted vertex separately.
hi Anubis,
Perhaps for Objects Max keep right order, but if you take a look to the .png, you will see that if I select vertex #5 then vertex #7 or in reverse order, resulting array is the same : [5,7] :-(((
Attachments
Then the problem is about selection order. Max always return correct order, ie if there is some array: "sel=#(3,5,8)" then sel[1] will be 3, right? But are there sel[1] is the value that we need?... For more clear - to say 5 boxes in the scene and we wont to collect them:
-- second line is result, as you see sel[1] will return "Box04" not "Box01". In Max available "sort" fn:
-- well, now sel[1] will be "Box01". So in your case you must to decide how to collect align vertex.
hello
Thanks for help,
But in fact after testing, I saw that "selectedVert[1]" is not the first selected vertex but the first vertex in the array which 3dsMax reorder in growing order....
How can I tell Max to return me the first selected vertex ?
Okay, another hint - on FOR loop you start count from 1 that mean you include 1st vertex also, so the script will try to align 1st vertex to itself. Try to exclude it form the loop startin count by 2 like:
With this code, if the Array is #(1,3,7), the variable loopVerts will go from 1 to 3, because the arraycount is 3:
But you want to go through each item of the array, with this code loopVerts will be 1, 3 and 7:
yes, Anubis.
In fact I have 3 shortcut keys : one for x, one for y and one for z. This script is for z align.
But this script don't always align selected vertexes to the first selected vertex,and I don't understand why,.... :-((
I see so only Z axis affected