Hi All,

Thanks a lot for replies. You saved my time so much for typing.

pCon = PyNode(parentConstraint(cube1, cube2, cube3, mo=1, w=1))
w1 =pCon.getWeightAliasList()[0]

As shown above, and as said by John Patrick, above command is done in one
line and it serves my purpose.
Now I can get drop down menu for '.getWeightAliasList' in ecplise editor for
Maya.

::==)) Subbu


On Wed, Apr 20, 2011 at 8:16 PM, John Patrick <[email protected]> wrote:

> Personally, I feel like I wouldn't be served well by having the PyNode
> class constructor handle node creation.  After all, it's the command's job
> to create the node and hook it into the DG.  I think, if anything, there
> maybe could be a class method that does a createNode() and returns a PyNode
> instance of that node...but even then, it's pretty easy to do
> pm.PyNode(pm.createNode('transform'))
>
> That being said, maybe there's a situation where using the PyNode
> constructor like a command would be convenient, I just haven't run into one
> :)
> -JP
>
> On Wed, Apr 20, 2011 at 7:33 AM, Paul Molodowitch <[email protected]>wrote:
>
>> Oops... correction below:
>>
>> On Wed, Apr 20, 2011 at 7:28 AM, Paul Molodowitch <[email protected]>wrote:
>>
>>> Hi Subbu -
>>> Unfortunately, the PyNode classes (such as pm.nt.ParentConstraint) do not
>>> contain all of the functionality of the corresponding commands (ie,
>>> pm.parentConstraint or cmds.parentConstraint).  In particular, the initial
>>> creation of the underlying MAYA node must often be done with the command
>>> form.  In fact, the only way it is currently possible to trigger the
>>> creation of the underlying maya node AND the pynode with the pynode
>>> constructor is when the PyNode constructor is fed no non-keyword args  (such
>>> as when you do nt.ParentConstraint(mo=1, w=1) ).  If you need to create
>>> the underlying node in manner in which you feed in other node args, you'll
>>> have to fall back on the command:
>>>
>>> import pymel.core as pm
>>> cube1 = pm.polyCube()[0]
>>> cube2 = pm.polyCube()[0]
>>> pCon = pm.parentConstraint(cube1, cube2, mo=1, w=1)
>>>
>>> In general, my habit is often to use the commands to create, and the
>>> PyNode class constructors to create PyNodes for already-existing maya nodes.
>>>  I agree, though, that it would be nice to expand support for node creation
>>> in
>>>
>>
>> PyNode class constructors to be able to handle these situations as well.
>>
>>
>>
>>> - Paul
>>>
>>> PS - Did you know it's also possible to do the selection of multiple
>>> objects in a single step? ie,
>>> select ('pCube1', 'pCube2')
>>>
>>> On Wed, Apr 20, 2011 at 2:12 AM, Subbu <[email protected]> wrote:
>>>
>>>> Hi,
>>>>
>>>> When am trying in Python, Its working as below:
>>>> import maya.cmds as cmds
>>>> pCon =cmds.parentConstraint('pCube1', 'pCube2', mo=1, w=1)
>>>>
>>>>
>>>> but in PyMel, Both the following are not working
>>>>
>>>> import pymel.core.nodetypes as nt
>>>> pCon =nt.ParentConstraint('pCube1', 'pCube2', mo=1, w=1)
>>>> or
>>>> pCon =nt.ParentConstraint( PyNode('pCube1'), PyNode('pCube2'), mo=1,
>>>> w=1)
>>>>
>>>> "Error: Unable to determine pymel type for 'pCube1' " is coming
>>>>
>>>>
>>>> In single line it is not possible in PyMel, But its working in 3 lines
>>>> like this:
>>>> import pymel.core.nodetypes as nt
>>>> select ('pCube1', r=1)
>>>> select ('pCube2', add=1)
>>>> pCon =nt.ParentConstraint(mo=1, w=1)
>>>>
>>>> Any one has any idea, so that I can save 2 lines code in this case,
>>>> Constraints are repetitive in my code
>>>>
>>>> Thanks in advance.
>>>>
>>>> Subbu
>>>>
>>>> --
>>>> 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
>



-- 
Regards,
Subbu Addanki
http://subbuadd.blogspot.com/
http://www.vimeo.com/17439975

-- 
http://groups.google.com/group/python_inside_maya

Reply via email to