VS:TrackObject
.VectorScript|VectorScript ..VS:Function Reference|Function Reference ..VS:Function_Reference_Appendix|Appendix
Description
Interactively, including highlighting, allows the user to select one object meeting the specified criteria.
The callback function (any of these depending on what info is needed):
FUNCTION Callback(h : HANDLE): BOOLEAN; FUNCTION CheckObjCallback(h : HANDLE; px, py : REAL) : BOOLEAN; FUNCTION CheckObjCallback(h : HANDLE; px, py, pz : REAL) : BOOLEAN;
is used to let the user filter the object that can be returned from the function.
The parameter px, py, pz pass into the function information about current cursor position in document units.
This callback function is called when tracking over an object; also when click happens over an object. Returns true if the passed handle can be returned.
PROCEDURE TrackObject(
callback :PROCEDURE;
VAR outObj :HANDLE;
VAR px, py, pz :REAL);
def vs.TrackObject(callback): return (outObj, p)
Parameters
callback PROCEDURE The callback that will be called to check if an object meets the requirements to be tracked. See remarks. outObj HANDLE Returns handle to the selected from the temp tool object. p REAL Returns coordinates of mouse click.
Remarks
_c_, (2011 Oct. 03): The user is always prompted to select a point, similar to using GetPt, and this point seems to be the required criteria. So the description is a bit misleading, since you might believe that the routine takes care of the point all by itself, which doesn't happen.
Example
VectorScript
PROCEDURE Test; VAR h : HANDLE; x, y, z : REAL; FUNCTION CheckObjCallback(h : HANDLE) : BOOLEAN; {or FUNCTION CheckObjCallback(h : HANDLE; px, py : REAL) : BOOLEAN;} {or FUNCTION CheckObjCallback(h : HANDLE; px, py, pz : REAL) : BOOLEAN;} BEGIN {any object is ok} CheckObjCallback := true; END; BEGIN TrackObject( CheckObjCallback, h, x, y, z ); IF h <> NIL THEN SetSelect( h ); END; RUN( Test );
Python
Version
Availability: from Vectorworks 2010
See Also
VS Functions:
VS:GetPt | VS:GetPtL | VS:GetPt3D | VS:GetPtL3D | VS:GetLine | VS:GetLine3D | VS:GetRect | VS:GetRect3D | VS:TrackObject
[[VS:GetPt]] | [[VS:GetPtL]] | [[VS:GetPt3D]] | [[VS:GetPtL3D]] | [[VS:GetLine]] | [[VS:GetLine3D]] | [[VS:GetRect]] | [[VS:GetRect3D]] |
[[VS:TrackObject]]