Jump to content
Developer Wiki and Function Reference Links ×

FindObjAtPt_Create any working example?


relume

Recommended Posts

Hello

Does anybody have a working example for the command "FindObjAtPt_Create" ?

I am not able to get the command group "FindObjAtPt_..." to work. Either it is not clear, if the command works across layers.

The following example get the actual user cursor, then shows X, Y and then should return the handles for all object within the specified radius of the given X, Y point. For my test drawing the X, Y is returend correct by the command GetPt(X,Y) but FindObjAtPt_Create does not find any object although there are plenty of test objects (also overlapping and distributed on the same and other layers) on my test drawing.

PROCEDURE ObjectInRadius;

VAR

cnt, i : INTEGER;

startContainer : HANDLE;

list : LONGINT;

loc: VECTOR;

vX : REAL;

vY : REAL;

vObjectHandle : HANDLE;

BEGIN

dselectall;

startContainer := NIL;

GetPt(vX, vY);

AlrtDialog(Concat('X/Y : ', vX, '/', vY));

list := FindObjAtPt_Create(startContainer, 0, 1, vX, vY, 15);

cnt := FindObjAtPt_GetCount(list)+1;

i := 0;

WHILE i < cnt DO BEGIN

vObjectHandle := FindObjAtPt_GetObj(list, i);

SetSelect(vObjectHandle);

AlrtDialog(Concat('Handle : ', vObjectHandle));

i := i + 1;

END;

END;

Run(ObjectInRadius);

@VectorWorks Support. Please document and comment this command, also with working examples on the vectorscript function reference.

Link to comment
  • 2 weeks later...

Hello

Further that the command "FindObjectAtPt_Create" works only for objects on the active layer it works also only correctly if the null point (document origin) of the drawing has not been changed. By moving the null point (document origin) of the drawing, the command "FindObjectAtPt_Create" does find not anymore objects.

I do not know if that represent a bug, but I guess so.

The above example script should then include an adjustment for the X, Y parameters of the "FindObjectAtPt_Create" command with the document origin:

PROCEDURE ObjectInRadius;

VAR

cnt, i : INTEGER;

startContainer : HANDLE;

list : LONGINT;

loc: VECTOR;

vX : REAL;

vY : REAL;

vXnew : REAL;

vYnew : REAL;

vXorg : REAL;

vYorg : REAL;

vObjectHandle : HANDLE;

vObjectName : STRING;

BEGIN

dselectall;

startContainer := NIL;

GetPt(vX,vY);

GetOrigin(vXorg, vYorg);

AlrtDialog(Concat('X/Y Org : ', vXorg, '/', vYorg));

vXnew := vXorg+vX;

vYnew := vYorg+vY;

AlrtDialog(Concat('X/Y; new : ', vX,'/', vY, ' ; ', vXnew,'/', vYnew));

list := FindObjAtPt_Create(startContainer, 0, 1, vXnew, vYnew, 0.5);

cnt := FindObjAtPt_GetCount(list)+1;

i := 0;

WHILE i < cnt DO BEGIN

vObjectHandle := FindObjAtPt_GetObj(list, i);

vObjectName := GetName(vObjectHandle);

SetSelect(vObjectHandle);

AlrtDialog(Concat('object : ', i , ' : ', vObjectName, ' : ', vObjectHandle));

i := i + 1;

END;

END;

Run(ObjectInRadius);

Edited by relume
Link to comment

Hello

I found with trial and error that the command "FindObjAtPt_Create" does not work for Arc-objects. "FindObjectAtPt_Create" does only find Arc-objects if the specified point within specified radius overlaps the left side Arc-boundary line. "left side" of the Arc means that the Arc segment from 180-360 degrees (clockwise) from the insertion point of the Arc are responsive to "FindObjectAtPt_Create". See picture (small red circles = Arc-object is found, small black circles = Arc-object is not found, cross = Arc-insertion point).

VectorWorks_FindObjectAtPt.jpg

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...