![]()  | 
	
| 
		 
			 
			#1  
			
			
			
			
			
		 
		
	 | 
|||
		
		
  | 
|||
| 
		
	
		
		
			
			 
				
				Access the vertices of a model
			 
			
			
			Hey  
		
		
		
		
		
		
		
		
	
	I have a problem. I need to calculate the convex hull of an 3D model loaded in vizard. I have the code to do that but for that I need all the vertices of the model ie. their coordinates in a array. I need to access all the vertices of the object but I am not able to find any method to do that. Can you please tell me how can I access all the vertices of the model. PS. the model is a complex model and is not a on-the-fly object. Its a .ive or 3ds max file. so plz tell me how can I access the vertices. Regards Pankaj Bansal  | 
| 
		 
			 
			#2  
			
			
			
			
			
		 
		
	 | 
|||
		
		
  | 
|||
| 
		
	
		
		
		
		 
			
			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))
 | 
![]()  | 
	
	
| Tags | 
| access vertices | 
| Thread Tools | |
| Display Modes | Rate This Thread | 
		
  | 
	
		
  | 
			 
			Similar Threads
		 | 
	||||
| Thread | Thread Starter | Forum | Replies | Last Post | 
| Accesing different parts of model | pankaj bansal | Vizard | 1 | 12-30-2012 11:10 PM | 
| 3ds Exported .IVE Model mirrors movement of Mainview | Felix | Vizard | 9 | 05-18-2012 10:17 AM | 
| Change model alpha and memory leak | hosier | Vizard | 2 | 06-25-2009 11:55 AM | 
| Importing a 3d human model and getting it to interact. | yak | Vizard | 3 | 06-01-2009 03:19 PM | 
| Model sizes | Pastscapian | Vizard | 15 | 10-07-2006 03:48 PM |