Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

CASE statements of IF / THEN within CATIA parameters?

Status
Not open for further replies.

Albigger

Aerospace
Dec 29, 2004
204
0
0
US
Hello

I am trying to build a part with multiple configurations. This part will for example, have a size parameter. The user can change this parameter (from a list of available drop-downs).

I then want other dimensions to update according to this parameter, but not a formula. Is there a way to do that?


I know, for instance, I can put something like =parameter*2 but instead I want a series of IF statements, and results.


As a separate question, the driving parameter is a drop-down of length values. Do I have to have the values displayed, or can I name them like "config A" "config B" etc...?

Thanks.
--Jay
 
Replies continue below

Recommended for you

I tried using FOG but cannot quite get it to work. It seems (thru the help files) that you have to define parameters inside the FOG law function but I'm not sure how to relate these to actual parameters or sketch dimensions in the part? I kept getting an error whenever I tried to link to another parameter inside the dialogue box.

Can someone offer more help?

--Jay
 
Albigger:

Here is an example:

In the fog law editor type this statement.

If FormalLength.1== 3.0mm
{FormalLength.2 = 1.0 mm}

Exit the editor

Create two lenght parameters.
One parameter with 3.0mm as a value(lenght-1)
When you create the second lenght parameter(lenght-2) go to add formula,DC on the fog law you just created,then select law(under dictionary)DC the statement under members of law(Evaluate(real):real),Then Click on the first paramter(lenght-1) you created.

When you hit ok in the formula editor an update message will appear hit yes.

That is it.

Remeber fog laws are really limited.For every valu you have in you drop down box you will need to add another
statement in you fog law.

For example:

If FormalLength.1== 3.0mm
{FormalLength.2 = 1.0 mm}

If FormalLength.1== 4.0mm
{FormalLength.2 = 2.0 mm}
and so on.

Hope this helps.



 
Kapmc -

THANK YOU so much!

This helps me tremendously. Obviously the code will not be as succinct as some other languages, but this will let me do what I want (I think, for now).

I still have to play with it some, but at least this is a working example to go from.

Thanks again for being so helpful.
--Jay
 
The fog laws will only work for lengths and angles, boolean operations would require KWA. With KWA you could put multiple results together
If a==b
{
rad=.125in
height=3in
}

Regards,
Derek
 
Ok, how about with strings.


I made a law such as:

If FormalString.1=="Config A"
{FormalLength.1=.25in}

If FormalString.1=="Config B"
{FormalLength.1=.5in}


and that seemed OK. I have a string parameter with multiple values (Config A and Config B). Now how do I link a dimension to this law? I tried the way Kapmc stated above, but it won't let me input a string into the law (it wants a real). Anyway to do this?

Thanks guys for all the help.
 
You just can't using strings with the laws. Define your configurations as 0, 1, 2 and then evaluate these values with the law.

-Hora
 
Well, that's really not what I wanted, with many configurations I wanted to have descriptive names.

But if it can't be done I'll have to work around it I guess...
 
Albigger -

In the big picture - a KWA license (build license for rules and reactions) is not that expensive, if you consider the ROI. Fog laws are not intended for what you are trying to achieve. If you are running a HD2 or MD2 configurations, you have the runtime license for KWA.

Regards,
Derek
 
Actually, I had setup a design table originally (not sure if that's what you mean, or if there's another way to tie in a spreadsheet) and it seemed a little cumbersome. Plus, if I copied/pasted the part body (with the design table) into another part and wanted multiple copies, sometimes CATIA wouldn't let me have different configurations of that part body in the same CATPart. Of course I kind of self-taught myself the design table approach, so maybe I did not set it up correctly.


So I thought it might be easier with just a choicebox parameter inside the partbody, but maybe it won't be easier.

We have quite a few standard parts, different configurations, that we like to insert into our models. A good example would be socket head cap screws or hex nuts etc...

Maybe a catalog would be the best way to do this? I know nothing about catalogs though.
 
Sometimes, you can skip the formulas in Catia altogether, and handle it in your design table. Use simple numbers in your parameter relations, and do all the math in the spreadsheet. It's a pretty good solution in many cases.

Just be aware - if you want to do spreadsheet math, keep the formulas out of Catia, so as not to cause unsolvable loops. Make it an "all or nothing" approach.

Contact me through my sig links if you don't understand what I mean.

-----------------------------------------------------------
Catia Design|Catia Design News|Catia V5 blog
 
Albigger - you should look into powercopies, yet another powerful tool. This should help out with multiple configurations in the same CATPart

Regards,
Derek
 
Albigger:

Buy using a spreedsheet it is best to keep most of the formulas within the spreedsheet itself(as solid7 stated)
,but you can still use parameters and fog laws to help control your results.

As far as your standard parts these all should be created in a catalog, you then can resolve your catalog.This will create individual parts that you can bring into your assembly.

If you need help building a catalog, we can help you with that.
 
Status
Not open for further replies.
Back
Top