Notifications
Clear all

[Closed] select baseobject verts

can someone tell me where i’m wrong in here?
I want to get the vert selection of the baseobject
then I use

getvertselection $.baseobject

It’s wrong, and I have to use

getverselection $.baseobject.mesh
5 Replies

well, the reference told me to use

getvertselection $

to get the vert sel of the base object, but I tried in max 7 It didn’t. u’ve got to try that out 2:eek: , i can’t believe the reference wrong at this? Or it’s the problem with my english? /banghead

1 Reply
(@bobo)
Joined: 11 months ago

Posts: 0

Where did the reference tell you that?!?
Below is the getVertSelection definition from the reference.

As you can see, getVertSelection can be applied to either a NODE, a Modifier on the stack of that node, or a MESH.

.Baseobject is neither. So you did the right thing and captured the TriMesh value from the .baseobject, which gives you the mesh to apply the second form of the method…

QUOTE:

[color=white]Mesh [/color][color=white]Vertex Selection:[/color]

[left][b][b]getVertSelection[/b][/b] <node> [  <modifier_or_index> ] [ [b][b]name[/b][/b]:<name> ]

[/left]
[left]
[/left]
[left]getVertSelection <mesh>
[/left]
[left]Returns the current vertex selection set, or the specified named selection set if the optional name: parameter is specified, as a BitArray. The optional <modifier_or_index> identifies the Edit Mesh or Mesh Select modifier on the given scene object from which the selection BitArray is obtained.

[/left]
[left]For example:
[/left]
[left]getVertSelection $foo $foo.modifiers[3]

[/left]
[left]If the optional <modifier_or_index> argument is not supplied, the <node> must be an Editable Mesh object and the selection is taken from the base object. If <modifier_or_index> is supplied, it must be either a modifier on the node or a number. If it is a modifier, it must be either an Edit Mesh or a Mesh Select modifier. If it is a number, it is used as an index into the Edit Mesh/Select Modifiers on the <node> starting from the top of the stack.
[/left]
[left]
[color=White]Note[/color]

[/left]
[left]that this index does not count any other types of modifier present. So, an index of 1 will always get the selection currently active at the top of the stack.
[/left]
[left]The function returns a BitArray that are the 1-based indexes of the vertices currently selected, or the vertices specified by the named selection set, in the object by the given modifier.

[/left]
[left]For example:
[/left]
[left]getVertSelection $foo $foo.modifiers[3]
[/left]
[left]yields
[/left]
[left][color=blue]#{2…5,9,25…27}

[/color] [/left]
[left]This is a snapshot of the selection—the BitArray doesn’t change automatically as you make different selections. Further, it reflects the current vertex selection whether or not the modifier is in vertex sub-object selection mode (this selection is remembered and re-established whenever you go back into vertex subobject mode). So, for example, if you select some vertices then click out of vertex subobject mode, the whole object rather than the selection is passed up the stack to the next modifier, but getVertSelection() returns the selected vertices at the time the subobject mode was exited.
[/left]
[left]You might use the modifiers modifier array accessing scheme here if you’ve got many edit mesh modifiers with non-unique names. You can also use a constructed string as an index into the modifiers array,

[/left]
[left]for example:
[/left]
[left]$foo.modifiers[[color=maroon]”[/color][color=maroon]edit mesh[/color][color=maroon]”[/color][color=maroon][/color]+ i as string]
[/left]
[left]
[/left]
[left]
[/left]
[left]
[/left]
[left]
[/left]

If the optional <modifier_or_index> argument is not supplied, the <node> must be an Editable Mesh object and the selection is taken from the base object
I mean ,as it says ,

getvertselection $

is supposed to get vert sel from the current node’s base object not the object’s world state? right? but it did get that from the world state
btw, the .baseobject is not a editablemesh? yes, I shouldn’t , but when I use

classof $.baseobject

I get Editable_mesh,
[size=1][size=3][color=white]thanks for helping out , bobo:love: [/color][/size][/size]

Sounds like an error in the documentation to me
It takes the selection from top of the stack, unless there are no modifiers (when the baseobject IS the top of the stack :))
Will be fixed next time.

cheers! for 3ds max will get better with this fixed, and for the first time I found error with 3ds max:shrug: