View Full Version : Help with translation to maxscript ... thanks

05 May 2008, 01:45 PM
Coud anybody translate this into maxscript please:
- Look at selection. Take hierarchy in account /parents first/. For every object in selection find pair in the scene. Pair's name start with "X_" after that it is the same. Then add orientation constraint to pair with original object as target and turn keep initial offset on.

MyarrayA = selection as array
MyarrayB = # ("X_" MyarrayA)
for i in MyarrayB do
$.pos.controller = position_list ()
posCtrl = Position_Constraint()
$.pos.controller.Available.controller = posCtrl
posConstraintInterface = posCtrl.constraints
posConstraintInterface.appendTarget $i - "X_" 50.0 keepoffset:true

As U can see I do not know how to handle names in scripting. And hierarchy. Also I am looking for how to say "you" in maxscript /objectA shoud be controlled with script which looks for something in parent of objectA and woud like to copy or instance this script controller so it shoud not be name dependent./

I am thankfull for any kind of help. But I woud like to understand it someday. Thanks.

05 May 2008, 12:23 PM
Not sure this is what you are after but this sort of does what you want:

MyarrayA = selection as array
MyarrayB = #()

for n = 1 to MyarrayA.count do
MyarrayB[MyarrayB.count+1] = ("X_" + MyarrayA[n].name)
Obj = getNodebyname MyarrayB[n]
obj.pos.controller = position_list ()
posCtrl = Position_Constraint()
obj.pos.controller.Available.controller = posCtrl
posConstraintInterface = posCtrl.constraints
posConstraintInterface.appendTarget MyarrayA[n] 50.0

05 May 2008, 04:35 PM
Thank U very much I try this :).

CGTalk Moderation
05 May 2008, 04:35 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.