The Engineering Knowledge Language (EKL) used in CATIA’s formulas has a rich set of measurement functions, located in the Measure and the Part Measures sections of the formula editor’s Dictionary, as shown below. For example, there is a distance function that lets you measure distance between any two objects, a length function for measuring length of a curve, an area function for measuring area of a surface or a closed curve, etc.
Although the function signatures as shown in the Members of list may initially seem cryptic, they all follow the same convention that is easy to learn. For example, consider this function:
length (Curve, …): Length
The first word (length) is the name of the function. In the parentheses, you find the function’s input parameters. In this example, it says Curve, which means the function requires a curve as the input parameter. The “three dots” ellipsis symbol (…) means that the function can take any number of input parameters, i.e. that it could be used to measure the total length of several curves at once. Lastly, after the colon symbol you find the type of the value that the function returns. In this example, it says Length, which means that the function returns a value in length units.
You can look up the detailed descriptions for the functions in the CATIA’s Help system, in the Product Synthesis > Knowledge Advisor > Engineering Knowledge Language section.
Now let’s consider a couple of examples. In the first example, I will use a formula to measure the length of the spline shown below.
First, we create a user parameter that will hold the value of the measurement. In the Knowledge toolbar, select the Formula icon. In the New Parameter of type pull-down lists, select Length and Single Value, then click the New Parameter of type button.
Rename the created parameter from Length.1 to a meaningful name, such as SplineLength. To assign the measure value to the parameter, click the Add Formula button to open the Formula Editor dialog box.
In the Formula Editor dialog box, select the Measures section in the Dictionary list and double-click the length(Curve,…):Length function in the Members of list, so it populates the right-hand side in the formula. Note that the space between the parentheses is empty, which means we still need to select an input parameter to pass into the function.
To complete the formula, double-click in the tree the curve you want to measure, so it populates the space between the parentheses in the length function, as shown below.
Click OK twice to close the Formula Editor and the Formulas dialog boxes. The measurement and the formula are displayed in the tree as shown below.
In the second example, I will use a formula to measure the mass of the part shown below.
Similarly to the previous example, we start by creating a new parameter, now of type Mass. I will name it TotalMass. Then I click the Add Formula button to open the Formula Editor.
In the Formula Editor dialog box, select the PartMeasures section in the Dictionary, double-click the smartVolume(elem:Solid,…):Volume function in the Members of list, and double-click the PartBody in the tree to use it as the input parameter for the function.
Since mass is volume times the density of the material, we now need to add the material density to the formula. Add the multiplication operator “star” (*), click the material object in the tree, and double click the material density parameter in the Members of list. The completed formula looks as shown below.
Click OK twice to close the Formula Editor and the Formulas dialog boxes. The parameter and the formula are now displayed in the tree.
The use of parameters and formulas in CATIA is covered in the following Rand 3D classes:
About the AuthorFollow on Linkedin More Content by Iouri Apanovitch