Message 1 of 2
Create mesh from list

Not applicable
11-27-2017
07:12 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Is it possible to create a mesh in Python from a list? For example, I have a list of vertices in a list that I know will make up a cube. How do I loop over the list and creat each vertex in turn?
import maya.cmds as cmds
myCube = [
-0.5, -0.5, 0.5,
0.5, -0.5, 0.5,
0.5, 0.5, 0.5,
0.5, 0.5, 0.5,
-0.5, 0.5, -0.5,
0.5, 0.5, -0.5,
-0.5, -0.5, -0.5,
0.5, -0.5, -0.5
]
for x, y, x in myCube: # I have no idea
create vertex (x,y,z) # This is just a guess
At the emoment I'm just interested in creating each vertex. I'll fill in the faces later by hand.