Calculating and Checking a Volume

Configuration 2
 of KwrProfilesDesignTable.xls
applied to KwrBottleProfiles.CATPart

The bottle we start from is described in Appendix: Creating a Deformable Revolution Body. First of all, we want to be able to measure the bottle's volume, then each time the bottle's profile is modified, we want to be warned about whether the resulting volume is still in the  [230 cm3 - 280cm3] range. To achieve this goal, we will be using two CATIA Knowledgeware capabilities, the measures and the checks.
Measures are functions provided by various applications such as Part Design or Generative Shape Design to compute data. These functions can be used in formulas as well as in rules and checks. They can be accessed from an interactive dictionary. Checks are relations that don't modify the document but just tell you whether certain specified criteria are fulfilled.

Specifying the Proper Settings

Before going any further in the scenario developed in this Part, check the settings below:

  • In Tools->Options->General->Parameters and Measure.
  • In the Knowledge Environment tab, the Load extended language libraries  box must be checked otherwise you won't be able to access the Measures in the knowledgeware dictionary.
  • In the Knowledge tab, check the With Value and With Formula check boxes.
  • In the Units tab,  specify cm3 as the default volume unit.
  • In Tools->Options->Infrastructure->Part Infrastructure->Display, check at least the Relations and Parameters boxes. But it is recommended to check all the options below the specification tree settings. Click OK to validate.

Calculating the Bottle Volume

  1. Open the KwrThickSurface.CATPart document.

  2. Click the  icon or select the Tools->Formula command from the standard menu bar. The "Formula" dialog box is displayed.

  3. Select the Volume item in the New Parameter of type list. Then click New Parameter of type. A parameter called Volume.1 is displayed and highlighted in the parameters list.

  4. In the Edit name or value of the current parameter field, replace the Volume.1 name with BottleVolume. Click the Add Formula button.

  5. In the dictionary, select the Measures item, then double-click Volume in the measure list. If need be, add parentheses after the function name in the formula editor. At this stage the formula must be:
    BottleVolume = volume()

  6. Position the cursor between the parentheses and capture the joined surface (Join.1) definition from the specification tree. To do this, just double-click the Join.1 feature. The formula definition you should get in the editor is something like:
    BottleVolume = volume (Geometrical Set.1\Join.1)

  7. Click OK in the Formula Editor. You are back to the Formulas dialog box. The new formula is displayed in the parameter list opposite the BottleVolume parameter. It is also displayed in the specification tree under the Parameters and Relations nodes. Click OK again in the Formulas dialog box to exit the Formulas dialog.

Checking the Volume Value

  1. Select the document root feature, then access the Knowledge Advisor workbench. 
    To do this, select the Start->Knowledgeware->Knowledge Advisor command from the tool bar.

  2. Click the icon to display the Check Editor. In the first dialog box, replace the default name with VolumeCheck. Click OK. The Check Editor is displayed. 

  3. Define your check. To do this:

    1. Select Information or Warning in the Type of Check list.

    2. Enter the string "Volume out of range" in the message field.

    3. Enter the statement below in the edition window:
      (BottleVolume > 230 cm3) and (BottleVolume < 280 cm3) 

  4. Click OK to exit the dialog box and add the check to the document.  In the specification tree, the check icon is green.

The resulting document is KwrVolumeCheck.CATPart.