View Single Post
  #6  
Old 12-09-2008, 11:53 AM
michaelrepucci michaelrepucci is offline
Member
 
Join Date: Jul 2008
Posts: 53
Interesting ... I wish I'd known about vizshape, because I've basically recreated much of its functionality, and in an apparently inferior way. I can't seem to find any documentation on vizshape, and its code comments are rather sparse as well. What you sent me does work.

Here's an example of what I did (a bit stripped down but reproduces the error):

Code:
import viz
import math

class Circle(viz.VizPrimitive):
	def __init__(self):
		#draw circle
		viz.startlayer(viz.LINE_LOOP)
		for i in range(32):
			radians = 2*math.pi*i/32
			viz.vertex([math.sin(radians),math.cos(radians),0])
		self.node = viz.endlayer()
		
		#initialize base class
		viz.VizPrimitive.__init__(self,self.node.id)

class Probe(viz.VizPrimitive):
	def __init__(self):
		#draw probe
		self.node = viz.addGroup()
		
		#draw circle
		circle = Circle()
		circle.parent(self.node)
		
		#draw lines
		viz.startlayer(viz.LINES)
		viz.vertex(0,0,0)
		viz.vertex(0,0,-1)
		line = viz.endlayer(self.node)
		
		#initialize base class
		viz.VizPrimitive.__init__(self,self.node.id)
	
viz.go()
viz.eyeheight(0)

probe = Probe()
probe.setPosition(0,0,5)
probe.setEuler(20,10,0)
probe.color(viz.RED)
probe.lineWidth(10)
Here you will notice the probe shows up with wide lines, but in white, not red.
Reply With Quote