Someone correct me if I'm wrong, but I believe all the the PyMel classes in
the nt namespace are derrived from a combination of their API MFn
counterparts and maya.cmds functions.
Like Seth mentioned, if you don't already have the node in your scene, the
pymel cmds will return instances of these classes like so:
[code]
import pymel.core as pm
>>>transform, shape = pm.sphere()
>>>tmp, rbs = pm.rebuildSurface(transform, ch=True)
>>>print type(rbs)
<class 'pymel.core.nodetypes.RebuildSurface'>
[/code]
So now 'rbs' points to a pm.nt.RebuildSurface instance. If you already have
a rebuildSurface node in your scene, you just need to know the name of it
and you can instantiate a RebuildSurface instance in a couple ways.
Sticking with the above example, lets say my surface is called
"rebuildSurface1":
Option1 (I like doing this in code if I know what type of node I need
because it will fail loudly if I give it something unexpected):
[code]
>>>rbs = pm.nt.RebuildSurface('rebuildSurface1')
>>>print type(rbs)
<class 'pymel.core.nodetypes.RebuildSurface'>
[/code]
Option2: (This is cool because it automatically figures out what type of
node you're giving it and returns the appropriate instance)
[code]
>>>rbs = pm.PyNode('rebuildSurface1')
>>>print type(rbs)
<class 'pymel.core.nodetypes.RebuildSurface'>
[/code]
So there ya go, that's how you get PyMel instances from nodes that already
exist. Hope that helps!
On Tue, Nov 23, 2010 at 8:45 PM, Seth Gibson <[email protected]> wrote:
> Probably want you want to do there is call the command and parse out the
> resulting nt.RebuildSurface from the returned values, ie:
>
> import pymel.core as pm
>
> mesh, rebuild = pm.rebuildSurface(pm.nurbsPlane())
>
> or i guess if you had something selected, just
>
> mesh, rebuild = pm.rebuildSurface()
>
>
> On Tue, Nov 23, 2010 at 5:13 PM, Count Zer0 <[email protected]> wrote:
>
>> Anybody know how to use a class like the RebuildSurface class:
>>
>>
>> http://www.luma-pictures.com/tools/pymel/docs/1.0/generated/classes/pymel.core.nodetypes/pymel.core.nodetypes.RebuildSurface.html
>>
>> How would you pass in the surface you wanted to run one of these
>> methods on? or does the object have to be selected?
>>
>> Thanks,
>>
>> -jason
>>
>> --
>> http://groups.google.com/group/python_inside_maya
>>
>
> --
> http://groups.google.com/group/python_inside_maya
>
--
John Patrick
404-242-2675
[email protected]
http://www.canyourigit.com
--
http://groups.google.com/group/python_inside_maya