Selecting Node + Children in Script

I am having problems understanding some (seemingly) simple MAXScript techniques. I'm still fairly new to MAXScript.

If I type into the listener:

 select $/...*

The node and all of its children are selected. However, inside my scripts, I am selecting not with the $.

This works to select the object:

select myStruct.target

But the following is NOT working and is causing the script to fail to run at all:

select myStruct.target/...*

I'm obviously missing something.

I tried the following but it simply selects everything in the scene:

select myStruct.target

 select $/...*

Thanks in advance for all input.

Comments

Comment viewing options

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

each rule has exception

Yes, you are fully right to avoid execute(), i run from it as from plague, but each rule has exception. You can wrote recursive funcion to collect the hierarchy calling children array, but it will works more slow in complex hierarchy than execute.

my recent MAXScripts RSS (archive here)

lightcube's picture

Thank you... that is the same

Thank you Anubis... that is the same solution Steve Curley gave over in the Autodesk Area MAXScript forums. It surprised me since I have always learned to avoid using the execute() equivalent in other languages. I expected there to be a better solution...

Thanks, though.

_______________________

Shawn Olson

Developer of Wall Worm

Anubis's picture

Pathname Literals not work

Pathname Literals not work with ref. vars, i.e.

select $Dummy001...* -- this would work
obj = $Dummy001 ; select obj...* -- this Not
 
-- possible workaround...
cmd = "select $" + myStruct.target.name + "...*"
 
execute cmd -- or...
readExpr (cmd as stringStream)

(hope this help)

my recent MAXScripts RSS (archive here)

Comment viewing options

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