VS:GetPt: Difference between revisions

From Vectorworks Developer
Jump to navigation Jump to search
No edit summary
 
mNo edit summary
(3 intermediate revisions by one other user not shown)
Line 14: Line 14:
</funcDef>
</funcDef>
<funcDef lang="py">
<funcDef lang="py">
def vs.GetPt():
def vs.GetPt(callback):
     return p
     return None
</funcDef>
</funcDef>
</def>
</def>
Line 29: Line 29:
</lineList>
</lineList>
</params>
</params>
-----------------------------------------------------------------------------------------------------------
<remark>
In Python this function will <b>NOT</b> block execution. It will execute a callback function with the resulted point.
</remark>


-----------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------
Line 41: Line 46:
END;
END;
RUN(Example);</code>
RUN(Example);</code>
Python:
<code lang="py">
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 )
</code>
[MaKro 6/2018]: ... in a tool consider using VS:vstGetCurrPt2D ...
</sample>
</sample>



Revision as of 08:28, 6 July 2018

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

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

p REAL Returns coordinates of mouse click.

Remarks

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

Example

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 )

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

Version

Availability: from All Versions

See Also

VS Functions:

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

VS Functions:

[[VS:GetPt]] | [[VS:GetPtL]] | [[VS:GetPt3D]] | [[VS:GetPtL3D]] | [[VS:GetLine]] | [[VS:GetLine3D]] | [[VS:GetRect]] | [[VS:GetRect3D]] |

[[VS:TrackObject]]