Thanks Geordie! Seems kind of obvious now. I do have cases where there could be multiple shape nodes, (and just found out .getShape() only returns the first shape) so I'll just expand my list.
node = pm.circle()[0] curves = node.getChildren(type='nurbsCurve') newCurves = pm.duplicate(*curves, addShape=True) Cheers! -Mikkel. ________________________________ From: [email protected] <[email protected]> on behalf of Geordie Martinez <[email protected]> Sent: Thursday, February 06, 2014 7:24 PM To: python_inside_maya Subject: Re: [Maya-Python] pymel duplicate shape try this. you were passing a list which is what getChildren gives you. in this case you're getting the shape node (not a list). Hope this helps! import pymel.core as pm node = pm.circle()[0] curves = node.getShape() newCurves = pm.duplicate(curves, addShape=True) On Thu, Feb 6, 2014 at 10:45 AM, Mikkel Caiafa <[email protected]<mailto:[email protected]>> wrote: Hello all, I noticed this in the pymel docs for the duplicate command: Modifications: * new option: addShape If addShape evaluates to True, then all arguments fed in must be shapes, and each will be duplicated and added under the existing parent transform, instead of duplicating the parent transform. The following arguments are incompatible with addShape, and will raise a ValueError if enabled along with addShape: renameChildren (rc), instanceLeaf (ilf), parentOnly (po), smartTransform (st) Decided to try it out but I'm getting an error. Any ideas what I'm doing wrong? node = pm.circle()[0] curves = node.getChildren(type='nurbsCurve') newCurves = pm.duplicate(curves, addShape=True) # Error: Maya Attribute does not exist: u"[nt.NurbsCurve(u'nurbsCircleShape1')]" # Traceback (most recent call last): # File "<maya console>", line 1, in <module> # File "C:\Program Files\Autodesk\Maya2014\Python\lib\site-packages\pymel\core\general.py", line 1265, in duplicate # for origShape in [PyNode(x) for x in args]: # File "C:\Program Files\Autodesk\Maya2014\Python\lib\site-packages\pymel\core\general.py", line 1787, in __new__ # raise _objectError( name ) # MayaAttributeError: Maya Attribute does not exist: u"[nt.NurbsCurve(u'nurbsCircleShape1')]" # Thanks! -Mikkel. -- 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 [email protected]<mailto:python_inside_maya%[email protected]>. To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/bc286db7ae354cf2a6cfa4c54f7840ac%40CO1PR05MB362.namprd05.prod.outlook.com. For more options, visit https://groups.google.com/groups/opt_out. -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CABPXW4gux__rAnGa3VwxDn3h4_aST31v9%3DS6e5JPVwC%2BRmB2AA%40mail.gmail.com. For more options, visit https://groups.google.com/groups/opt_out. -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/e384db6acf7d419a8d62aeb1bc2dae75%40CO1PR05MB362.namprd05.prod.outlook.com. For more options, visit https://groups.google.com/groups/opt_out.
