Selection order of selectedVerts

Hey folks, I'm quite new to MAXScript and am a bit stumped with this one.

Basically, all I'm trying to do is to be able to create an array of verts within an editable poly, based on the order in which they were selected. I thought that selectedVerts would probably contain all this anyway, but instead it orders them via their corresponding ID number.

The only way I could figure out a workaround (with my limited knowledge) is to start a script that initialises a selection process and builds an array with each new vert. This is ok, but not that great for speed.

Any suggestions would be very welcome.

Thanks!

Comments

Comment viewing options

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

as anubis said Max auto sort

as anubis said

Max auto sort selection by id (because its a bitArray)

mm if that's true as Mackinder mean, yes that's right Anubis.
I just think, by picking vertex selection script method it's can do that as array we wanted. I don't have idea to write a script right now.

but I think something ...
Mackinder, if you need a sphere should have a name corresponding to the vertex ID, I can do that. So do you need that ? it's up to you body. :)

Anubis's picture

you think right

Hey Mackinder, you think right.
Max auto sort selection by id (because its a bitArray)
and need to initialises a selection process.

my recent MAXScripts RSS (archive here)

Mackinder's picture

Hey, thanks for the help.

Hey, thanks for the help. But I'm still a little confused. When the spheres are created, it creates Sphere001 at the vert position with the lowest ID number. So it's still not creating them in order of the verts by selection, but rather just as their lowest ID upwards. For example, I would select vert 6 then vert 1, but it would create Sphere001 at vert 1's position, then Sphere002 at vert 6's position.

Am I missing something?

Thanks for the help.

Budi G's picture

hi Mackinder you can try

hi Mackinder

you can try this:

fn selvert_replacer obj =
(
  vertsel = ( polyop.getVertSelection obj ) as array
  for i=1 to vertsel.count do
   (
     vp = polyop.getVert obj vertsel[i]
     newobj = sphere radius:3 pos:vp -- create a sphere as an example array
   )
)
selvert_replacer $

to using it please select multiple vertex then run a script

Comment viewing options

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