Selecting a Vertex using python

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
Old 03 March 2013   #1
Selecting a Vertex using python

Heya, i am new to python, so sorry if this seems really basic and dumb.

I have created a polyplane and I am trying to select a vertex on it. This is what i have tried:

import maya.cmds as cmds

cmds.polyPlane(name = "terrain", sw=10, sh=10, w=5, h=5)

cmds.select(terrain.vtx[0])


I get this error:

# Error: AttributeError: 'list' object has no attribute 'vtx' #


Thanks for any help you can give
 
Old 03 March 2013   #2
you should write : cmds.select("terrain.vtx[0]")

If you miss the quotes, it will try to import some value from a class :

  class Complex:
 	def __init__(self, realpart, imagpart):
 		self.r = realpart
 		self.i = imagpart
 
 x = Complex(3.0, -4.5)
 x.r, x.i
 #It will print >>>(3.0, -4.5)
 


This example is from python doc
http://docs.python.org/2/tutorial/classes.html

bye bye, hope it help !
__________________
DrWeeny
My Blog
My Vimeo
LinkedIn
 
Old 03 March 2013   #3
This worked! thank you very much
 
Old 03 March 2013   #4
Thread automatically closed

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
__________________
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
 
Thread Closed share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 11:55 AM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.