Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

Controlling other expressions with one expression 2

Status
Not open for further replies.

ChaseWichert

Mining
Jan 4, 2012
147
Hey, is there a way that I can use an if statement, and if p3=1, it will change p4 to 7 and p5 to 9, and if p3=2, it will change p4 to 3 and p5 to 12?
 
Replies continue below

Recommended for you

Sure, can you get onto the NX doc? If you can then look up "conditional expressions"
Maybe do a search in here for those two words too.
You will be able to write an "If-Then" statement for those.
 
I really wasn't able to find anything like I am talking about, I dont think.

I kind of want to add an expression like this

if(test=1)(e=32 & q=23) else (e=36 & q = 58)

Does that clarify any?
 
Using IF statements, your set of expressions would look like:

p3=1

p4=IF (p3==1) THEN (7) ELSE ( IF (p3==2) THEN (3) ELSE (0))

p5=IF (p3==1) THEN (9) ELSE ( IF (p3==2) THEN (12) ELSE (0))


And starting with NX 8.0 you now have another and perhaps more elegant option and that is the new 'nth' expression, in which your set of expressions would look like:

p3=1

p4=nth(p3,{7,3})

p5=nth(p3,{9,12})


In either case, changing p3 from '1' to '2' would change p4 from '7' to '3' and p5 from '9' to '12'.



John R. Baker, P.E.
Product 'Evangelist'
Product Engineering Software
Siemens PLM Software Inc.
Industry Sector
Cypress, CA
UG/NX Museum:
To an Engineer, the glass is twice as big as it needs to be.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor