Creating Polygons and Curves between Locators

510 views
Skip to first unread message

Brian Powyszynski

unread,
Jul 17, 2014, 3:43:27 PM7/17/14
to python_in...@googlegroups.com
Hey everyone, this is my official, first post!


  Is there an easy way to get the location of, say, a Locator and store it in variable, then create a polygon primitive at that location?
  I am creating an stair script and I want to run a handrail from one Locator to another, I am probably going to create a curve between the two Locators, then I will create a small quad at one end or the other and extrude along curve.

  Creating the curves and polys is not a problem for me. Rather, I am having difficult storing/accessing the Locator position for this. 

  Should I use xform to get some of that info, or is there a better way to get the XYZ of a vertex/CV?

Thanks in advance!

Justin Israel

unread,
Jul 17, 2014, 6:01:15 PM7/17/14
to python_in...@googlegroups.com
Hey Brian,

Was the xform command not working for you? Sounds like it would give you the info that you need. Have you tried it, or are you just asking ahead of time about possible approaches? 


--
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/db1e9467-0870-4248-ac14-c129d182c29d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Brian Powyszynski

unread,
Jul 18, 2014, 12:05:27 AM7/18/14
to python_in...@googlegroups.com
Justin,

Probably the latter.

I tried the xform command, but I was just following a tutorial and the variable I tried to store it in returned None when I did a print.

It's altogether possible that I did not store/access the variable correctly or that print does not display what I want. I'm a longtime Maya user who is new to Python, but not new to programming, if that gives you any sense of where I am at with this.
 
I think pointPosition looks promising, but I have not tried it yet and I am not sure if it will work with a locator.

Any thoughts on which approach I should pursue?


--
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/zhDUNsTDvns/unsubscribe.
To unsubscribe from this group and all its topics, 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/CAPGFgA05jSqqfqKm0P%2Bn-WYYq-0d9nAzBBK60X8dYpRySe8JEQ%40mail.gmail.com.

For more options, visit https://groups.google.com/d/optout.



--
Brian Powyszynski       
(469) 258-9826                  
brianpow.com

Justin Israel

unread,
Jul 18, 2014, 12:13:36 AM7/18/14
to python_in...@googlegroups.com
These two calls return the same results, which is a list of x,y,z floats:

cmds.xform("locator1", q=True, worldSpace=True, t=True)
cmds.pointPosition("locator1", world=True)

Are you sure you called xform with the query=True flag? Otherwise it wouldn't return anything (or actually returns None). 


Brian Powyszynski

unread,
Jul 22, 2014, 3:19:56 PM7/22/14
to python_in...@googlegroups.com
So sorry for the late reply!

I used xform as you listed above, and it still did not work when trying to access the variable normally. 

However, I used pointPosition as you listed above and it worked flawlessly. I am sure that I am just not experienced enough in Python and whatever I am doing to access the variable is just not jiving. 

Thank you so much for the solution, you have helped me overcome a major obstacle in developing the script!



For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages