Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

Can UG handle variable/automated expressions? 2

Status
Not open for further replies.

morans

Mechanical
Feb 5, 2009
62
I'm looking for a way of controling an expression IF a certain condidtion is met. If not, then it defaults back to "X" number. So for example:

If P1 is > 0.05mm, then P2=35mm. If P1 is < 0.05mm, then P2=5mm.

Is this possible in NX5? I'm building an assembly that depends on 2 or 3 parts all moving together when I change a sketch expression (or attempting to atleast). If it is possible, what is the proper syntax to use for the above example?

I've always just manually adjusted all the parts when we do assemblies like this, but it would be pretty neat to automate the process a little.

thanks a lot.

 
Replies continue below

Recommended for you

If you have Pro/E experience, the expression editing can be done in NX, but it is different from how you do it in Pro/Program.
You can do what you want with GRIP or Knowledge Fusion.


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

Ben Loosli
 
No problem. See the attached NX 5.0 part file (go to the Expression dialog). However, you never told us what you wanted to do if P1 is exactly 0.50mm. So I wrote the expressions assuming that the logic is: IF P1 is equal to OR greater than 0.50mm, P2 equals 35mm. IF P1 is less than 0.50mm, P2 equals 5mm.

Anyway, take a look. It should be east to figure out once you've seen it done once.

John R. Baker, P.E.
Product 'Evangelist'
Product Design Solutions
Siemens PLM Software Inc.
Industry Sector
Cypress, CA

To an Engineer, the glass is twice as big as it needs to be.
 
Outstanding, John. Once again, your help is invaluable. I cannot thank you enough. I'm sure this will impress our customers as well lol

thanks for the help aswell looslib, I appreate you taking the time to respond
 
John, can you do the same in an NX4 part?


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

Ben Loosli
 
For the record, the IF statement was added to the Expression system in NX 3.0 when we introduced 'Design Logic', which included, among other things, a major enhancement of the Expression system.

John R. Baker, P.E.
Product 'Evangelist'
Product Design Solutions
Siemens PLM Software Inc.
Industry Sector
Cypress, CA

To an Engineer, the glass is twice as big as it needs to be.
 
Speaking of Design Logic, in my notes from PLMworld 2005, I have reference to Engineering Handbook type functions that are built into Design Logic (expressions) from your demonstration John. How do you access these functions? I assumed it includes calculations like these:
 
You can access those functions from within the Expression system by going to the bottom of the dialog and selecting the button with the f(x) label. What you will find there are several categories of functions, which include items you're probably already using such as pi() and the various trig functions. Note that this is not all that different than accessing the 'Formulas' option in Excel, only we've included more engineering related functions, which are really predefined KF routines. Many of these were taken directly from popular Engineering references such as Roark's 'Formulas for Stress and Strain' and others.

Now as for MITCalc, it would appear that what we've done in NX is somewhat similar, just not as comprehensive or as diversified.

However that being said, we are soon going to provide an interface to a 3rd party 'engineering solver', which will be integrated into the NX Expression system. For NX 7.5, we are going to provide an integrated two-way portal between NX and the technical computing software package, 'Maple 13', from Maplesoft, Inc.

For some details as to what this will mean and what our expectations are, please go to:


And for more information about 'Maple 13' itself, go to:


John R. Baker, P.E.
Product 'Evangelist'
Product Design Solutions
Siemens PLM Software Inc.
Industry Sector
Cypress, CA

To an Engineer, the glass is twice as big as it needs to be.
 
Ok, John, I tried the equation that you gave and it's giving me an error.

I believe this is because I'm mixing angles and lengths. P1 (in the example) is an angle where P2 represents a length (component offset distance). So essentally what I'm looking for is when the angle of two parts is less than 0.5 degrees, another part sets it's offset accordingly.

The exact error it gives is:

"Error

Dimension mismatch (binary operation)

Attempt to use the ">=" opperation on Angle and Length.
Expression:
p32=IF(P44>=.5)(1.25)else(13.25)"


Any ideas on how to correct this? I changed the example you gave to apply it to our actual project. I should note (not sure if it makes a difference though) that P32 is controlled by a sketch that acts as a mating "skeleton" for the assembly. P44 is a regular "named" expression.

thanks
 
Attached is a modified version of my original example. What you do in a case like that is create an intermediary Expression which has the 'Dimensionality' of 'Constant' and use it instead in the final expression. This will 'insulate' the Units of first expression from the Units of the second yet still give you the correct results. You will see what I mean when you look at the part file.

John R. Baker, P.E.
Product 'Evangelist'
Product Design Solutions
Siemens PLM Software Inc.
Industry Sector
Cypress, CA

To an Engineer, the glass is twice as big as it needs to be.
 
outstanding, thanks john. I had originally tried that but got an error (noticed you had P3 set as 'constant' under units). We changed that and now it works great.


thanks again for all the help. It's appreciated
 
Yes, there are times when using a 'Constant' expression in logic statements makes much more sense. In this case, as I said, it tends to 'insulate' Expressions using one of set of units from Expressions using another.

John R. Baker, P.E.
Product 'Evangelist'
Product Design Solutions
Siemens PLM Software Inc.
Industry Sector
Cypress, CA

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