its not that hard,
you can find it all in the python command refference (help function
wihtin maya)
for example to st the translate to 10 on a new created polycube:
import maya.cmds as cmds
node = cmds.polyCube()[0]
cmds.setAttr((node + '.translateX'), 10 )
the [0] behind the polycube command is there because it gives back a
list of which you want the first object
the special types can also be found under the python refference:
Mel Example setAttr node.int32ArrayAttr -type Int32Array 2 12 75;
Python Example cmds.setAttr('node.int32ArrayAttr',
[2,12,75],type='Int32Array')
Mel Example setAttr node.pointArrayAttr -type pointArray 2 1 1 1 1 2
2 2 1;
Python Example cmds.setAttr('node.pointArrayAttr',2,(1,1,1,1),
(2,2,2,1),type='pointArray')
next time first try to search through the help files and command
refference
cheers
On 18 jul, 09:51, 宇 <[email protected]> wrote:
> Is there anybody know how to change this mel code to python or pymel,
> i need help!
>
> createNode transform -n "snapshot1";
> createNode snapshotShape -n "snapshotShape1" -p "camera1";
> setAttr -k off ".v";
> setAttr ".pts" -type "pointArray" 24 -1 0 0 1 -0.77777776911098417 0
> 0 1 -0.55555555465617112
> 0 0 1 -0.3333332980120608 0 0 1 -0.11111111936909379 0 0 1
> 0.11111113923730942 0
> 0 1 0.33333331788027643 0 0 1 0.55555565399724882 0 0 1
> 0.77777782871562984 0 0 1 1
> 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0
> 1 1 0 0
> 1 1 0 0 1 1 0
> 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 ;
> setAttr ".f" -type "Int32Array" 24 250 500 750 1000 1250 1500
> 1750 2000 2250 2500 2750 3000 3250 3500 3750 4000 4250 4500
> 4750 5000 5250 5500 5750 6000 ;
--
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings:
http://groups.google.com/group/python_inside_maya/subscribe