The AdditionalParameters Parameter

AdditionalParameters is a special parameter that is allowed for any design in any child rule.

The value is a list of Name/Value pairs. These pairs contain the names and values of "additional" parameters to be supplied to the creation of the child. Use additionalParameters when you want to choose the set of parameters to be supplied at runtime.

The example below supplies additionalParameters conditionally. If a > b, then child b1 is a block, and length and width parameters are supplied; otherwise, the b1 child is a cylinder, and the diameter parameter is supplied.

Child b1 as (if (a > b) then :IvBlock else :IvCylinder)
   height = 42
   additionalParameters = (if (a > b) then { :length, 2, :width, 2} else {:diameter, 2})
End Child

Alternatively, this can be done unconditionally. Only the relevant parameters will be supplied. For example, diameter is supplied only if b1 is a cylinder:

Child b1 as (if (a > b) then :IvBlock else :IvCylinder)
   height = 42
   length = 2
   width = 2
   diameter = 2
End Child

Unlike ordinary parameters, the entire additionalParameters list is evaluated at the time the part is created. In the example below, 3+4 is evaluated immediately upon the creation of the b1 child, rather than when b1.height is demanded.

Child b1 as :IvBlock
   additionalParameters = { :length, 1, :width, 2, :height, 3+4}
End Child