VS:FindObjAtPt Create: Difference between revisions

From Vectorworks Developer
Jump to navigation Jump to search
(add lost remark from 2008)
m (add missing char)
Line 69: Line 69:
walls, symbols, round rects, ovals, 3D polys, 3D loci, nurbs, extrudes, dimensions, slabs....
walls, symbols, round rects, ovals, 3D polys, 3D loci, nurbs, extrudes, dimensions, slabs....


<code lang="pas"
<code lang="pas">
PROCEDURE xxxxx;
PROCEDURE xxxxx;
VAR
VAR
Line 86: Line 86:
i := 0;
i := 0;
WHILE i < cnt DO BEGIN
WHILE i < cnt DO BEGIN
AlrtDialog(Concat('Index: ', i, ' Obj Type: ', GetType(FindObjAtPt_GetObj(list, i))));
AlrtDialog(Concat('Index: ', i, ' Obj Type: ', GetTypeN(FindObjAtPt_GetObj(list, i))));
i := i + 1;
i := i + 1;
END;
END;

Revision as of 03:14, 21 January 2016

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

Description

Creates object find for objects at specified point within specified radius. The funtion is capable of iterating

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
objOptions INTEGER
travOptions INTEGER
locX REAL
locY REAL
pickRadius REAL

Remarks

(Orso, 2011): Was undocumented, made public by VW 2012 (1700).

(Orso, 2008-10-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....

PROCEDURE xxxxx;
VAR
	cnt, i : INTEGER;
	startContainer : HANDLE;
	list : LONGINT;
	loc	: VECTOR;
		
BEGIN
	GetPt(loc.x, loc.y);
	startContainer := NIL;
	
	list := FindObjAtPt_Create(startContainer, 1, 0, loc.x, loc.y, 100);
	cnt := FindObjAtPt_GetCount(list);
	
	i := 0;
	WHILE i < cnt DO BEGIN
		AlrtDialog(Concat('Index: ', i, ' Obj Type: ', GetTypeN(FindObjAtPt_GetObj(list, i))));
		i := i + 1;
	END;
	FindObjAtPt_Delete( list );
END;
Run(xxxxx);

Version

Availability: from Vectorworks 2014