PDA

View Full Version : TypeError: y must be a float (transferring from vizard 3.0 to vizard 5.0)


Melody
10-09-2014, 03:40 PM
The coding runs smoothly in vizard3.0. But when I copy them to vizard 5.0. It shows the error below. How can I fix it?


Traceback (most recent call last):

val = event.call()
File "C:\Program Files (x86)\WorldViz\Vizard5\python
return func(*args,**kwargs)
File "C:\Documents and Settings
current_vertex=mycurves1.addVertex([curvex, curvey1,0],viz.ABS_GLOBAL)
File "C:\Program Files (x86)\WorldViz\
val = _ipcSend(_VIZ_OTFADDVERTEX,self.id,0,'',x[0],x[1],x[2],0.0)
TypeError: y must be a float

Melody
10-09-2014, 04:05 PM
viz.startlayer(viz.LINE_STRIP)
viz.vertexcolor(1,0,0)
mycurves1=viz.endlayer()
mycurves1.dynamic()
curvex=getposition()
curvey1=getforce1()
def curves1():
current_vertex=mycurves1.addVertex([curvex,curvey1,0],viz.ABS_GLOBAL)
mycurves1.setVertex(current_vertex, [curvex,curvey1,0],viz.ABS_GLOBAL)
current_vertex=mycurves1.addVertex([curvex,curvey1,0],viz.ABS_GLOBAL)
vizact.onsensordown(sensor,4,mycurves1.clearVertic es)

This is the part which result in error.

Jeff
10-10-2014, 03:09 PM
It seems you may be passing in a value to the addVertex command that's not a float. Can you post (http://forum.worldviz.com/faq.php?faq=vb3_reading_posting#faq_faq_vizard_cod e) a simple example that reproduces the error.