Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations KootK on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Formulas

Status
Not open for further replies.

forfun

Automotive
Apr 26, 2003
57
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
 
Replies continue below

Recommended for you

Forfun - parameters - real for just a number, length for using later as a dimension
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
 
Additionally, you can set two parameters, and use them in a math function elsewhere.

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.
 
I am sorry my question is not very clear as it was written in haste. Given some more thought, I don't know as it would be the time saver I thought it would be anyway. But more out of curiosity now, here goes the question again.

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
 
Create another parameter and set it to either +1 or -1. Then multiply your b,d, or f parameters times that parameter and simply add them. As for the if portion, I think you need a KWA Rule for that part.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor