How to use mathematical equations to control curves and surfaces in CATIA

November 12, 2018 Iouri Apanovitch

By Iouri Apanovitch

 

In CATIA Generative Shape Design workbench, Law features can be used for precise control of the shape of a curve or a surface. While the use of the sketch-based laws has already been well described in a Rand 3D blog (see the post “How to control parameters in CATIA Generative Shape Design workbench using Advanced Law”, posted by Trisha Freeman 02/07/2018), sketch-based laws have limitations.

Consider this task: How do I create an offset curve that is driven by a mathematical equation, for example Equation1?

To do that with a sketch-based law, we would have to sketch that shape in the Sketcher workbench first, but - there’s no tool in the Sketcher that lets you control a curve with an equation!

In this post, I’ll explain how to use mathematical equations to control curves and surfaces in CATIA. I’ll use the Parallel Curve tool as an example, but the described method could be just as well applied in any Shape Design feature that has the Law option enabled.

The model is shown below. The offset curve is to be driven by the equation  Equation2

Fig1

First, we need to create the law. To do that, click the  Icon1(Law) icon in the Knowledge toolbar to display the Law Editor dialog box. The right-hand side allows you to create formal parameters to be used in the law (“formal” in the sense that these are not actual parameters in a CATIA model, rather, they serve as the “input” and the “output” parameters in the law definition), the left-hand side is the law edition box.

Fig2

The input parameter in our law (the x value in our mathematical equation) is the ratio parameter along the line’s length. It’s a dimensionless parameter, and it has value 0 at the start of the line and value 1 at the end of the line. Since it’s dimensionless, select type Real in the pull-down list and click New Parameter of type button in the right-hand side of the dialog box. Rename the parameter as x.

Fig3

The output parameter (the y value in our equation) is the amount of the offset in the Parallel Curve definition, measured in length units. Therefore, select type Length and click New Parameter of type button to create the output parameter. Rename the parameter as y.

Fig4

Now, scroll down the Dictionary section until you find the Math chapter, then locate the square root function sqrt(Real):Real (the synopsis means that the function requires input value of type Real and produces output value of type Real too) and double-click it in the list to put it into the law edition box.

Fig5

Type in the rest of the law as following: y = -50mm + 100mm*sqrt(x). Note the use of units, which is to ensure that the output parameter y has length units. Click OK to close the Law Editor when done.

Fig6

Now activate the Generative Shape Design (GSD) workbench and click the   Icon2(Parallel Curve) icon. Select the curve to be offset and the support plane, then click Law button.

Fig7

In the Law Definition box, select the Advanced option, then select the law (e.g. Law.1) in the tree. The Law Definition box now displays the preview of the curve. Note that the horizontal axis shows the ratio parameter from 0 to 1, while the vertical axis shows the amount of offset, from -50mm to 50mm.

Fig8

 

Close the Law Definition and the Parallel Curve boxes. The resulting offset curve is created in the model, as shown below.

Fig9

Another interesting possibility is that CATIA Law lets you use conditional statements if…else if…else, which enables generation of “composite” curves, in which different sections in the curve are driven by different equations. For example, the law synopsis for a curve consisting of three sections would look as following:

                                if <input parameter is within certain range>

                                {

                                                <1st equation is used>

                                }

                                else if <input parameter is within some other range>

                                {

                                                <2nd equation is used>

                                }

                                else

                                {

                                                <3rd equation is used>

                                }

 

As an example, let’s create a composite curve that is driven by our square root equation for the ratio parameter up to 0.5, and then it becomes a constant offset curve for the ratio parameter between 0.5 and 1. In this case, the law code would look as shown in the figure below: (Note that the resulting curve must be continuous at the junction points between the sections! The offset value 20.711mm is the value of our square root equation at x=0.5)

Fig10

 And the resulting curve would look as following:

Fig11

 

The use of laws in Generative Shape Design is covered in the Rand 3D CATIA Advanced Surface Class.

 

About the Author

Iouri Apanovitch

Senior Technical Training Engineer<br><br>As a senior member of the Rand 3D team with a doctorate degree in Finite Element Analysis (FEA) and over 35 years of experience, Iouri provides design, consulting, and training services to those in the aerospace, automotive, electronics, and consumer goods industries. Iouri is a seasoned pro in 3D parametric design and prototyping using knowledge-based engineering methods, and has worked on a wide range of projects including BOM automation, CMM points generation, automated 3D annotation creation, and die tooling automation design. He is also a sought-after instructor and holds the designations of both CATIA Certified Professional (Expert level) and CATIA Certified Instructor.

Follow on Linkedin Visit Website More Content by Iouri Apanovitch
Previous Article
Keyboard shortcuts for CATIA
Keyboard shortcuts for CATIA

By Mark Potrzebowski This video shows how to use keyboard shortcuts within CATIA V5. There are a few ways i...

Next Article
How to create an attribute link in CATIA
How to create an attribute link in CATIA

By Mark Potrzebowski This video shows CATIA users how to link a text value (parameter) that is created in a...