Processes all items in the specified list and and applies the specified action to each item.
Table - ForEachObjectInList Selectors
| Option | Selector | Description |
|---|---|---|
| Object Options | ||
| All objects | 0 | |
| Visible Objects only | 1 | |
| Selected Objects only | 2 | |
| Unlocked objects only | 4 | |
| Traversal Options | ||
| Traverse Shallow | 0 | |
| Traverse Groups | 1 | Traverse inside groups |
| Traverse Deep | 2 | Traverse all containers (walls, extrudes, sweeps, etc) |
PROCEDURE ForEachObjectInList(
actionFunc : FUNCTION;
objOptions : INTEGER;
travOptions : INTEGER;
list : HANDLE);def vs.ForEachObjectInList(actionFunc, objOptions, travOptions, list):
return None| Name | Type | Description |
|---|---|---|
| actionFunc | FUNCTION | Subroutine which performs operation on found objects. |
| objOptions | INTEGER | Object selection option index. |
| travOptions | INTEGER | Search options index. |
| list | HANDLE | Handle to first item in list. |
Be careful using this together with a call to BeginSym: it deselects all selected objects on active layer (VW 13)
It seems that when you fill in a NIL Handle in the list Parameter, the ActionFunc will be executed on all the objects of the active layer (VW2011).
PROCEDURE Example;
CONST
pioName = 'Complex Window 2';
parameter = 'MeasureHeight';
value = 'Head of Window';
FUNCTION DoIt(h :HANDLE) :BOOLEAN;
BEGIN
h := FInSymDef(h);
SetRField(h, pioName, parameter, value);
END;
BEGIN
ForEachObjectInList(DoIt, 0, 0, FSymDef);
END;
RUN(Example);Another example:
PROCEDURE Example;
CONST
pioName = 'Window';
parameter = 'UPI';
value = '25.4';
FUNCTION DoIt(h :HANDLE) :BOOLEAN;
BEGIN
h := FInSymDef(h);
IF (h <> NIL) & (GetType(h) = 86) & (Eval(h, 'R IN [pioName])') > 0) THEN BEGIN
SetRField(h, pioName, parameter, value);
END;
END;
BEGIN
ForEachObjectInList(DoIt, 0, 0, FSymDef);
END;
RUN(Example);Python:
pioName = 'Complex Window 2'
parameter = 'MeasureHeight'
value = 'Head of Window'
def DoIt(h):
h := vs.FInSymDef(h);
vs.SetRField(h, pioName, parameter, value);
vs.ForEachObjectInList(DoIt, 0, 0, vs.FSymDef);BEGIN
CASE GetType(GetParent(parmHand)) OF
11: ForEachObjectInList(Reset_Selection, 2, 0, FInGroup(GetParent(parmHand)));
16: ForEachObjectInList(Reset_Selection, 2, 0, FInSymDef(GetParent(parmHand)));
END;
{group, viewport annotation group}
11, 122: ForEachObjectInList(HANDLE_ClassesNMtrls, 2, 2, FInGroup(container_h));
EndGroup;
GroupHand:= LNewObj;
SetClass(GroupHand,noneClass);
IF (GroupHand <> NIL) & ((GetType(GroupHand))=11) THEN
ForEachObjectInList(DuplicateIt,0,2,FInSymDef(GetObject(actualMarker1Name)));
ENDvs.ForEachObjectInList( DeleteMe, 0, 2, vs.FInGroup( hGroupHand ) )
# Get the texture index assigned to the PIO.
pIOTexIndex = vs.GetTextureRefN( objHand, 0, 0 False )
# Apply it to any untextured objects in the PIO.
vs.ForEachObjectInList( AssignTex, 0, 2, vs.FIn3D( objHand ) )Availability: from VectorWorks 8.5