You are on page 1of 13

Lesson

8 Expressions

Purpose

This lesson is a fundamental introduction to Expressions.

Objectives

Upon completion of this lesson, you will be able to:


• Create Expressions.

• Edit Expressions.

©UGS Corpora tion, A ll Rights Rese rve d Modeling NX4 8 -1


Expressions

Overview
Expressions are arithmetic or conditional formulas that define the
characteristics of a part. Expressions define the dimensions and relationships
of a model.
Expressions are automatically created when:
• a feature is created.

• a sketch is dimensioned.

• a feature is positioned.

All expressions have a single, unique name and a string or formula that
can contain a combination of variables, functions, numbers, operators, and
symbols.
Expression names are variables that you can insert in the formula strings of
other expressions. This can be helpful in breaking up lengthy formulas as
well as defining relationships that can be used in place of numbers.
Expression formulas are evaluated for values.
Here are some examples of expressions, their formulas and their resulting
values:

Expression Name Formula Value


6 length 5*width 20
p39 (Extrude(6) End Limit) p1+p2*(2+p8*sin(p3)) 18.849555921
p26 (Simple Hole(9) Tip Angle) 118 118

Expression names are no longer case sensitive, with the following


exceptions:
• Expression names are case sensitive if their dimensionality is
set to Constant.
• Expression names are case sensitive if they were created before
NX 3.

When expression names are case sensitive, they must be referenced


exactly when used in other expressions.

8- 2 Modeling NX4 ©UGS C orporation , All Rights Rese r ve d br10050_g NX 4


Expressions

Creating and Editing Expressions


To work with expressions, choose Tools→Expression.

The Expressions Dialog with Less Options

1 Expression Name Up to 132 letters, numbers, or underscor e.


M ust begin with a letter.

Case Sensitive.
2 Formula Can contain a combination of numbers,
functions, operators, and other expression 6
name s.
3 Dimensionality Choose from Constant, Length, Area, Volume,
Mass, and many others
4 Units Units appropriate to the dimensionality will be
available in a pull-down.
The system will handle unit conversions
automatically if, for example, you specify
inches in a metric part.
Not active during editing or if dimensionality
is constant.
5 More Options

©UGS Corpora tion, A ll Rights Rese rve d Modeling NX4 8 -3


Expressions

The Expressions Dialog with More Options

6
1 Listed Choose from User Defined, Named, Filter by
Expressions Name, Filter by Value, Filter by Formula ,
Unused Expressions, Object Parameters,
Measurements, and All
2 Expression list List contains columns for Name (followed by
usage in the part), Formula, Value, Units, and
Comment
3 Accept Edit
4 Reject Edit
5 Less Options

8- 4 Modeling NX4 ©UGS C orporation , All Rights Rese r ve d br10050_g NX 4


Expressions

Creating Expressions

There are three methods to create expressions:


• System generated expressions (p#).

• User defined expressions created during text input (Rad=5.00).

• Predefined, user created expressions (Thk=0.60, Thk used as a text entry


in a parameter field).

Procedure:
• Choose the Dimensionality and Units for the expression.

• Key in the name of the expression in the Name field and press the
<Enter> key.

• Key in the formula for the expression in the Formula field and press the
<Enter> key.

• Choose Apply or OK to save the expression.

After keying in the name of the expression the <Tab> or = key can be
used to advance the cursor to the Formula field.

Editing Expressions 6
Procedure:
• Display the Expressions dialog with More Options.

• Choose the expression to modify from the expression list. The expression
will be displayed in the Name and Formula field s.

• Modify the Name, Formula, or Units of the expression.

• Press the <Enter> key or the Accept Edit icon.

• Choose Apply or OK to save the expression.

Editing the name of an expression will also edit the formula of any
expression that references it.

©UGS Corpora tion, A ll Rights Rese rve d Modeling NX4 8 -5


Expressions

Listing Expressions Associated with Features


It is often necessary to determine which expressions control which features in
a model. If the Listed Expressions option is set to All, all of the expressions in
the part are listed. If an expression defines a feature, the feature name is
listed with it (i.e. p8 (Simple Hole(5) Diameter).
All of the expressions associated with a feature may also be listed in an
Information window by choosing Information? Feature and selecting the
feature or MB3? Information in the Part Navigato r.

List Referencers
The List Referencers option provides a means of finding out if an expression
is referenced in another expression and what feature(s) use the expression.
To use this option, select the expression, and choose List Referencers from
the MB3 pop-up menu.

8- 6 Modeling NX4 ©UGS C orporation , All Rights Rese r ve d br10050_g NX 4


Expressions

Specifying Formulas while Creating Features


The Expressions dialog may be accessed while creating a feature by choosing
Formula from the parameter entry option menu. This will allow you to
specify a complex formula for the expression that is generated for the
feature paramete r. Parameter entry options are available with many of the
parameter entry fields throughout the Modeling application.

©UGS Corpora tion, A ll Rights Rese rve d Modeling NX4 8 -7


Expressions

Activity — Getting Familiar with Expressions

In this activity, you will create user-defined expression s.


Step 1: Open the expression_1 part.

Step 2: Start the Modeling application.

Step 3: Examine the Expressions of the Block.


Choose Tools? Expression.

Cha nge the Listed Expressions option to All.

The dialog lists all of the expressions in the part. Notice the
default expression names p0, p1, and p2 whi ch define the block.

Step 4: Delete the Block.

Choose the Delete icon from the Standard toolbar.


(Edit→Delet
e)

Select the block in the graphics window and choose OK .


8- 8 Modeling NX4 ©UGS C orporation , All Rights Rese r ve d br10050_g NX 4
Expressions

Step 5: Create a new Block.


Choose Insert? Design Feature? Block.

Choose Origin, Edge Lengths.

Key in the following expressions:

Length (XC) = length=8


Width (YC) = width=6
Height (ZC) = height=6/2

Choose OK.

Step 6: Examine the Expressions for the newly created Block.


Choose Tools→Expression.
Notice the expressions height, length, and width. These
expressions are referenced in the formulas of the expressions
defining the block.

©UGS Corpora tion, A ll Rights Rese rve d Modeling NX4 8 -9


Expressions

Cha nge the Listed Expressions option to Named.

This lists only the expressions in the part that you explicitly
named.
The formula for height is a constant numeric value 6/2. The
desired design intent is that the height grows proportionally
with the width. This relationship could not be established upon
creation as the width expression was not in existence.

Step 7: Edit the expression.


Select the height expression from the Expressions list. This
will fill in the Name and Formula field s.
6

8- 1 0 Modeling NX4 ©UGS C or poration , All Rights Re serve d br10050_g NX 4


Expressions

Key in a new formula for the expression width/2 and press


Enter.

The formula for the expression height is now changed to


width/2. Any time that the width changes, the height value
will change accordingly.

Step 8: Change the width value.


Select the width expression.

Key in 4 for the formula and press Enter.

Choose OK.
The block will update with the new width and height.
6
Step 9: Close the part.

©UGS C orporation , All Rights Rese r ve d Modeling NX4 8- 11


Expressions

Summary
Expressions are algebraic or arithmetic statements used to control the
characteristics of a part. All expressions have a name, a formula, and a value
and are used to define the dimensions and relationships of a model.
In this lesson you:
• Created Expressions.

• Edited Expressions.

8- 1 2 Modeling NX4 ©UGS C or poration , All Rights Re serve d br10050_g NX 4

You might also like