relume Posted December 22, 2014 Share Posted December 22, 2014 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. Quote Link to comment
relume Posted January 6, 2015 Author Share Posted January 6, 2015 (edited) Hello It seems that the command "FindObjectAtPt_Create" works only for objects on the active layer. The options for object selection, although not documented, are analogous to those of the command "ForEachObjectAtPoint" http://developer.vectorworks.net/index.php/VS:ForEachObjectAtPoint best regards, Edited January 6, 2015 by relume Quote Link to comment
relume Posted January 6, 2015 Author Share Posted January 6, 2015 (edited) 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 January 6, 2015 by relume Quote Link to comment
relume Posted January 7, 2015 Author Share Posted January 7, 2015 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). Quote Link to comment
relume Posted January 7, 2015 Author Share Posted January 7, 2015 Hello Furthermore "FindObjAtPt_Create" works on the bounding box area and not only on the surface of the object as expected. Quote Link to comment
Recommended Posts
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.