WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Thread Tools Rate Thread Display Modes
Old 05-12-2009, 01:33 AM
Chrissy2009 Chrissy2009 is offline
Join Date: May 2009
Posts: 33
Draw Line between Points


I want to create a line between two points. The first point at the mouseDown Position and the second point at the mouseUp Position. Between these two points I want to draw a line.

This works very fine.

But now I want to show the line, before the mouseUp Event. So that I push down the mousebutton, move it at another position and can already see the line, although the mousebutton is pushed.

The line would change as long as I push the mousebutton.

Is this possible?

Thanks in advance...
Reply With Quote
Old 05-12-2009, 09:12 AM
farshizzo farshizzo is offline
WorldViz Team Member
Join Date: Mar 2003
Posts: 2,849
Yes, this is definitely possible. Here is a sample script that uses the viztask module to draw lines with the mouse:
import viz
import viztask

def DrawLineTask():
	while True:
		#Wait for left mouse butten to be pressed
		yield viztask.waitMouseDown(viz.MOUSEBUTTON_LEFT)
		#Get mouse position
		pos = viz.mouse.getPosition()
		#Create line
		line = viz.endlayer(parent=viz.SCREEN)
		#Create link between mouse position and vertex
		VertexLink =,line.Vertex(1))
		#Wait for mouse button to be released
		yield viztask.waitMouseUp(viz.MOUSEBUTTON_LEFT)
		#Destroy link
viztask.schedule( DrawLineTask() )
Reply With Quote
Old 05-13-2009, 04:42 AM
Chrissy2009 Chrissy2009 is offline
Join Date: May 2009
Posts: 33

thanks a lot!

And how can I stop the schedule, so I'm able to draw only two lines and no more??

Is there a possibility to save the separate positions of all these four vertex?
Reply With Quote

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Pivot points for child objects in Vizard with 3ds Max Gladsomebeast Vizard 0 09-19-2006 11:21 AM
problem with collision detection paulpars Vizard 6 06-09-2006 06:03 PM
Draw Line between Points selected by mouse Johannes Vizard 7 01-07-2005 02:50 PM

All times are GMT -7. The time now is 07:31 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC