Notifications
Clear all

[Closed] Trying to associate a parent child link from excel data

I can’t get the parent child link to form. When it gets to the readdelimited string ” ” it craps out. Can anyone tell me why? Also I’m not sure if this ($.parent = $BoxParent) is the best way to call the parent file.
I’ve already got a set of points that are the names specified for Box Parent.

f = openfile “c:\NameSizePosTimeAssy.csv”
if (f != undefined) then
(
skiptonextline f
while not eof f do
(
sliderTime = 0
BoxName = readdelimitedstring f “,”
Xsize = readValue f
Ysize = readValue f
Zsize = readValue f
Xpos1 = readValue f
Ypos1 = readValue f
Zpos1 = readValue f
Time = readValue f
DelXpos = readValue f
DelYpos = readValue f
DelZpos = readValue f
BoxParent = readdelimitedstring f ” “
Box length:Xsize width:Ysize height:Zsize mapcoords:on pos:[Xpos1,Ypos1,Zpos1] isSelected:on name:BoxName
$.parent = $BoxParent
move $ [DelXpos,DelYpos,DelZpos]
)

3 Replies

here…

BoxParent = readdelimitedstring f " "
...you read a string.  Say "myObject", into variable BoxParent

Then here...

$.parent = $BoxParent


...you're trying to turn that variable into a path literal.

No can do :)

If you have an object in the scene named "myObject", you would use something like..

BoxParent = getNodeByName (readdelimitedstring f ” “)


..to turn that name string into an actual node being referenced.

Sorry man, I’m completely lost. What’s a node? And how do I reference it once I have the variable BoxParent? I’m super new and trying to learn from the help and macro listender so a lot of this is over my head.

 JHN

A node is a term used in a lot of 3d packages and most times represent an object in the scene. Node in terms of 3d software usually means datastructure, which a 3d object definitely, but not exclusively, is. In maya I think a node is better used, as it can also represent an material or some other type of datastructure.

The use of the word node in max is very inconsistent at best.
If getNodeByName was called getMaxObjectByName you would probably understand it better. It takes a string variable as input and returns a reference to the scene object. Which you can use to manipulate that particular object. It like “select by name”.

Chew on this:


box name:"testBox"
b = getNodeByName "testBox"
b.name
b.width = 20

As you can see the variable b now holds a reference to the box given by the getNodeByName function. With variable b, you can manipulate the box. Or variable b points to a spot in your system memory where the datastructure of that box “lives” and lets you alter/edit properties of that datastructure.

-Johan