there is a tool convert mel to python? unbelievable ah!but there is also error with the last code
> # Error: setAttr: Error reading data element number 3: 23 > > # Traceback (most recent call last): > > # File "<maya console>", line 30, in <module> > > # File > "/Applications/Autodesk/maya2012/Maya.app/Contents/Frameworks/Python.framework/Versions/Current/lib/python2.6/site-packages/pymel-1.0.0-py2.6.egg/pymel/core/general.py", > line 569, in setAttr > > # cmds.setAttr( attr, *args, **kwargs) > > # File > "/Applications/Autodesk/maya2012/Maya.app/Contents/Frameworks/Python.framework/Versions/Current/lib/python2.6/site-packages/pymel-1.0.0-py2.6.egg/pymel/internal/pmcmds.py", > line 134, in wrappedCmd > > # res = new_cmd(*new_args, **new_kwargs) > > # RuntimeError: setAttr: Error reading data element number 3: 23 # > 2011/7/19 Ted Charlton <[email protected]> > Using ancient 2008 maya... > > > On Mon, Jul 18, 2011 at 10:37 PM, Ted Charlton <[email protected]>wrote: > >> mel2py does this: >> -- >> # script created by pymel.tools.mel2py from mel file: >> # d:\usr\maya\projects\r\scenes\delete.mel >> >> from pymel.all import * >> createNode('transform',name="camera1") >> createNode('snapshotShape',name="snapshotShape1",parent="camera1") >> setAttr(".visibility", >> keyable=False) >> setAttr(".points",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, >> type="pointArray") >> setAttr(".frames",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, >> type="Int32Array") >> -- >> But errors exist result in both setAttr commands: >> >> setAttr(".points",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, >> type="pointArray") >> # Error: Error reading data element number 3: 0 >> # Traceback (most recent call last): >> # File "<maya console>", line 11, in <module> >> # File "C:\Program >> Files\Autodesk\Maya2008\Python\lib\site-packages\pymel-1.0.0-py2.5.egg\pymel\core\general.py", >> line 549, in setAttr >> # cmds.setAttr( attr, *args, **kwargs) >> # File "C:\Program >> Files\Autodesk\Maya2008\Python\lib\site-packages\pymel-1.0.0-py2.5.egg\pymel\internal\pmcmds.py", >> line 98, in wrappedCmd >> # res = new_cmd(*new_args, **new_kwargs) >> # RuntimeError: Error reading data element number 3: 0 # >> >> setAttr(".frames",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, >> type="Int32Array") >> # Error: line 0: Too much data was provided. The last 21 elements were not >> used. >> # Traceback (most recent call last): >> # File "<maya console>", line 4, in <module> >> # File "C:\Program >> Files\Autodesk\Maya2008\Python\lib\site-packages\pymel-1.0.0-py2.5.egg\pymel\core\general.py", >> line 549, in setAttr >> # cmds.setAttr( attr, *args, **kwargs) >> # File "C:\Program >> Files\Autodesk\Maya2008\Python\lib\site-packages\pymel-1.0.0-py2.5.egg\pymel\internal\pmcmds.py", >> line 98, in wrappedCmd >> # res = new_cmd(*new_args, **new_kwargs) >> # RuntimeError: Too much data was provided. The last 21 elements were not >> used. # >> -- >> >> Maya doesn't complain over this despite the pymel auto generated code >> looks more sensible. >> -- >> >> from pymel.all import * >> createNode('transform',name="camera1") >> createNode('snapshotShape',name="snapshotShape1",parent="camera1") >> setAttr(".visibility", >> keyable=False) >> setAttr(".points", 24,(-1,0,0,1), >> 23,(-0.77777776911098417,0,0,1), >> 22,(-0.55555555465617112,0,0,1), >> 21,(-0.3333332980120608,0,0,1), >> 20,(-0.11111111936909379,0,0,1), >> 19,(0.11111113923730942,0,0,1), >> 18,(0.33333331788027643,0,0,1), >> 17,(0.55555565399724882,0,0,1), >> 16,(0.77777782871562984,0,0,1), >> 15,(1,0,0,1), >> 14,(1,0,0,1), >> 13,(1,0,0,1), >> 12,(1,0,0,1), >> 11,(1,0,0,1), >> 10,(1,0,0,1), >> 9,(1,0,0,1), >> 8,(1,0,0,1), >> 7,(1,0,0,1), >> 6,(1,0,0,1), >> 5,(1,0,0,1), >> 4,(1,0,0,1), >> 3,(1,0,0,1), >> 2,(1,0,0,1), >> 1,(1,0,0,1), >> type="pointArray") >> setAttr(".frames",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), >> type="Int32Array") >> >> >> >> On Mon, Jul 18, 2011 at 6:53 AM, 宇 <[email protected]> wrote: >> >>> I just want to know how to set the attribute of the node,please help! >>> >>> On Jul 18, 9:51 pm, 宇 <[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 >>> >> >> > -- > view archives: http://groups.google.com/group/python_inside_maya > change your subscription settings: > http://groups.google.com/group/python_inside_maya/subscribe > -- http://thatboy.me -- view archives: http://groups.google.com/group/python_inside_maya change your subscription settings: http://groups.google.com/group/python_inside_maya/subscribe
