VS:FindObjAtPt Create: Difference between revisions
m (1 revision) |
No edit summary |
||
(11 intermediate revisions by the same user not shown) | |||
Line 5: | Line 5: | ||
----------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- | ||
<desc> | <desc> | ||
Creates object find for objects at specified point within specified radius. The function is capable of iterating</desc> | |||
</desc> | |||
----------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- | ||
<def> | <def> | ||
<funcDef lang="vs"> | <funcDef lang="vs"> | ||
FUNCTION FindObjAtPt_Create(hContainer: HANDLE; objOptions: INTEGER; travOptions: INTEGER; locX: REAL; locY: REAL; pickRadius: REAL) : LONGINT; | FUNCTION FindObjAtPt_Create(hContainer:HANDLE; objOptions:INTEGER; travOptions:INTEGER; locX:REAL; locY:REAL; pickRadius:REAL) : LONGINT; | ||
</funcDef> | </funcDef> | ||
<funcDef lang="py"> | <funcDef lang="py"> | ||
Line 27: | Line 24: | ||
hContainer | hContainer | ||
HANDLE | HANDLE | ||
</line> | </line> | ||
<line> | <line> | ||
objOptions | objOptions | ||
INTEGER | INTEGER | ||
AllObjs = 0; VisibleOnly = 1; SelectedOnly = 2; UnlockedOnly = 3 | |||
</line> | </line> | ||
<line> | <line> | ||
travOptions | travOptions | ||
INTEGER | INTEGER | ||
Shallow = 0; Groups = 1 | |||
</line> | </line> | ||
<line> | <line> | ||
locX | locX | ||
REAL | REAL | ||
</line> | </line> | ||
<line> | <line> | ||
locY | locY | ||
REAL | REAL | ||
</line> | </line> | ||
<line> | <line> | ||
pickRadius | pickRadius | ||
REAL | REAL | ||
</line> | </line> | ||
</lineList> | </lineList> | ||
</params> | </params> | ||
----------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- | ||
<remark> | <remark> | ||
([[User:Orso.b.schmid|Orso]], 2011): Was undocumented, made public by VW 2012 (1700). | |||
| | |||
: | ([[User:Orso.b.schmid|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 [[VS:BuildResourceList]]) which you'll use to manipulate the found objects. The suffix ''create'' stays then for ''create a list''. | ||
* [[VS:FindObjAtPt_GetCount]](list) will return the count of found objects | |||
* [[VS: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, roofs.... | |||
rgm, 2016-10-05 : for objOptions it's 0 for AllObjs, 1 for VisibleOnly, 2 for SelectedOnly, 3 for UnlockedOnly; travOptions is 0 for Shallow and 1 for Groups (from `FindObjectAtPoint.h` in the SDK). | |||
<code lang="pas"> | <code lang="pas"> | ||
PROCEDURE | PROCEDURE xxxxx; | ||
VAR | VAR | ||
cnt, i : INTEGER; | |||
startContainer : HANDLE; | |||
list : LONGINT; | |||
loc : VECTOR; | |||
BEGIN | 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);</code> | |||
<code lang='py'> | |||
def PickPointCallback(pt): | |||
startContainer = vs.Handle(); | |||
list = vs.FindObjAtPt_Create(startContainer, 1, 0, pt[0], pt[1], 100) | |||
cnt = vs.FindObjAtPt_GetCount(list) | |||
for(i in range(cnt): | |||
hObj = vs.FindObjAtPt_GetObj( list, i ); | |||
vs.AlrtDialog( 'Index: ' + str(i) + ' Obj Type: ' + str(vs.GetTypeN(hObj)) ) | |||
vs.FindObjAtPt_Delete( list ) | |||
vs.GetPt( PickPointCallback ) | |||
</code> | </code> | ||
</sample> | </remark> | ||
----------------------------------------------------------------------------------------------------------- | |||
<sample></sample> | |||
----------------------------------------------------------------------------------------------------------- | |||
<seeAlso></seeAlso> | |||
----------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- | ||
<version> | <version> | ||
Availability: from | Availability: from Vectorworks 2014 | ||
</version> | </version> | ||
</vwDoc> | </vwDoc> | ||
[[Category:VS Function Reference|FindObjAtPt_Create]] | [[Category:VS Function Reference|FindObjAtPt_Create]] | ||
[[Category:VS Function Reference: | [[Category:VS Function Reference:Graphic Calculation|FindObjAtPt_Create]] |
Revision as of 17:50, 3 April 2018
.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 function 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 AllObjs = 0; VisibleOnly = 1; SelectedOnly = 2; UnlockedOnly = 3 travOptions INTEGER Shallow = 0; Groups = 1 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 VS:BuildResourceList) which you'll use to manipulate the found objects. The suffix create stays then for create a list.
- VS:FindObjAtPt_GetCount(list) will return the count of found objects
- VS: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, roofs....
rgm, 2016-10-05 : for objOptions it's 0 for AllObjs, 1 for VisibleOnly, 2 for SelectedOnly, 3 for UnlockedOnly; travOptions is 0 for Shallow and 1 for Groups (from `FindObjectAtPoint.h` in the SDK).
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);
def PickPointCallback(pt): startContainer = vs.Handle(); list = vs.FindObjAtPt_Create(startContainer, 1, 0, pt[0], pt[1], 100) cnt = vs.FindObjAtPt_GetCount(list) for(i in range(cnt): hObj = vs.FindObjAtPt_GetObj( list, i ); vs.AlrtDialog( 'Index: ' + str(i) + ' Obj Type: ' + str(vs.GetTypeN(hObj)) ) vs.FindObjAtPt_Delete( list ) vs.GetPt( PickPointCallback )
Version
Availability: from Vectorworks 2014