[Closed] Set a named selection in subobject level. Possible ?
Hello,
I try to set a named selection when I m in subobject level ( with maxscript of course ).
I don’t want to stock the selection in memory (I know how to do that), I want create a named selection who appears in the combobox, and that the user can select.
It seems impossible. The only thing I found about the subobject level selection in the maxscript help is : max rns
Anyone know if it’s possible ?
Thanks
It is not too obvious, but you can!
Take a look at the following chapters in the MAXscript Reference:
“VertexSelection Values”
“EdgeSelection Values”
“FaceSelection Values”
As you can see, Sub-Object Named Selection sets are handled by a separate system (as they are stored locally in the object and not globally as the object-level Named Selection Sets described in “SelectionSetArray Values”)
You will also notice that the array of sub-selections is read-only.
This is not a problem though, as the method appendSubSelSet described in the “Main Toolbar” chapter lets you add a new SubSelectionSet name to the drop-down list!
The new name will NOT contain any selection though – if you have created a named sub-selection set called “Test1” using
appendSubSelSet “Test1”
while in Modify panel, Vertes SO mode, asking for
$.Verts[“Test1”]
will return undefined.
BUT you can add your own selection to the new entry, either an explicit one, or the current selection from the scene:
$.Verts[“Test1”] = #{1…50} –add vertices 1 to 50 using explicit bitArray
$.Verts[“Test1”] = $.SelectedVerts –add the currently selected vertices
The same applies to Edges and Faces. It works in EPoly and EMesh sub-object modes.
NOTE that you must be in the Modify panel and in the correct SO mode to get correct results… Also note that adding a new entry to the drop-down list does not make the entry the active one, it just appears at the end of the list…
Hope this helps!
Cheers,
Bobo
$.Verts[“Test1”] = #{1…50} –add vertices 1 to 50 using explicit bitArray
YES ! Work perfectly !
Now… everything is possible :buttrock:
And… nothing can stop us
Just remember that the named selection sets do not survive topology changes. Not the last time I checked at least. Meaning if you do for example a tesselation somewhere you will loose all of them.
/Andreas