Conditional Design Names in Child Rules

In the Intent language, every computation is the result of referencing a rule.

A rule’s value is computed when the rule is initially referenced. Typically, the value is saved and returned for future reference. This form of computation is termed demand-driven evaluation. Computations and rule evaluations are only made if needed.

Explicit Design Name Vs. Rule Reference

In the following example, the child rule explicitly references a design by name:

Child leg As :smallSupport
End Child

In this case, the instance of the leg part in an assembly will always have the attributes of the design :smallSupport.

A configurable assembly must supply additional or alternative components, based on the requirements of the design. For example, depending on the value of a user-specified parameter, one of two designs for the leg would be selected.

A child rule can be used to choose between two (or more) designs. In the previous section, all instances of the child leg were based on the :smallSupport design. However, the load requirement could warrant the use of a sturdier leg design.

The following example chooses one of two designs based on the user-specified load parameter.

Child leg As (If load > 200 Then :largeSupport Else :smallSupport)
End Child

In the following example, a child , based on the design :centerSupport, is created if the load parameter exceeds 200. If the load does not exceed a value of 200, the child is not created.

Child stiffener As (If load > 200 Then :centerSupport Else :nullDesign)
End Child
Note: nullDesign is described in NullDesign - A Special Case.

To select from more than two designs, first create a separate rule that decides which design to use.

Rule legName As Name
   If load <= 50 Then
      legName = :nullDesign
   ElseIf load <= 200 Then
      legName = :smallSupport
   ElseIf load <= 350 Then
      legName = :mediumSupport
   Else
      legName = :largeSupport
   End If
End Rule

Next reference the rule that you just created to select the appropriate support design for the given load parameter value.

Child leg As legName
End Child
Note: When the design name expression does not contain a colon (:), it is a reference to a rule rather than an explicit design name.