×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

CATIA V5 Conditional Statements

CATIA V5 Conditional Statements

CATIA V5 Conditional Statements

(OP)
Hi,
I can't seem to figure out the syntax, or if this is even possible. I'm working in the Law Editor.
I would like to write a conditional statement that will change an angle in a part based on a string type parameter.

Ex. IF `valve` = closed, THEN angle = 90deg

Any help/examples/syntax pointers would be appreciated.
Thanks,
Jake

RE: CATIA V5 Conditional Statements

I can show you how you do it in a rule:

if 'valve'=="closed"
  {
     angle=90deg
  }

RE: CATIA V5 Conditional Statements

(OP)
Thanks, getting closer.  I was able to get the angle to snap to 90 by getting back into the rule and hitting 'apply' and 'ok' but it wouldn't update when I changed the parameter from 'open' to 'closed'.  Ideally it would snap the valve arm over when the parameter was changed in its drop down menu.  Also, should I create two rules, one for open and one for closed, or can I do an if/else statement?
Thanks,
Jake

RE: CATIA V5 Conditional Statements

You can use the same rule

if 'valve'=="closed"
  {
     angle=90deg
  }
else
{
     angle=0deg
  }
 

RE: CATIA V5 Conditional Statements

(OP)
Still not working like I had hoped.  When I pick the string parameter from the drop down list under Parameters in the tree, the angle fails to update according to the rule.
Anything else I should be doing?

RE: CATIA V5 Conditional Statements

is it an update issue or is it not working?

RE: CATIA V5 Conditional Statements

(OP)
I think a little of both.  I can switch the parameter in the tree and nothing happens, no update swirl, nothing.  I can go into the law and hit apply, ok and when the law editor closes, it will update.  I'm trying to get it to update simply by changing the parameter in the tree.  I fooled around with it some more yesterday without any success.

RE: CATIA V5 Conditional Statements

Try starting from scratch.  Create a new part and in that part create the multi value Valve parameter and an Angle parameter set to 45°

create a simple sketch that you can link Angle to.

create rule
if Valve == "closed"
{
   Angle=0deg
}
else
{
   Angle=90deg
}

this will prove the concept

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources