Thanks Justin! for the reply, that help me alot. Saludos!

On Saturday, April 16, 2016 at 7:06:16 PM UTC-5, Justin Israel wrote:
>
> Hi
>
> Everything looks fine except for how you call your class 
>
> legControl = Control.create_me('L_leg1_control', 'box', 2)
>
> create_me() is called a "method". It is bound to an instance of your 
> class, which means you need to first make an instance of your Control. 
>
> legControl = Control('L_leg1_control', 'box', 2) 
>
> Now you have constructed an instance, with your params that were passed to 
> your __init__() 
>
> You can call create_me() to perform that extra set up. 
>
> legControl.create_me()
>
> Note that your create_me method does not return anything. It only performs 
> actions on your instance. 
>
> Justin 
>
> On Sun, 17 Apr 2016 9:45 AM Felix <[email protected] <javascript:>> 
> wrote:
>
>> Hi to everyone! I am starting with Class a few days, and there are many 
>> examples on the internet, but not practical examples (Maya), so this is my 
>> first class and of course I don't know what is wrong. I hope someone can 
>> give me a hand. Greetings!
>>
>> import maya.cmds as cmds
>> import maya.mel as mel
>>
>> class Control(object):
>> def __init__(self, name, shape, size):
>> self.name = name
>> self.shape = shape
>> self.size = size
>>
>> def create_me(self):
>> if self.shape == 'box':
>> mel.eval( 'curve -d 1 -p -0.5 0.5 0.5 -p 0.5 0.5 0.5;' )
>> if self.shape == 'circle':
>> cmds.circle( radius=1 )
>> if self.shape == 'square':
>> mel.eval( 'curve -d 1 -p -0.5 0 -0.5 -p 0.5 0 -0.5 -p 0.5 0 0.5 -p -0.5 0 
>> 0.5 -p -0.5 0 -0.5' )
>>
>> cmds.scale( self.size, self.size, self.size )
>> cmds.makeIdentity( apply=True, t=0, r=0, s=1 )
>> cmds.rename( self.name )
>> cmds.select( clear=True )
>>
>>
>> legControl = Control.create_me('L_leg1_control', 'box', 2)
>>
>> -- 
>> 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] <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/python_inside_maya/b6eddbbc-8d18-415e-85c7-b3d15c423c14%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/python_inside_maya/b6eddbbc-8d18-415e-85c7-b3d15c423c14%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> 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/3e70581a-d90c-473f-8099-326c73ae4a3e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to