A child list is a child rule that produces a list of children instead of a single child. Each member of the child list is a separate child of the parent. Child list rules have the same syntax as child rules, with the addition of the optional Quantity specification.
If present, the Quantity expression indicates that the rule is a Child List. The quantity expression should evaluate to a non-negative Integer, or an error will be generated. If the expression evaluates to zero, no children will be created.
The quantity expression may not reference anything inside the child list .
In child lists, each child can be customized based on its index. Index is a rule on every part; a child which is not part of a child list always has an index of 0, while indices of children in a child list begin at 1.The index rule value will be different for each child in the list.
Unless altered by rules, the default name of a child in a child list is the name of the Child list rule, followed by an underscore, followed by the index of the child. For example, Leg_2.
You refer to the index rule of the child as:
Child.index
To refer to index itself would return the index of the parent, which would be the same for all children in the child list.
The following example shows a rule that creates a child list with two parts.
In this case, the parameters cut1 and cut2 are different for each child.
In addition to Child.index, each part has several rules that refer to child list members, as listed in the table below. These rules are only relevant when the child is a member of a child list.
Reference | Meaning |
---|---|
Child.first? | Am I first? (equivalent to child.index = 1) |
Child.first | The first part. You can ask this of any part in the set, and they will all return the same answer. |
Child.last? | Am I last? |
Child.last | The last part. |
Child.next_ | The next part in the child list (NoValue if I am last). |
Child.previous | The previous part in the child list (NoValue if I am first). |
Child.cyclicNext | The next part, or first part if I am last |
Child.cyclicPrevious | The previous part, or last part if I am first. |
Child.isChildListMember? | Is this part is a member of a Child List? |
Child.childListLength | Number of elements in the Child List, or NoValue if not a member of a Child List |