EditPoly set vertex absolute position with MaxScript


#1

I figured this would be a simple thing, but I can’t figure it out.

Is there a way to set the absolute position of a vertex, not an offset, using MaxScript?

If I am in EditPoly, I can select a vertex and with the Move Transform window I can type in the absolute position of the vertex.

When I use the macro recorder it adds $.modifiers[#Edit_Poly].MoveSelection xxxx
The xxxx is a bunch of offset and axis data which doesn’t work how I want when evaluated/executed.
It seems MoveSelection only does offsets because you can have multiple verts selected.

I want to do something like this and have it move vertex 1329 to absolute xyz position.
$.modifiers[#Edit_Poly].setpointpos 1329 [x,y,z]
(I know setpointpos doesn’t exist, its just an example of what I’m looking for)

This works for getting the xyz
getpointpos $ 1329 --Returns absolute world position of vertex 1329


#2

polyop.setvert $ 1329 [x,y,z]


#3

Thanks Miauu

This only works on an Editable Poly on the bottom of the mod stack.
Is there a way to do it in the EditPoly modifier?

I tried this but I get an error… (I am testing on vertex 1)

$.modifiers[#Edit_Poly].setvert 1 [-0.0641856,-0.192567,42.2981]

Unable to convert: 1 to type: BitArray


#4

EditPolyMod.SetVert $.Edit_Poly #{1} [0,0,0] node:$
$.modifiers[#Edit_Poly].Commit()


#5

Thanks, that works :slight_smile:

I just figured this out too, which works when inside subobjectLevel = 1 of EditPoly.

$.modifiers[#Edit_Poly].Select #Vertex #{1}
selectedVert = $.modifiers[#Edit_Poly].getSelection #Vertex --BitArry
$.modifiers[#Edit_Poly].setvert selectedVert [-0.0641856,-0.192567,42.2981]