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!

Nested IF relations 1

Status
Not open for further replies.

Korichnevijgigant

Aerospace
Oct 7, 2009
133
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?
 
Replies continue below

Recommended for you

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

Same problem with entire /* HOLE PATTERN CONTROL section.
 
yes, these are not nested IFs, just ordinary IFs, that you incorrectly programmed.
 
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
 
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor