View Full Version : creating pathNames with variables

12-19-2007, 07:22 PM
Is it possible to make a pathName by combining variables together like the example below?

tempStr = "placeHolder" ;
joint = "spine1" ;

select ($tempStr +joint ) ;-- this line won't work


12-19-2007, 07:33 PM
oops..:blush: better shut my mouth on this forum for a couple of years..

12-19-2007, 07:52 PM
Try to avoid execute() if at all possible.

The function you're after is getNodeByName()

12-19-2007, 08:29 PM
Yes but here is your problem

tempStr = "placeHolder" ;
joint = "spine1" ;

select ($tempStr +joint ) ;-- this line won't work

Firstly, you don't need semi-colons after each line in maxscript.

You are assigning the string "placeHolder" to the variable tempStr, and "spline1" to the variable spline. Then when selecting you are adding a $ to the beginning of tempStr, but what you are actually doing is telling maxscript to find the node with the name "tempStr" like

select $Box01

What you need to do is use GetNodeByName to get the node, then you can select it however you want.

tempStr = "placeHolder" -- stores the varialbes tempStr, and joint
joint = "spine1"

theObj = getNodeByName (tempStr + joint) -- uses GetNodeByName() to get the node with the name "placeHolderspine1", saves the node in variable "theObj"

select theObj -- selects the object

12-19-2007, 10:25 PM
Firstly, you don't need semi-colons after each line in maxscript.You are right, you don't NEED them, but they will not cause any problems in the code...just been nit-pickey ;)

12-19-2007, 10:55 PM
Bingo. Unnecessary/Undisturbing, but an extra keystroke ;)


CGTalk Moderation
12-19-2007, 10:55 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.