Oh and if you are wondering why when you print them, they both look like they might be the same, it is because the pymel nodes define __str__() and __repr__() methods: https://github.com/LumaPictures/pymel/blob/master/pymel/core/nodetypes.py#L235
You are just comparing the string conversion of the two different approaches. But one is actually a unicode object and the other is am instance PyNode subclass. On Sat, Sep 27, 2014 at 10:49 AM, Justin Israel <[email protected]> wrote: > The native Maya cmds module deals in terms of string paths as the > identifiers. pymel is an abstraction layer that creates a node object with > methods. > On 27/09/2014 10:44 AM, <[email protected]> wrote: > >> Hi there, >> >> can anyone tell me the difference between these two commands, one in >> pymel and the other in python. I thought they both just returned the >> Transform name of the object selected. But apparently not. >> >> if you create a poly sphere and run this >> >> ########################################### >> >> import maya.cmds as cmds >> import pymel.core as pm >> >> mesh=pm.selected()[0] >> print "mesh1: ", mesh >> >> mesh=(cmds.ls(selection=True)[0]) >> print "mesh2: ", mesh >> >> ############################################ >> >> they return the same name but can't be used interchangeably it seems, can >> anyone help? >> >> thanks, >> Sam >> >> -- >> 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/ef3776e8-0e39-414b-addf-e24dd649c636%40googlegroups.com >> . >> For more options, visit https://groups.google.com/d/optout. >> > -- 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/CAPGFgA1szwVcd5652sZ5Tag1EXhMZmACEJ_11xF1R0fCg%3D4HrA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
