VS:GetMouse: Difference between revisions

From Vectorworks Developer
Jump to navigation Jump to search
m (1 revision)
No edit summary
Line 30: Line 30:
</lineList>
</lineList>
</params>
</params>
 
-----------------------------------------------------------------------------------------------------------
<remark>
This function is not accurate to the 2d plane when in a 3d view.
</remark>
-----------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------
<sample>
<sample>

Revision as of 22:32, 1 February 2023

.VectorScript|VectorScript ..VS:Function Reference|Function Reference ..VS:Function_Reference_Appendix|Appendix

Description

Procedure GetMouse tracks and returns the current location of the cursor within the active VectorWorks document, allowing the cursor coordinates to be returned dynamically while moving the cursor onscreen.

PROCEDURE GetMouse(
VAR pX,pY :REAL);
def vs.GetMouse():
    return p

Parameters

p REAL Returns current mouse coordinates.

Remarks

This function is not accurate to the 2d plane when in a 3d view.

Example

VectorScript

BEGIN
WHILE NOT KeyDown(aCode) DO
BEGIN
GetMouse(CursX,CursY);
Message('X : ',CursX,' Y : ',CursY);
END;
END;
{displays the cursor coordinates as it is moved around onscreen}

Python

def Example():
	isKeyDown, alakiCode = vs.KeyDown()
	while not(isKeyDown):
		CursPt = vs.GetMouse()
		vs.Message('X : ',CursPt[0],' Y : ',CursPt[1])
		isKeyDown, alakiCode = vs.KeyDown()
Example()

Version

Availability: from All Versions