View Single Post
  #2  
Old 03-29-2013, 07:02 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
There is currently no built-in way to access the vertices, but you can save the model to the STL format, which is a simple text format that contains all the vertices. Here is some sample code allows you to iterate over the vertices:
Code:
import viz
viz.go()

model = viz.add('logo.ive')

def getVertices(node):
	"""Iterate over vertices"""
	node.save('temp.stl')
	vertices = []
	with open('temp.stl','r') as f:
		for line in f:
			s = line.split()
			if s and s[0] == 'vertex':
				yield float(s[1]), float(s[2]), -float(s[3])

verts = list(getVertices(model))
Reply With Quote