PDA

View Full Version : creating pathNames with variables


gsusInAPixel
12-19-2007, 06: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

thanks!

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

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

The function you're after is getNodeByName()

MoonDoggie
12-19-2007, 07: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

RustyKnight
12-19-2007, 09: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 ;)

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

-Colin

CGTalk Moderation
12-19-2007, 09: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.