A MAXScript Perspective – Groups in 3ds Max

Hello

This is post is about a little observation I have made (probably not the first person) about groups in 3ds Max and their relationship to MAXScript.

Ever since I looked at the MAXScript reference in regards to groups, I now think of articles like this:

http://blog.duber.cz/3ds-max/what-are-groups-in-3ds-max

or this:

http://jamiesjewels.typepad.com/jamies_jewels/2011/07/13-3ds-max-quicktip-groups-are-bad.html

My observation comes from when you are creating them (at least from scratch anyway) and it may provide an small insight to how they could be dealt with if you have to use them.

The Test…

So if you have 3ds max then follow these steps:

  1. In a new scene, create a few primitives (these can be anything as this is just a test).

    1. Group of newly created 3ds Max primitives.
    1. Group of newly created 3ds Max primitives.
  2. Group your new primitives together (Group > Group…) and name that group (can be anything).

    2. Giving the group a name.
    2. Giving the group a name.
  3.  Now open up the MAXScript listener (MAXScript > MAXScript Listener… or press F11). Make sure your group is still selected.

    2. The group is still selected and the MAXScript listener
    2. The group is still selected and the MAXScript listener
  4. Type

    and you will notice that it is the name of your group (if it is not then just re-select the group again and re-type out selection[2].name ).

    4. The MAXScript Listener with a line of code - selection[2].name
    4. The MAXScript Listener with a line of code – selection[2].name
  5. Now repeat steps 1-4 and you should get the name of the group again.
  6. You may also want to type

    (make sure your group is selected as the isGroupHead method requires a node which in this case is your selection) and it should return true!

    6. The MAXScript Listener with a line of code - isGroupHead selection[2]  returned true
    6. The MAXScript Listener with a line of code – isGroupHead selection[2] returned true

So what does this tell us? It tells us that a newly created group’s “head” node is (EDIT: always seems to be) in the 2nd index (the 2nd slot) of the group, (or the array as that is technically what a group is)  hence why we used selection[2].

What is a Group then?

A Group in 3ds Max is an “invisible” dummy object that has been created to become the parent of the objects in the group.

The name of the group comes from the group’s head node (the dummy object) and If you open up a schematic view (Graph Editors > New Schematic View… or Saved Schematic Views if you already have one), then you should be able to visually see the hierarchy 🙂


So in short, if you are using Groups in 3ds Max, take caution and if you trying to script with them then hopefully this has been informative for you and please don’t hesitate to comment on my observation!


One thought on “A MAXScript Perspective – Groups in 3ds Max”

  1. ‘a newly created group’s “head” node is always in the 2nd index (the 2nd slot) of the group’ – note that’s not how it works. It has to do with how the selection set is ordered and how upon selecting any node of the group, the rest gets selected too. So, when you select one node of the group in the viewport (which selects the rest of the group too), the group dummy will be second – so far so good. If you select multiple nodes (3 of them, for example), let’s say by rectangular selection, the group dummy will be the fourth item. If you select the group node itself, say using ‘select $Group001’, it will be the 1st one.

Leave a Reply

Your email address will not be published. Required fields are marked *