move vertices of baseObject with modifiers on top
Hi I would like to make a script which moves all selected Vertices to x=0.
This is what I have so far
for i = 1 to (((modPanel.getCurrentObject()).GetSelection #Vertex) as Array).count do
$.selectedVerts[1].pos = [0, $.selectedVerts[1].pos[2], $.selectedVerts[1].pos[3]]
Unfortunately, It is not working with modifiers on top.
I've also tryed move $.selectedVerts [$.selectedVerts[i].pos[i]*-1,0,0] but both methods give the same error :(
What am I doing wrong?

Comments
Thank you all for your
Thank you all for your answers :D
Sorry vor the late response. I used the wrong email notification settings :(
Perfect_Storm/ barigazy, thanks for your help :D
I wasn't expecting that I would have to use a workaround to move a few vertices.
Thanks again :)
untested code...
try it anyway :)
my recent MAXScripts RSS (archive here)
Hi Anubis, i test you code
Hi Anubis,
i test you code and not works
bga
aha, ok
am still not tested it, as the most collections in Max are mapped I presume that I can set #x at once by calling "selectedVerts.x=0" but if that not work looks like need a for-loop.
P.S. -- I check the help now and maybe replacing "...selectedVerts.x" with "..selectedVerts.pos.x" will work?
obj.baseObject.selectedVerts.pos.x = 0my recent MAXScripts RSS (archive here)
Here you go
Ok here you go then.
The script checks if an object has modifiers, and if so, if the last modifier is an Edit_Poly modifier.
If that's the case, it will use that modifier to move the verts.
If it has any other modifier on top, it will create an Edit_Poly modifier.
If an object has no modifiers at all, it will convert the object to Editable_Poly (If needed) and then do the transformations to the verts.
note: It should work with multiple objects, but I haven't tested that yet.
If an object has an edit poly
If an object has an edit poly modifier bind to them, you can't use the normal Polyop or Editable Poly commands anymore.
This is because you transformed the object to a PolyMesh.
I suggest you always create a new Edit Poly modifier, and work with that.
The advantage that this gives you is that you can always have your old modifiers and it will always work.
The disadvantage is that you will stack an Edit Poly modifier on top of your object.
I already created the code for you, here it is:
For some reason, setSelection did not work as it should, so I just cleared the whole selection first and then used select to select the vertex.
Maybe this can be optimized, dunno, have a look at the documentation.
Thank you for your quick
Thank you for your quick response.
I planning to use that macro a lot ... so it would be kinda unconfortable to add a new edit poly modifier each time :)
What I've planed to do is to add an if statement to check if I'm working on an editable poly modifier or the baseobject. How should the code look when I'm moving the vertices on the baseobject?
Another solution
bga