VS:FindObjAtPt Create
.VectorScript|VectorScript ..VS:Function Reference|Function Reference ..VS:Function_Reference_Appendix|Appendix
Description
Searches for specified objects inside specified container. The routines searches for planar object.
You must use VS:FindObjAtPt_Delete to delete the returned searcher instance.
FUNCTION FindObjAtPt_Create(
hContainer : HANDLE;
objOptions : INTEGER;
travOptions : INTEGER;
locX : REAL;
locY : REAL;
pickRadius : REAL) : LONGINT;
def vs.FindObjAtPt_Create(hContainer, objOptions, travOptions, locX, locY, pickRadius): return LONGINT
Parameters
hContainer HANDLE The container that is to be searched. If passed NIL then it searches in the current layer. objOptions INTEGER Traversal options related to objects. See remarks for detailed values. travOptions INTEGER Traversal style. See remarks for detailed values. locX REAL X location to search at. locY REAL Y location to search at. pickRadius REAL Search radius. Distance from (locX,locY) at which it will search for objects.
Return Value
Returns searcher instance. Must be deleted with call to VS:FindObjAtPt_Delete.
Remarks
Specific values for the parameters:
- objOptions parameter:
Constant Value Meaning kFindObjectOptions_AllObjs 0 Traverse all the objects. kFindObjectOptions_VisibleOnly 1 Traverse only visible objects. kFindObjectOptions_SelectedOnly 2 Traverse only selected objects. kFindObjectOptions_UnlockedOnly 3 Traverse only unlocked objects.
- travOptions parameter:
Constant Value Meaning kFindObjectTraversalOptions_Shallow 0 Traverse only the children of the container. kFindObjectTraversalOptions_Groups 1 Traverse recursively the container.
(Orso, 2008 Oct. 15): Finds objects at the point "Loc" starting from the parent container "hContainer". The routine returns a longint as list of objects (similar to BuildResourceList) which you'll use to manipulate the found objects. The suffix "create" stays then for "create a list". FindObjAtPt_GetCount(list) will return the count of found objects. FindObjAtPt_GetObj(list, i) returns a handle to the object at index "i. The index is 0-based.
It seems to ignore most object types. It will work with:
- lines, polylines, polygons, rectangles, arcs, 2D loci, pios.
Notably it will ignore:
- walls, symbols, round rects, ovals, 3D polys, 3D loci, nurbs, extrudes, dimensions, slabs....
Example
PROCEDURE Example; VAR finderID : LONGINT; i, objCnt : INTEGER; h : HANDLE; BEGIN finderID := FindObjAtPt_Create( NIL, 0, 1, 0mm, 0mm, 3mm ); objCnt := FindObjAtPt_GetCount( finderID ); FOR i := 0 TO objCnt-1 DO BEGIN h := FindObjAtPt_GetObj( finderID, i ); AlrtDialog( Concat( 'found object ', i, ' of ', objCnt, ' h=', h ) ); END; FindObjAtPt_Delete( finderID ); END; RUN(Example);
Version
Availability: from All Versions
This is drop-in function.
See Also
Related functions: VS:FindObjAtPt_Create | VS:FindObjAtPt_GetCount | VS:FindObjAtPt_GetObj | VS:FindObjAtPt_Delete