[Closed] creating pathNames with variables
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!
Try to avoid execute() if at all possible.
The function you’re after is getNodeByName()
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
You are right, you don’t NEED them, but they will not cause any problems in the code…just been nit-pickey