polyop method and subobject INDEX

Hello there,

I am feeling pretty stupid but I can't get how to find/use index of subobject with polyop method.
They talk about vertexlist/edgelist and facelist but I can't do many things with that (if I print it I just see #{} ). For example, if I want to get the difference between two face's selection or so I need more info than just an empty {}.

What I want actually is an array of my subobject selection that way I could store it. I tried with bitarray instead of array but no more success.

Is it possible to get something like a real array?
Actually I have many further questions but I always try to find it by myself and "google" ^^ but I am pretty sure I can't do anything if I don't fix this issue.

Thank you

Comments

Comment viewing options

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

.

Create a teapot(for example), convert it to editable poly. Go to vertex subobject level and select some vertices. Then, while the teapot is selected, execute this

vertListBA = polyop.getVertSelection selection[1]

In the MaxScript Listener will be printed the bitarray that holds the indices of the selected verts. Something like this:
#{90, 334, 338..339, 341..344, 347..349, 353..354, 359, 364, 370..401}

Now those indices are stored in the vertListBA variable. If you want those indices to be stored in array then use this:

vertListBA = (polyop.getVertSelection selection[1]) as array

and if the same verts are selected you will see this:
#(90, 334, 338, 339, 341, 342, 343, 344, 347, 348, 349, 353, 354, 359, 364, 370, 371, 372, 373, 374, ...)

If you want to get the difference between two face's selection:

--select some faces and run this
face01BA = polyop.getFaceSelection selection[1]
--select some other faces
face02BA = polyop.getFaceSelection selection[1]
--now you can use those two bitarrays to find the:
-- difference
face02BA - face01BA
-- intersection
face02BA * face01BA
-- to union the two arays and only the unique indices to remain in the resulting array
face02BA + face01BA

Comment viewing options

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