i show my code, and you can find differentiation.
i think you should not set name when you create object(locator)
import pymel.core as pmfor x in range(10):
grp = pm.group(em=True)
t = pm.polySphere(n='test', ch=False)[0]
t.setParent(grp)
for x in range(10):
grp = pm.group(em=True)
loc = pm.spaceLocator()
loc.rename('test')
Good luck.
On Thu, Mar 5, 2015 at 8:12 PM, johan Borgström <[email protected]> wrote:
> I am using PyMel to create some locators in a scene. I give the locator a
> name at creation and parent the locator to a group. The second iteration of
> the script I get a MayaNodeError (Maya Node does not exist (or is not
> unique)).
>
> This behaviour seems a little bit weird to me. If I do the same but
> instead create a polyCube it works as expected. I could use various
> workarounds, for instance parent and then rename, which works fine...
>
> This is some sample code to reproduce the error:
> # polyCube, works fine
> for x in range(10):
> grp = pm.group(em=True)
> t = pm.polySphere(n='test', ch=False)[0]
> pm.parent(t, grp)
>
>
> # Error: MayaNodeError: Maya Node does not exist (or is not unique)::
> u'test'
> for x in range(10):
> grp = pm.group(em=True)
> t = pm.spaceLocator(n='test')
> pm.parent(t, grp)
>
>
> # workaround
> for x in range(10):
> grp = pm.group(em=True)
> t = pm.spaceLocator()
> pm.parent(t, grp)
> t.rename('test')
>
>
> Does anyone have an idea why this does not work?
>
> Best Regards,
> Johan
>
> --
> 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/777f2425-3929-4364-a42e-594e1bb9bf94%40googlegroups.com
> <https://groups.google.com/d/msgid/python_inside_maya/777f2425-3929-4364-a42e-594e1bb9bf94%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
--
Bests,
madoodia
--
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/CADvbQw%2BoyGELxamxEyGO34Qy0fJkbU1zSqGGk4k6FaoNk8%3DvRA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.