Formulas
Formulas
(OP)
I am looking to do simple math where the math function is parameter driven.
ex. 6 (a parameter equal to + or -) 6
6+6 or 6-6
Is this even possible? If so, what type of parameter would work and could i get a simple example of it used in a formula?
Thanks in advance,
forfun
ex. 6 (a parameter equal to + or -) 6
6+6 or 6-6
Is this even possible? If so, what type of parameter would work and could i get a simple example of it used in a formula?
Thanks in advance,
forfun





RE: Formulas
formula - use the FX icon to create parameters.
if you double pick on the parameter in the tree, you can do the math in the box- just type 6+6 or (6-3)*2 ... and the math is done. If you have a parameter set to length then you could set your units to inches (globally in tool options) but in the parameter window type 6mm Catia will switch this to inches automatically.
If you want to tie a formula to a parameter use the formula editor via the FX icon or contextual menu inside the parameter editor menu -- edit formula
Regards,
Derek
RE: Formulas
For example, set up 2 independent parameters, calling one of them X, and one of them Y. Set the values to Real. Go to the place you want to create the formula - let's say, the length of a line. (for simplicity) You would open the formula editor, pick the line in space, select the proper line variable, (which is length) and then select the "add formula" option. In the blank white line, type your formula - X+Y. (or X-Y)
What you will get is exactly what you've just asked for, and you can control the variables from the tree.
---
CAD design engineering services - Catia V4, Catia V5, and CAD Translation. Catia V5 resources - CATBlog.
RE: Formulas
Below are two examples, example a, is how I would do it now. The parameters (AAA, BBB, & CCC) would be rule driven. In example b, the way I thought I wanted to do it, a single parameter (math) would be rule drive. Parameters AAA, BBB, & CCC would be formula driven. My problem is that if the parameter math is a string, I can’t seem to get the formulas to work. Does math need to be something other than a string?
example a
if Direction == "XXXX"
{
AAA= a+b
BBB= c+d
CCC= e+f
}
else
{
AAA= a-b
BBB= c-d
CCC= e-f
}
example b
if Direction == "XXXX"
math= "+"
else
math= "-"
parameters
AAA = a(math)b
BBB = c(math)d
CCC = e(math)f
Thanks Again,
forfun
RE: Formulas