Query created Object ?

84 views
Skip to first unread message

Christopher.

unread,
May 18, 2016, 9:09:00 PM5/18/16
to Python Programming for Autodesk Maya
How do you query something that was created, simply such as this;

rad = maya.cmds.polyCube (width=2.0, height=4.0);


Justin Israel

unread,
May 18, 2016, 9:16:48 PM5/18/16
to python_in...@googlegroups.com
On Thu, May 19, 2016 at 1:09 PM Christopher. <crestchr...@gmail.com> wrote:
How do you query something that was created, simply such as this;

rad = maya.cmds.polyCube (width=2.0, height=4.0);



The return value from that command is a list:
[<TransformName>, <ShapeName>] 

So you might have gotten back something like:
[u'pCube1', u'polyCube1']

You can use the transform, the shape, or the list as the input to the polyCube command, in query mode:

cmds.polyCube(rad, q=True, height=True)
# 4.0


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 python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/18340d09-5368-4549-b423-afbedbe3ae32%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Christopher.

unread,
May 18, 2016, 10:21:27 PM5/18/16
to Python Programming for Autodesk Maya
Ah, so my original method wasn't too far off, good to know :) Thanks. 

All my other python issues in the past got resolved as well recently.  


On Wednesday, May 18, 2016 at 9:16:48 PM UTC-4, Justin Israel wrote:
On Thu, May 19, 2016 at 1:09 PM Christopher. <crestchr...@gmail.com> wrote:
How do you query something that was created, simply such as this;

rad = maya.cmds.polyCube (width=2.0, height=4.0);



The return value from that command is a list:
[<TransformName>, <ShapeName>] 

So you might have gotten back something like:
[u'pCube1', u'polyCube1']

You can use the transform, the shape, or the list as the input to the polyCube command, in query mode:

cmds.polyCube(rad, q=True, height=True)
# 4.0


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 python_inside_maya+unsub...@googlegroups.com.

Justin Israel

unread,
May 18, 2016, 10:45:26 PM5/18/16
to Python Programming for Autodesk Maya
Awesome! Glad you got it working!

On Thu, May 19, 2016 at 2:21 PM Christopher. <crestchr...@gmail.com> wrote:
Ah, so my original method wasn't too far off, good to know :) Thanks. 

All my other python issues in the past got resolved as well recently.  

On Wednesday, May 18, 2016 at 9:16:48 PM UTC-4, Justin Israel wrote:
On Thu, May 19, 2016 at 1:09 PM Christopher. <crestchr...@gmail.com> wrote:
How do you query something that was created, simply such as this;

rad = maya.cmds.polyCube (width=2.0, height=4.0);



The return value from that command is a list:
[<TransformName>, <ShapeName>] 

So you might have gotten back something like:
[u'pCube1', u'polyCube1']

You can use the transform, the shape, or the list as the input to the polyCube command, in query mode:

cmds.polyCube(rad, q=True, height=True)
# 4.0


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 python_inside_m...@googlegroups.com.

--
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 python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/5e7a0959-0c95-4e2e-9545-68edaa05b0f5%40googlegroups.com.

Crest Christopher

unread,
May 18, 2016, 11:00:56 PM5/18/16
to python_in...@googlegroups.com
I'm more glad then you are.

Justin Israel wrote:

Awesome! Glad you got it working!

On Thu, May 19, 2016 at 2:21 PM Christopher.
<crestchr...@gmail.com <mailto:crestchr...@gmail.com>> wrote:

    Ah, so my original method wasn't too far off, good to know :) Thanks.

    All my other python issues in the past got resolved as well recently.

    On Wednesday, May 18, 2016 at 9:16:48 PM UTC-4, Justin Israel wrote:



        On Thu, May 19, 2016 at 1:09 PM Christopher.
        <crestchr...@gmail.com> wrote:

            How do you query something that was created, simply such
 &nb sp;          as this;

            ||
            rad =maya.cmds.polyCube (width=2.0,height=4.0);




        The return value from that command is a list:
        [<TransformName>, <ShapeName>]

        So you might have gotten back something like:
        [u'pCube1', u'polyCube1']

        You can use the transform, the shape, or the list as the input
        to the polyCube command, in query mode:

        cmds.polyCube(rad, q=True, height=True)
        # 4.0


        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
            python_inside_m...@googlegroups.com.
            To view this discussion on the web visit

            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 python_inside_m...@googlegroups.com

    To view this discussion on the web visit

    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/7Z3uvv0fCU0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
python_inside_m...@googlegroups.com
<mailto:python_inside_m...@googlegroups.com>.

To view this discussion on the web visit
Reply all
Reply to author
Forward
0 new messages