PyMel: properly use doc and help()

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
Old 07 July 2013   #1
PyMel: properly use doc and help()

Hey everyone,

I've been trying to properly use the pymel documentation and the help() within Maya.

For example, when I use Liam Cooke's see module on something like PyNode:

Code:
import pymel.core as pm pm.sphere(n='mySphere') myPn = pm.PyNode('mySphere') see(myPn)


I can see .setParent() on the returned list. How do I find specific documentation on how to use .setParent()?

Code:
help(myPn.setParent)

Code:
Help on method setParent in module pymel.core.nodetypes: setParent(self, *args, **kwargs) method of pymel.core.nodetypes.Transform instance parent Modifications: if parent is 'None', world=True is automatically set


I can't find any mention of setParent() in search results for pymel.core.nodetypes.Transform
http://download.autodesk.com/global...yMel/index.html

Most of the time I just use google to find specific examples on the topic, but I'd like be able to use the documentation properly...

TIA
__________________

gibby3d.com

Last edited by jgibz : 07 July 2013 at 05:14 PM.
 
Old 07 July 2013   #2
It's a method in the base class DagNode:

http://download.autodesk.com/us/may...t ypes.DagNode
 
Old 07 July 2013   #3
Thanks for the reply, zoharl. I was a bit confused about:
Code:
method of pymel.core.nodetypes.Transform


Now that I can see how simple the method is, I realize help() was returning proper instuctions...

Thanks
__________________

gibby3d.com
 
Old 07 July 2013   #4
Maybe you find the following useful. It lists the methods according to their base class:

Code:
import inspect def dir2(obj): bases = inspect.getmro(type(obj)) for i in xrange(len(bases)): print bases[i] if i < len(bases)-1: print list(set(dir(bases[i])).difference(set(dir(bases[i+1])))) else: print dir(bases[i])


Code:
dir2(myPn)


And if you prefer, I'm sure you can modify this to use the see() module.
 
Old 07 July 2013   #5
Code:
import inspect def dir2(obj): bases = inspect.getmro(type(obj)) for i in xrange(len(bases)): print bases[i] if i < len(bases)-1: print list(set(dir(bases[i])).difference(set(dir(bases[i+1])))) else: print dir(bases[i])



Wow, that's really helpful. Thanks again.
__________________

gibby3d.com
 
Old 07 July 2013   #6
Or this...

Code:
import inspect def dir2(obj, method): bases = inspect.getmro(type(obj)) for i in xrange(len(bases)): print bases[i] if i < len(bases)-1: for j in list(set(dir(bases[i])).difference(set(dir(bases[i+1])))): if j is method: print j else: print dir(bases[i]) dir2(myPn, 'setParent')
__________________

gibby3d.com
 
Old 07 July 2013   #7
Thread automatically closed

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
 
Thread Closed share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 07:13 PM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.