editpoly vertex point3

Just want to loop through the selected verts in a edit poly modifier and get there point3 values.....

m = $.modifiers[#Edit_Poly]
m.GetOperation #TransformVertex   --?????

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
JokerMartini's picture

Nice work

That's great. It does work.

This is what I've got as the final resulting code.
Next is figuring out how to set just one axis such as only the X

selVertArr = selection[1].modifiers[#Edit_Poly].getSelection #Vertex
selection[1].modifiers[#Edit_Poly].SetVert selVertArr [10,20,30]

John Martini
Digital Artist
http://www.JokerMartini.com (new site)

Anubis's picture

Hey, SetVert work for me! :)

Why we so complicated... yeah, SetVert function missed in the help for epoly_mod but it work :) so if i say: ep.SetVert #{8} [10,20,30] then my vert 8 is set to that [10,20,30] pos in a world space. So next code is fine for me:

max modify mode
!REG3XP1!>modPanel.setCurrentObject ep
verts = ep.GetSelection #Vertex
ep.SetVert verts [10,20,30]

(* remove "!REG3XP1!>", i seen this before, its not a part of the code but forum addition)

my recent MAXScripts RSS (archive here)

Anubis's picture

:)

Yep, the lack of functions in epoly mod complicate it usage. For example, if I move vert with MoveSelection() and need the new vert coords, I s'd add TurnToMesh mod, else get the old vert pos, realy odd. Not sure is it a bug in my Max (2009) or general limitation but its weird :(

It was a while back when I used epoly mod for a last time :) Maybe s'd check SetSelection() function. Not sure, but it may not refresh correct. Try to cleanup 'old' selection and then set new one, i.e.:

ep.SetSelection #Vertex #{} -- clear sel.
ep.SetSelection #Vertex #{vert} -- then set new

Also about the MoveSelection() ... needs a bit of measurement here...

trgPos = [10,20,30]
for vert in selVertArr do (
	ep.SetSelection #Vertex #{}
	ep.SetSelection #Vertex #{vert}
	-- measure new coords
	curPos = ep.GetVertex vert
	movePos = curPos + (distance trgPos curPos)
	if curPos.x > trgPos.x do movePos.x += -1
	if curPos.y > trgPos.y do movePos.y += -1
	if curPos.z > trgPos.z do movePos.z += -1
	-- then use 'move'
	ep.MoveSelection movePos
)

Let me know if this help.

my recent MAXScripts RSS (archive here)

JokerMartini's picture

Yeah it's still seeming to

Yeah it's still seeming to not working right.

I feel like this task should be simpler than it is haha.

It's not moving the selected verts.

John Martini
Digital Artist
http://www.JokerMartini.com (new site)

Anubis's picture

if not setVert then try (SetSelection + MoveSelection)

Hmm, yep, I not see setVert() for epoly modifier :/ If polyop.setVert not works, then try again with MoveSelection but iterate and because its affect selected then just select only 1 vert in the loop, that s'd do the trick, I think.

ep = selection[1].modifiers[#Edit_Poly]
modPanel.setCurrentObject epmod
SetEPolySelLevel #Vertex
subObjectLevel = 1
selVertArr = ep.GetSelection #Vertex
for vert in selVertArr do (
	ep.SetSelection #Vertex #{vert}
	ep.MoveSelection [10,20,30]
)

my recent MAXScripts RSS (archive here)

JokerMartini's picture

Yeah it doesn't seem to be working.

This is what i've come up with that is bugging out.
This is for the edit poly modifier don't forget.

selVertArr = selection[1].modifiers[#Edit_Poly].getSelection #Vertex
for vert in selVertArr do (polyop.setVert $ vert [10.0,20.0,30.0])

John Martini
Digital Artist
http://www.JokerMartini.com (new site)

JokerMartini's picture

I simply just want to set the

I simply just want to set the world position of a selected vert.

For example a i want to select a vert and then move it to [10,20,30] in world space.

John Martini
Digital Artist
http://www.JokerMartini.com (new site)

Anubis's picture

?...

Hi John,
am not sure i catch your goal.. 'move' is an offset function, moving vert with world coords [10,10,10] with [20,20,20] will put it in a [30,30,30], its exact as PosPoint3 += PosPoint3. Maybe you try to set all selected verts to the 'constant' point in space? If so, try polyop.setVert.

my recent MAXScripts RSS (archive here)

JokerMartini's picture

How do I move the selected

How do I move the selected vert to a specific location in world space, not local. Which is moves in local right now.
I want to be able to type in a point 3 value and move the selected vert to that position.

Thanks

selVertArr = selection[1].modifiers[#Edit_Poly].getSelection #Vertex
for vert in selVertArr do (selection[1].modifiers[#Edit_Poly].moveselection [10,10,10]

John Martini
Digital Artist
http://www.JokerMartini.com (new site)

miauu's picture

Use this to get the point3

Use this to get the point3 coordinates:
-- 102 is the index of the esired vertex
$.modifiers[#Edit_Poly].GetVertex 102

vArr = $.modifiers[#Edit_Poly].getSelection #Vertex
for v in vArr do print ($.modifiers[#Edit_Poly].GetVertex v)

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.