By Iouri Apanovitch

CATIA offers unparalleled capabilities for knowledge-based engineering. Parameters, formulas, design tables, etc. lie at the very foundation of CATIA, enabling capturing the design intent by creating relations among a model’s dimensions and features.

In this blog post, I will explain how to use formulas not just to link parameter values, but to create actual geometry in CATIA.

The Engineering Knowledge Language (EKL) used in CATIA’s formulas have a variety of *constructor* functions that enable building geometry using formulas or other types of relations such as Rules and Reactions. For example, there is a set of **Circle Constructors** for creating circles, **Line Constructors** for creating lines, **Plane Constructors** for creating planes, and so on. A snapshot of the **Operations Constructors** functions is shown below. As you can see, one can perform surfacing operations such as *assemble*, *split*, *trim*, and many others using those functions.

The function signatures as shown in the **Members of** list follow the same convention that is easy to learn. For example, consider the **split** function:

**split (tosplit:Surface, splitting:Surface, orientation: Boolean): Surface**

The first word (**split**) is the name of the function. In the parentheses, you find the function’s input parameters. In this example, the first input parameter says **tosplit:Surface**, which means the function requires a surface as the first input, and the word **tosplit** implies that that would be the surface to split. The second input parameter says **splitting:Surface**, which means the function requires another surface as the input, and the word **splitting** implies that that would be the splitting element. The third input parameter says **orientation:Boolean**, which means the function requires either *true* or *false* as the third input, and the word **orientation** means that that would determine the side of the split to keep. Lastly, after the colon symbol you find the type of the value that the function returns. In this example, it says **Surface**, which means that the function’s result is a surface.

If you want to avoid guessing, look up the detailed descriptions for the functions in the CATIA’s Help system, in the **Product Synthesis > Knowledge Advisor > Engineering Knowledge Language** section.

As an example, I will use a formula to create an intersection curve between a plane and a surface shown below.

We start by creating a user parameter of type **Curve**. In the Knowledge toolbar, select the Formula icon. In the **New Parameter of type** pull-down list, select **Curve**, then click the **New Parameter of type** button.

Ensure that the created parameter **Curve.1** is highlighted in the list of parameters and click the **Add Formula** button.

In the Formula Editor dialog box that opens, select the **Wireframe Constructors** section in the **Dictionary** and double-click the **intersect(Surface, Surface):Curve** function in the **Members of** list, so it populates the right-hand side in the formula as shown below. Note that the space between the parentheses only contains a comma, which means we still need to select the two inputs to pass into the function.

To complete the formula, 1^{st} put the mouse cursor before the comma in the parentheses and double-click the plane in the tree, then, 2^{nd}, put the mouse cursor after the comma in the parentheses and double click the surface in the tree. The plane and the surface names now populate the space between the parentheses in the **intersect** function, as shown below.

Click **OK** twice to close the Formula Editor and the Formulas dialog boxes. The intersection curve displays in the model and in the tree as shown below.

The constructor functions in EKL could also be used to create geometry “on-the-fly”, without adding the created geometry to the tree and visualizing it in the model. For example, let’s say I only want to measure the area within the intersection curve, without actually adding the curve to the model.

Start by creating a new parameter, now of type **Area**. I will name it **AreaIntersect**. Then click the **Add Formula** button to open the Formula Editor.

In the **Formula Editor** dialog box, select the **Measures** section in the **Dictionary**, double-click the **area(Curve,…):Area** function in the **Members of** list, so it populates the right-hand side in the formula as shown below.

Select the **Wireframe Constructors** section in the **Dictionary** and double-click the **intersect(Surface, Surface):Curve** function in the **Members of** list. Now the formula should look as shown below.

Complete the formula by providing the two inputs for the **intersect** function, as I did in my previous example. The result should look as shown below. Note that due to the precedence rules (i.e. the expression in the parentheses is evaluated first), the **intersect** function is executed first, then its result is used as the input for the **area** function.

Close the Formula Editor and the Formulas dialog boxes. Note that the area parameter and its value are displayed in the tree, while the actual intersection curve is not. I.e. the intersection curve was computed “on-the-fly”, behind the scenes, and only used to calculate the area.

The use of parameters and formulas in CATIA is covered in the following Rand 3D classes: