help trying to setAttr

28 views
Skip to first unread message

jettam

unread,
Sep 1, 2017, 10:39:35 PM9/1/17
to Python Programming for Autodesk Maya
Could someone help me with this. I am trying to setAttr Translation of insectGroup.  Looks like I am not plugging in the center varible correctly.
 

center = mc.xform(bodyA, q=True, t=True)    ###   Result is 0.0, 2.41, -2.6

insectGroup = mc.group(empty=True, name='Group_Insect_#')

mc.setAttr((insectGroup)+ '.translate', [center], type="double3")

Jayme Wilkinson

unread,
Sep 1, 2017, 10:50:41 PM9/1/17
to python_in...@googlegroups.com
The issue is that you are trying to pass a list cast into a list of 1 element in your setAttr command. Instead you should be passing series of 3 floats.

Instead of 
mc.setAttr((insectGroup)+ '.translate', [center], type="double3”)

Try
mc.setAttr((insectGroup)+ '.translate', center[0], center[1], center[2], type="double3")


--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/ea462c7c-29c5-487b-912d-cf90bb221c8d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

jettam

unread,
Sep 1, 2017, 11:57:00 PM9/1/17
to Python Programming for Autodesk Maya
Thank you. 


On Friday, September 1, 2017 at 7:50:41 PM UTC-7, Jayme wrote:
The issue is that you are trying to pass a list cast into a list of 1 element in your setAttr command. Instead you should be passing series of 3 floats.

Instead of 
mc.setAttr((insectGroup)+ '.translate', [center], type="double3”)

Try
mc.setAttr((insectGroup)+ '.translate', center[0], center[1], center[2], type="double3")
On Sep 1, 2017, at 10:39 PM, jettam <justin...@gmail.com> wrote:

Could someone help me with this. I am trying to setAttr Translation of insectGroup.  Looks like I am not plugging in the center varible correctly.
 

center = mc.xform(bodyA, q=True, t=True)    ###   Result is 0.0, 2.41, -2.6

insectGroup = mc.group(empty=True, name='Group_Insect_#')

mc.setAttr((insectGroup)+ '.translate', [center], type="double3")

--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+unsub...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages