Notifications
Clear all
[Closed] align A to center of B
Nov 13, 2013 11:49 pm
how to align box to my objName(object). I need to preserve rotation and position – I have to align object A exactly on center of Object B.
4 Replies
Nov 13, 2013 11:49 pm
If you have not reseted the transform matrix of the objects, this should work:
$ObjectA.center = $ObjectB.center
Nov 13, 2013 11:49 pm
it’s fine but my programming skill is very low:(
in my code one obejct is variable. It should look like this:
objNamee = selection[1].name
$Torus001.center = objNamee.center
but won’t work. What I do wrong?
1 Reply
As Kostadin said, you are accessing the name property of the object rather than the object itself.
So in your code it tries to align an object with a string (the name of the other object).
Try one of these:
objA = selection[1]
$Torus001.center = objA.center
or
$Torus001.center = selection[1].center
Nov 13, 2013 11:49 pm
objNamee = selection[1]
$Torus001.center = objNamee.center
selection[1].name will gives you the name of the selected object, not the object.