Awesome, thanks!

Out of curiosity - how did you figure that out? Is there some
reference I'm unaware of? Or some awesome python introspection
ability? Or just some good intuition? (In retrospect, it makes sense
to have the variable-length items passed as lists...)

- Paul

On Fri, May 15, 2009 at 3:15 PM, John Creson <johncre...@gmail.com> wrote:
> ###########################
> import maya.cmds as cmds
> cmds.createNode('nurbsCurve',n="myNurbsCurveShape")
> cmds.setAttr('myNurbsCurveShape.cc',3,1,0,
>        False,3,
>        (0,0,0,1,1,1),6,
>     4,(-2,3,0),(),(2,1,0),(),(2,-3,0),(),(-2,-1,0),(),
>         type='nurbsCurve')
>
>
> #############################
>
> In the above example the 6 could also be () and the curve still seems to
> build as expected.
> I think the list knows how long it is...
> I think the () after every CV may be a place holder for possible W values
> when making rational curves.
> (CV positions in x,y,z (and w if rational) )
>
> On Wed, May 13, 2009 at 1:59 PM, barnabas79 <elron...@gmail.com> wrote:
>>
>> Hey - I was wondering if anyone here has tried to set a 'nurbsCurve'
>> attribute using setAttr (or, really, any of the shape attribute types
>> - I assume the syntax will be similar between them).
>>
>> Ie, the docs have this example for mel:
>>
>> createNode nurbsCurve -n "myNurbsCurveShape";
>> setAttr myNurbsCurveShape.cc -type nurbsCurve 3 1 0 no 3
>> 6 0 0 0 1 1 1
>> 4 -2 3 0 -2 1 0 -2 -1 0 -2 -3 0;
>>
>> I would think that the python conversion would be:
>>
>> import maya.cmds as cmds
>> cmds.createNode('nurbsCurve',n="myNurbsCurveShape")
>> cmds.setAttr('myNurbsCurveShape.cc',3,1,0,
>>        False,
>>        3,6,0,0,0,1,1,
>>        1,4,-2,3,0,-2,1,0,-2,-1,0,-2,-3,0,
>>        type='nurbsCurve')
>>
>> but this results in:
>>
>> # RuntimeError: Error reading data element number 7: 0
>>
>> These don't work either:
>>
>> import maya.cmds as cmds
>> cmds.createNode('nurbsCurve',n="myNurbsCurveShape")
>> cmds.setAttr('myNurbsCurveShape.cc', """3 1 0 no 3
>> 6 0 0 0 1 1 1
>> 4 -2 3 0 -2 1 0 -2 -1 0 -2 -3 0""",
>>        type='nurbsCurve')
>>
>>
>> import maya.cmds as cmds
>> cmds.createNode('nurbsCurve',n="myNurbsCurveShape")
>> cmds.setAttr('myNurbsCurveShape.cc', (3,1,0,
>>        False,
>>        3,6,0,0,0,1,1,
>>        1,4,-2,3,0,-2,1,0,-2,-1,0,-2,-3,0),
>>        type='nurbsCurve')
>>
>>
>> import maya.cmds as cmds
>> cmds.createNode('nurbsCurve',n="myNurbsCurveShape")
>> cmds.setAttr('myNurbsCurveShape.cc', [3,1,0,
>>        False,
>>        3,6,0,0,0,1,1,
>>        1,4,-2,3,0,-2,1,0,-2,-1,0,-2,-3,0],
>>        type='nurbsCurve')
>>
>> ...any ideas on how to get this to work in python?
>>
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
http://groups.google.com/group/python_inside_maya
-~----------~----~----~----~------~----~------~--~---

Reply via email to