×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Contact US

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!

*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

Nested IF relations

Nested IF relations

Nested IF relations

(OP)
I am having some issues with a part family table.

I am developing a family table of parts for electrical connector test mates per this Military standard. The family is 9 parts that fall into 3 categories, 2 rows of leads, 3 rows or 4 rows.

The first relation I wrote was based on the size with < and > as the logical expressions, but it kept crashing my ProE session for some reason.

So finally I ended up with this:

CODE -->

/* NOMENCLATURE Y3R IS Y DIMENSION OF 3RD ROW 1ST FROM LEFT

/* PITCH CONTROL

IF N_ROWS >= 3
  PX1R = .075
  PX2R = .075
  PX3R = .075
  PX4R = .075
IF N_ROWS == 2
  PX1R = .1
  PX2R = .1
  PX3R = .1
  PX4R = .1
ENDIF
ENDIF

/* HOLE PATTERN CONTROL

IF N_ROWS == 4
  $Y3R = .0375
  X2R = .0375
  X1R = .075
  X4R = .0375
  IF N_ROWS == 3
    $Y3R = 0
    X2R = .0375
    X1R = 0
    X4R = .0375
  IF N_ROWS == 2
     $Y3R = -.0375
     X2R = .0250
     X1R = .075
     X4R = .050
ENDIF
ENDIF
ENDIF

/*SHELL OUTSIDE DIMENSIONAL CONTROL
IF N_ROWS == 4
  WIDTH = ((SIZE / 4) + 1) * .05 + .155
  H = .490
  IF N_ROWS == 3
    WIDTH = ((SIZE / 3) + 1) * .05 + .125
    H = .390
  ENDIF
ELSE
  WIDTH = (CEIL(SIZE / 2) - 1) * .05 + .140
  H = .298
ENDIF 

It works well for 4 row and 2 row parts, but not for 3 row. Any ideas?

RE: Nested IF relations

IF N_ROWS == 2 will never be evaluated because to get there N_ROWS >= 3

Same problem with entire /* HOLE PATTERN CONTROL section.

RE: Nested IF relations

yes, these are not nested IFs, just ordinary IFs, that you incorrectly programmed.

RE: Nested IF relations

A nested IF statement needs an ELSE statement on its own line between the IF clauses.
It is not needed with what you are trying to do!

Just set your IF for your row counts, then the spacing in the IF-ENDIF construct.

IF n_rows == 2
set spacing data
ENDIF

IF n_rows == 3
set spacing data
ENDIF

IF n_rows == 4
set spacing data
ENDIF

"Wildfires are dangerous, hard to control, and economically catastrophic."

Ben Loosli

RE: Nested IF relations

(OP)
Thanks Loosli, that is what I ended up doing and it worked well.

Not sure why I was trying to force the nested ifs, I guess having a cold and working too many hours to get the project out before the end of the year could have something to do with it, haha

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! Already a Member? Login



News


Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close