|
Description
Adds an item/entity to a specific group in the associated FRED document.
Syntax
count = AddToNthGroup ( group, n )
Parameters
count (Long)
Zero-based index of item added to group.
group As Long
The identifier of the group.
n As Long
Node number of the item to add to the group.
Remarks
This function adds an item/entity to a specific group in the associated FRED document. If there is a problem, the function sets an error and returns 0.
See Also
GetGroupCount
GetNthGroupCount
FindGroup
AddGroup
DeleteFromNthGroup
GetFromNthGroup
Example
The following example adds two groups with name and description to a document then adds selected elements to each group. In this case, most elements are lenses requiring the additional use of the GetChild and GetSibling commands.
Dim id0&, id1&, id2&, gname$, child&, sibling&, count&
id0 = AddGroup("First Group", "first lens and stop") Print "group node number is " & id0
id1=FindFullName("Geometry.triplet.Lens 1-2") id2=FindFullName("Geometry.triplet.Surface 3.Surf 3")
child = GetChild(id1) While child>0 count = AddToNthGroup(id0,child) child = GetSibling(child) Wend count = AddToNthGroup(id0,id2) Print GetNthGroupCount(id0) & " items added to group " & id0
id0 = AddGroup( "Second Group", "second and third lenses" ) Print "group node number is " & id0
id1=FindFullName("Geometry.triplet.Lens 4-5") id2=FindFullName("Geometry.triplet.Lens 6-7")
child = GetChild(id1) While child>0 count = AddToNthGroup(id0, child) child = GetSibling(child) Wend
child = GetChild(id2) While child>0 count = AddToNthGroup(id0,child) child = GetSibling(child) Wend Print GetNthGroupCount(id0) & " items added to group " & id0
|
Copyright © Photon Engineering, LLC
|
|