Justin to the rescue again! Thanks so much man!

On Tue, Nov 22, 2016 at 12:44 PM, Justin Israel <[email protected]>
wrote:

>
>
> On Wed, Nov 23, 2016 at 8:59 AM I73 <[email protected]> wrote:
>
>> Hey I am trying to create a method to handle creating new objects, with a
>> dictionary
>>
>> class GenerationProperties():
>>     primitives = {
>>         'sphere' : cmds.polySphere,
>>         'geosphere' : cmds.polyPrimitive,
>>         'cube' : cmds.polyCube,
>>         'cylinder' : cmds.polyCylinder,
>>         'cone' : cmds.polyCone,
>>         'plane' : cmds.polyPlane,
>>         'torus' : cmds.polyTorus,
>>         'prism' : cmds.polyPrism,
>>         'pyramid' : cmds.polyPyramid,
>>         'pipe' : cmds.polyPipe,
>>     }
>>
>>
>>     def CreatePrimitive(self, primitiveType, subdivisionsX = 1,
>> subdivisionsY = 1):
>>         prim = self.primitives[primitiveType]()
>>         #how can I refrence prim to change it's subdivisions after I
>> created?
>>         # cmds.'Type?'(prim, subdivisionsX, subdivisionsY)
>>
>>
>>
>> The problem that I am having is I don't know how I can use
>> cmds.poly'Type'() as a generic (cast) to change the subdivisions or edit
>> after I create the primitive.
>>
>>
>> Any help would be appreciated!
>>
>
> I could see two different ways. Since you already have the proper command
> mapped, you can just use it in edit mode:
>
> fn = self.primitives[primitiveType]
> xform, shape = fn()
> fn(shape, e=True, sx=30)
>
> ​
>
> or
>
> prim = self.primitives[primitiveType]
> cmds.setAttr("%s.subdivisionHeight" % prim[1], 30)
>
> ​
>
> Justin
>
>
>> --
>> 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/331d4f46-5bb2-45dd-9b9d-
>> bde6b7caff91%40googlegroups.com
>> <https://groups.google.com/d/msgid/python_inside_maya/331d4f46-5bb2-45dd-9b9d-bde6b7caff91%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 a topic in the
> Google Groups "Python Programming for Autodesk Maya" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/python_inside_maya/xkXvEPPRrzg/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/python_inside_maya/CAPGFgA0-txhFXCABd6-W2whij-
> cffCu5uTBGk5zST%3DsBHXQk5w%40mail.gmail.com
> <https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA0-txhFXCABd6-W2whij-cffCu5uTBGk5zST%3DsBHXQk5w%40mail.gmail.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/CAAD4CW6%3DiavvS89wGMCVV%3DGt0Fof02epvXcnBsKGOKc7M_Dixg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to