Skip to content

Latest commit

 

History

History
98 lines (79 loc) · 2.1 KB

File metadata and controls

98 lines (79 loc) · 2.1 KB

GetPt

Description

Procedure GetPt switches the cursor to selection mode and allows the user to select a point in a VectorWorks document. This cannot be used if there is a function anywhere in the calling chain.

PROCEDURE GetPt(VAR pX,pY : REAL);
def vs.GetPt(callback):
    return None

Parameters

Name Type Description
p REAL Returns coordinates of mouse click.
callback FUNCTION Python only! A callback function that will be executed when the tool finishes. The callback receives the point

Remarks

In Python this function will NOT block execution. It will execute a callback function with the resulted point.

[MaKro 6/2018]: ... in a tool consider using VS:vstGetCurrPt2D ...

Examples

PROCEDURE Example;
VAR
pt :POINT;
BEGIN
GetPt(pt.x, pt.y);
Message(pt);
END;
RUN(Example);

Python:

import vs;

def DoIt(h1):
	vs.AlrtDialog( "we're in", h1 )

def PickPointCallback(pt):
	vs.ForEachObjectAtPoint(DoIt, 0, 0, pt[0], pt[1], 5)

vs.AlrtDialog( "show let you pick a point, and then show a dialog with the object's handle" )
vs.GetPt( PickPointCallback )
BEGIN
	GetPt(mouseX, mouseY);

{** Get the text location from the user; Make the text object; Get a handle to it for later.}
	ReDrawAll;
	Message(kClickMsg);
	GetPt (gPtX, gPtY);
	ClrMessage;
	TextOrigin(gPtX, gPtY);
	CreateText(kFrameCtr);
	gFrameCounterHan := LNewObj;

GetPt (x1, y1);
TextOrigin (x1, y1);
TextVerticalAlign (1);
TextJust (1);
import vs

# Procedure GetPt switches the cursor to selection mode and allows the user
# to select a point in a VectorWorks document.
def handle_object(objHandle):
    vs.Message('Processing: ' + str(objHandle))

callback = handle_object

vs.GetPt(callback)

See Also

VS Functions: GetPt | GetPtL | GetPt3D | GetPtL3D | GetLine | GetLine3D | GetRect | GetRect3D | TrackObject

Version

Availability: from All Versions

Category