Sunteți pe pagina 1din 33

Equations

Define dimensions using global variables and mathematical functions, and create mathematical relationships between two
or more dimensions in parts and assemblies.
You can use the following as variables in equations:
• Dimension names
• Global variables
• Other equations
• Mathematical functions
• File properties
• Dimension measurements

You can use any supported operators, functions and constants.

CONTENTS
• Accessing the Equations Dialog Box
• Using the Equations Interface

The Equations, Global Variables and Dimensions dialog box includes several different views that you can use to
create and manage your equations.

• Create and Edit Equations in the Equations Dialog Box

You can use the Equations dialog box to create, edit and delete equations, and to assign equations to different
configurations of a part or assembly. Global variables and equations are available in one place, and flyout menus help
you create global variables and equations more quickly and accurately.

• Global Variables

You can create global variables to use in equations. You define global variables in the Equations dialog box. For
example, Well_Volume = 20000.

• Configuring Equations

You can configure equations and global variables in the same way as you configure dimensions.

• Linked Values

Use linked values (also referred to as shared values or linked dimensions) to link two or more dimensions without
using equations or relations. When dimensions are linked in this way, any member of the group can be used as a
driving dimension. Changing any one of the linked values changes all others to which it is linked.

• Share Equations Among Models

You can share equations and global variables among models.

• Create Equations in the Modify Dialog Box

When working on a model, you can enter equations and global variables directly in the Modify dialog box for
dimensions. You do not have to open the Equations, Global Variables, and Dimensions dialog box to create an
equation for a part or component.

• Equations in Assemblies
The equation syntax for references between assembly components loads automatically when you select dimensions,
features, and global variables in the FeatureManager design tree, the graphics area, File Properties, and
the Equations dialog box.

• Design Tables and Equations

When you enter equation and global variables in a design table, the equations and global variables are automatically
reflected in the Equations dialog box.

• Direct Input of Equations in PropertyManagers

For many features, you can enter and modify equations directly in PropertyManager fields that allow numerical inputs.
You can create equations with global variables, functions, and file properties without accessing the Equations, Global
Variables and Dimensions dialog box.

• Equations with Exponents of Negative Numbers or Variables


• Replacing Equation References for Deleted Features

If you delete a feature that is referenced by equations, you might have errors in your equations. These errors occur
when the equations for a deleted feature contain driving dimensions. You can repair the equations by replacing the
dangling portion of the equations with other dimensions or variables in the Equations dialog box.

Accessing the Equations Dialog Box


Display the Equations, Global Variables and Dimensions dialog box by doing one of the following:

• Click Equations (Tools toolbar).


• Click Tools > Equations.

• Right-click the Equations folder in the FeatureManager design tree, and select Manage Equations.

Using the Equations Interface


The Equations, Global Variables and Dimensions dialog box includes several different views that you can use to create
and manage your equations.

CONTENTS
• Four Views of Equations

The Equations dialog box offers four views. Each view shows a different combination and sequence of equations,
global variables and dimensions to help you perform tasks such as finding a specific equation, viewing all dimensions
used in a part or assembly, and changing the order in which equations are solved.

• Disabling and Enabling Equations in All Configurations

You can disable and enable equations in the Equation View , Sketch Equation View , or Ordered View in
the Equations, Global Variables, and Dimensionsdialog box.

• Sort and Filter Equations

Sorting and filtering capabilities make it much easier to find equations and global variables and see how they are
related. Sorting and filtering work in all views of the Equations dialog box.
• Selecting Multiple Rows

You can select multiple rows in the Equations dialog box to perform the same task on all of the equations, for example
to delete several equations at once.

• Undo and Redo

You can undo and redo steps by clicking Undo and Redo at the top of the Equations dialog box.

• Type-Ahead Entry

When you enter an equation in the Equations dialog box and type in one or more characters, a type-ahead feature
displays a drop-down list showing all global variables, mathematical functions, and file properties that start with those
characters. You can select an entry from the drop-down list instead of typing the entire entry.

• Increment Values with Spin Arrows

You can quickly increment or decrement values in equations using the spin arrows that appear at the end of a numeric
input field.

• Navigate Table Cells

In the Equations dialog box, you can navigate from cell to cell, across rows, and columns using the following keys:

• Syntax Checking with Color Coding

The Equations dialog box includes syntax checking to avoid errors and reduce the time you spend on troubleshooting
mistakes.

• Automatic Solve Order Option

You can use the Automatic Solve Order option to automatically sequence the equations in an order determined by the
software to produce accurate results.

• Circular Reference Warnings

SOLIDWORKS identifies circular references, highlights the equations in red, and displays a warning.

• Linking to a Text File

In the Equations dialog box, you can link to an external text file that contains equations and global variables. You can
use this option in place of the import and export functions when you want to set up an ongoing link. However, you
cannot use it for a one-time import or export.

• Suppressing Features

You can suppress features in the Equation View and Dimension View to help you troubleshoot equations.

• Components with Multiple Instances

The Equations dialog displays components that are referred by unique instance numbers. You can apply equations to
specific instances. This ensures there is no ambiguity about the instance referenced in each equation.

• The Measure Option

You can use the Measure... option to create a driven dimension or reference dimension that is based on a
measurement of the part or assembly.
Four Views of Equations
The Equations dialog box offers four views. Each view shows a different combination and sequence of equations, global
variables and dimensions to help you perform tasks such as finding a specific equation, viewing all dimensions used in a
part or assembly, and changing the order in which equations are solved.
To select a view:
• Click the Equation View to see all global variables and equations for dimensions and features.

• Click the Sketch Equation View to see global variables and equations used in sketches.

• Click the Dimension View to see all global variables, equations, and dimensions used in the active part or
assembly, whether they are associated with an equation or not.

• Click the Ordered View to see global variables and equations in the order they are solved.
PARENT TOPICUsing the Equations Interface

Equation View
The Equation View displays all global variables and equations for a part or assembly.

In this view, you can add global variables and equations, edit and delete existing ones, and add comments.

You can also suppress features to help you troubleshoot equations.

Sketch Equation View


The Sketch Equation View displays global variables and equations used only in sketches.

Sketch equations differ from equations used in parts and assemblies. When you add or edit an equation to an active
sketch, geometric relations between sketch entities are automatically applied, related equations are solved, and the
sketch automatically updates. With equations used in parts and assemblies, the model does not update until you rebuild.

Dimension View
The Dimension View displays all the dimensions used in the active sketch, part or assembly, including those with a
set value and those determined by equations. This view makes it easy to rename or change the values of several
dimensions.
Dimensions with a set value are visible only in this view, not in the Equation View, the Ordered View or
the Sketch Equation View.
In the Name column, names of global variables, features, and equations are enclosed in quotation marks,
while the names of dimensions are not. In the Value/Equation column, dimensions determined by equations
start with = (equal sign), while dimensions with a set value do not start with =.

There are two versions of the Dimension View, one for parts, and one for assemblies.
In the Dimension View for a part, you can:
• Add global variables, and rename, edit and delete existing ones.
• Suppress features.
• Rename and change dimension values or add equations to dimensions.
• Add comments to global variables and features, and to dimensions that have equations.
In addition, in the Dimension View for an assembly, you can:
• Add equations for components, and rename, edit and delete existing ones.
• Rename and edit top-level dimensions of the assembly.

The Dimension View lists dimensions used in sketch equations with an icon. The icon helps you to identify
sketch dimensions from other dimensions used for parts and assemblies.

Ordered View
The Ordered View displays equations and global variables in the order they are solved.

In this view you can change the order of the equations and global variables, if the Automatic solve orderoption is clear.
You can also add new equations and global variables, and rename, edit, and delete existing ones.

Disabling and Enabling Equations in All


Configurations
You can disable and enable equations in the Equation View , Sketch Equation View , or Ordered View in
the Equations, Global Variables, and Dimensions dialog box.

The equations are disabled in all configurations. You can enable the equations if no other active equation controls the
same parameter.

1. To disable equations, in Equations, Global Variables, and Dimensions dialog box, in any view, right-click an equation
and click Disable Equation.

The equation disappears from the view. Ordered View retains all equations. The disabled equations are
unavailable.

2. To enable a disabled equation, in the Equations, Global Variables, and Dimensions dialog box, click Ordered
View .

3. Right-click the equation and click Enable Equation.

The equation reappears in all views where it previously appeared.

In Dimension View , you can enable and disable Global Variables and Features, but not Dimensions.

You can also disable or enable an equation across all configurations by specifying a unique identifier (Relation ID) in a
design table. This functionality is available when the Display unique equation identifier option is selected in System
Options > Display. See Design Tables and Equations.

Sort and Filter Equations


Sorting and filtering capabilities make it much easier to find equations and global variables and see how they are related.
Sorting and filtering work in all views of the Equations dialog box.
PARENT TOPICUsing the Equations Interface
Sorting
1. Select any view in the Equations dialog box.

2. Click any column heading. A small arrow appears on the right side of the cell.

3. Click once to sort in ascending order.

4. Click a second time to sort in descending order.

5. Click a third time to return the rows to the original order.

Creating a Filter
1. Select any view in the Equations dialog box.

2. Enter your filter criteria in the Filter field and press Enter.

The filter returns results that contain characters in any column. For example, entering ov might return the global
variable overall length, an equation that includes overall length as one of its terms, and another equation that
has a comment Don’t overlook the ring.

3. Continue to enter criteria until you find the desired global variable, feature, or equation.

4. Clear the filter by clicking X in the Filter field.

Selecting Multiple Rows


You can select multiple rows in the Equations dialog box to perform the same task on all of the equations, for example to
delete several equations at once.

To select multiple rows, position the cursor in the left-most column of a row. A small arrow appears in the cell.
Do one of the following:
• Select several rows by dragging the cursor up or down in the left-most column.
• Ctrl + click the left-most column in one or more rows.
• Shift + click the left-most column in the last of a series of rows.
Then right-click to display a menu and select one of the available tasks.

Undo and Redo


You can undo and redo steps by clicking Undo and Redo at the top of the Equations dialog box.

Undo and Redo are available in all views. You can undo and redo any edits that you perform since invoking the
dialog box.
If you change configurations while in the Equations dialog box, Undo and Redo lists are reset. Prior steps cannot be
undone or redone.

Type-Ahead Entry
When you enter an equation in the Equations dialog box and type in one or more characters, a type-ahead feature
displays a drop-down list showing all global variables, mathematical functions, and file properties that start with those
characters. You can select an entry from the drop-down list instead of typing the entire entry.

Increment Values with Spin Arrows


You can quickly increment or decrement values in equations using the spin arrows that appear at the end of a numeric
input field.
For example, use the following keys or key combinations:
• Click the Up or Down arrow to change the value by 10. For example, if the value is 10.00mm, click the Up arrow
to increase it to 20.00mm.
• Press Alt+Up or Alt+Down arrow to change the value by 1. If the value is 10.00mm, Alt+Up increases the value to
11.00mm.
• Press Ctrl+Up or Ctrl+Down arrow to change the value by a 100. If the value is 10.00mm, Ctrl + Up increases the
value to 110.00mm
The units of the Spin Box Increments may vary depending on the settings specified in System Options.

Navigate Table Cells


In the Equations dialog box, you can navigate from cell to cell, across rows, and columns using the following keys:
• Enter
• Shift + Enter
• Tab
• Shift + Tab

Syntax Checking with Color Coding


The Equations dialog box includes syntax checking to avoid errors and reduce the time you spend on troubleshooting
mistakes.
When you enter text into the Name and Value/Equation columns, the text color varies depending on these conditions:
• Valid global variables, features and dimensions appear in blue.
• Incomplete and invalid text displays in red.
• Potentially invalid text, for example text that may include a circular reference, is displayed in yellow. A yellow
warning icon is also displayed in the row.
• Valid operators, functions, and other inputs appear in black.

Positioning the cursor over the yellow or red text displays a warning message. Clicking the warning icon displays a What’s
Wrong window describing the issue or error.

Automatic Solve Order Option


You can use the Automatic Solve Order option to automatically sequence the equations in an order determined by the
software to produce accurate results.

When you select the Automatic Solve Order option in the Equations, Global Variables, and Dimensions dialog box, the
SOLIDWORKS software identifies dependencies and orders equations so that independent equations are executed
before dependent equations. That is, if equation B is defined as a function of equation A, then equation A always needs to
be solved first.

For example, in the following two equations, the software evaluates “D2@Sketch1@part_inside.Part” first, so it
can safely be used as a variable in the equation for "D1@Sketch1@part_outside.Part".

“D1@Sketch1@part_outside.Part” = “D2@Sketch1@part_inside.Part” + 2

“D2@Sketch1@part_inside.Part” = “Side” - 6

You can view the solve order in the Ordered View of the Equations, Global Variables, and Dimensions dialog box.
You must clear this option to manually change the order of the equations

Circular Reference Warnings


SOLIDWORKS identifies circular references, highlights the equations in red, and displays a warning.

For example, the following equations include a circular reference. The changes in the first equation cause changes in the
second equation, which cause further changes in the third and first equation, creating an infinite loop. SOLIDWORKS
detects the circular reference and displays the text of the equations in red.

“D1@Sketch1@part_outside.Part” = “D2@Sketch1@part_inside.Part” + 2

“D2@Sketch1@part_inside.Part” = “Side” - 6

“Side” = “D1@Sketch1@part_outside.Part” * .5

SOLIDWORKS also identifies potential circular references, highlights the equations in yellow, and displays a warning .
Potential circular references occur when a reference dimension or driven dimension might depend on a dimension defined
earlier in the FeatureManager design tree.
PARENT TOPICUsing the Equations Interface

Controlling the Display of Messages for Circular References


You can control the display of messages about circular references and potential circular references caused by equations.
1. Click Options (Standard Toolbar) or click Tools > Options.
2. On the System Options tab, click Messages/Errors/Warnings.
3. For Display circular references in equations, select to display the error messages:
• Everywhere
• In equation dialog only
• Never
4. For Display potential circular references in equations, select to display the warning messages:
• Everywhere
• In equation dialog only
• Never

Linking to a Text File


In the Equations dialog box, you can link to an external text file that contains equations and global variables. You can use
this option in place of the import and export functions when you want to set up an ongoing link. However, you cannot use
it for a one-time import or export.

Suppressing Features
You can suppress features in the Equation View and Dimension View to help you troubleshoot equations.

Components with Multiple Instances


The Equations dialog displays components that are referred by unique instance numbers. You can apply equations to
specific instances. This ensures there is no ambiguity about the instance referenced in each equation.

For example, the following equations refer to the same part BigAndSmall, which has instances <1> and <2>. In
the Equations dialog, you can select which instance to apply to an equation.

"HoleWidth@Sketch1" = "Width@Sketch1@BigAndSmall<2>.Part"

"HoleDepth@Cut-Extrude1" = "Depth@Boss-Extrude1@BigAndSmall<1>.Part" / 2.0

"HoleWidthOffset@Sketch1" = ("Width@Sketch1@BigAndSmall<1>.Part" / 2) -
("Width@Sketch1@BigAndSmall<2>.Part" / 2)

The instance number is always enclosed in < > angle brackets.

In previous releases, the software did not display the instance number. Instead, it selected the latest instance and action
that was available in memory.
PARENT TOPICUsing the Equations Interface

Displaying Equations with Multiple Instances


If you are working with equations from SOLIDWORKS 2011, you might encounter errors in the Equations dialog box if
both of the following conditions apply:
• A part or component referenced by the equations has multiple instances in the model.
• The equations are linked to an external file.

The instance numbers are not initially reflected in the external file. To resolve this discrepancy, update the external file by
exporting the equations to the external file and rebuilding the model.

Resolving Multiple Instance Issues


To resolve multiple instance issues:

1. In any of the views of the Equations dialog box, click Export.

The Export Equations dialog box appears. This dialog box includes two columns. The first column indicates the
equations that will be exported to a text file. The second column indicates the equations that will be linked between
the model and the text file, so that changes are replicated in both. By default, all equations are exported and linked.

2. In the Export Equations dialog box, leave all the check boxes selected and click Export.

Link to external file is selected in the Equations dialog box. The file path for the text file also appears.

3. Click Rebuild and then click Open .

The instance numbers display in the text file as intended.


The Measure Option
You can use the Measure... option to create a driven dimension or reference dimension that is based on a measurement
of the part or assembly.
The value of this dimension might change if the model changes. For example, if an equation includes a measurement of
the height of a part, and that height is doubled, then the equation evaluates to twice the previous value.

The Measure option is available from all four views of the Equations dialog box, and also from the Modify dialog box.

You can select the Measure... option from the flyout menu when you are in the Value/Equation column creating or editing
global variables, features, equations, and dimensions. It appears in the flyout menu whenever a measurement is valid.

Create and Edit Equations in the Equations


Dialog Box
You can use the Equations dialog box to create, edit and delete equations, and to assign equations to different
configurations of a part or assembly. Global variables and equations are available in one place, and flyout menus help you
create global variables and equations more quickly and accurately.

CONTENTS
• Adding an Equation

You can add an equation to a part or assembly using the Equation View, Dimension View, or Ordered View.

• Adding a Sketch Equation

You can add an equation to sketch entities using the Sketch Equation View.
• Editing an Equation
• Deleting an Equation
• Operators, Functions, and Constants
• Specifying Units of Measurement

You can specify the units of measurement for global variables, and for the values and equations that define the global
variables. You can define the units in the Equations and Modify dialog boxes for dimensions, and in PropertyManagers
that support equations.

• Using the Measure Option


• Changing Dimensions by Configuration

If a part has several configurations, you can decide whether changes to a dimension will affect one configuration, all
configurations, or selected configurations.

• Suppressing Features in the Equations Dialog Box

You can define equations that conditionally suppress features. You can also suppress features directly in
the Equations dialog box.

• Visual Basic If Function

You can also use the Visual Basic If function when specifying a model dimension.

Adding an Equation
You can add an equation to a part or assembly using the Equation View, Dimension View, or Ordered View.

To add an equation in the Equation View:

1. Do one of the following:

• Click Equations (Tools toolbar).


• Click Tools > Equations.

• Right-click the Equations folder in the FeatureManager design tree, and select Manage Equations.

2. Select the Equation View .

3. In the Equations section, click an empty cell in the Name column.

4. Click a dimension in the graphics area.

The SOLIDWORKS software does the following:

• Propagates the dimension name to an empty cell in the Name column and encloses it in quotation marks.
• Moves the cursor to the Value/Equations column and inserts = (equal sign).
• Displays a flyout menu with options for starting the equation.

5. After = (equal sign), add a term to the equation by doing one of the following:

• Type a number or a conditional statement.


• Select a Global Variable, Function or File Property from the flyout menu.
• Select Measure ... from the flyout menu and use the Measure Tool to create the term.
A appears in the cell to indicate that the syntax is valid.
6. Type + (plus), - (minus) or another mathematical symbol.

7. Add another term to the equation.

8. When the equation is complete, click .

The solution to the equation appears in the Evaluates to column and the cursor moves to the next cell in
the Comments column.

9. Add comments to document your design intent.

10. Click OK to close the dialog box.

Adding a Sketch Equation


You can add an equation to sketch entities using the Sketch Equation View.

To add an equation in the Sketch Equation View:

1. In an open sketch, do one of the following:

• Click Equations (Tools toolbar).


• Click Tools > Equations.

• Right-click the Equations folder in the FeatureManager design tree, and select Manage Equations.

2. Select the Sketch Equation View .

3. Under Sketch Equations, click an empty cell in the Name column.

4. Click a dimension in the graphics area.

The SOLIDWORKS software does the following:

• Propagates the dimension name to an empty cell in the Name column and encloses it in quotation marks.
• Moves the cursor to the Value/Equations column and inserts = (equal sign).
• Displays a flyout menu with options for starting the equation.

5. After = (equal sign), add a term to the equation by doing one of the following:

• Type a number or a conditional statement.


• Select a Global Variable, Function or File Property from the flyout menu.
You must define a global variable in the Equation View before you can apply it to a sketch equation.

6. A appears in the cell to indicate that the syntax is valid.

7. Type + (plus), - (minus) or another mathematical symbol.

8. Add another term to the equation.

9. When the equation is complete, click .

The solution to the equation appears in the Evaluates to column and the cursor moves to the next cell in
the Comments column.
10. Add comments to document your design intent.

11. Click OK to close the dialog box.

Editing an Equation
When editing, keep the following in mind:
• Dimension names must be enclosed in quotes.
• Equations are solved left to right (that is, the dimension on the left is driven by the value on the right).
• Equations are solved in the order in which they appear in the Ordered View. You can change the order, if necessary.

To edit an equation:

1. Do one of the following:

• Click Equations (Tools toolbar).


• Click Tools > Equations.

• Right-click the Equations folder in the FeatureManager design tree, and select Manage Equations.

2. Select the Equation View .

3. Select an equation, global variable or dimension.

4. Edit the entry.

Use the type-ahead entry, flyout menu of Equations, Global Variables, Functions and File Properties, and syntax
checking to edit the equation.

If you make a mistake, click Undo to clear each consecutive edit. You can clear one edit each time you
click Undo.

5. Click OK to close the dialog box.

Deleting an Equation
To delete a global variable or an equation from any view:
1. Select one or more rows, containing the global variables or equations you want to delete and right-click.
2. From the flyout menu, select Delete or the Delete key.
3. Click OK to close the Equations dialog box.
Deleting a global variable or equation may cause other equations that include the global variable or equation to become
invalid. Syntax checking identifies this situation immediately by displaying a warning symbol and displaying the deleted
term in red anywhere it appears in the Value/Equation field. This can dramatically reduce the time needed to detect and
troubleshoot orphaned equations.
Operators, Functions, and Constants
When you use trigonometric functions in equations, specify the angular units by selecting Degrees or Radians in Angular
Equation Unitsin the Equations dialog box.

Name Notes

Operator

+ plus sign addition

- minus sign subtraction

* asterisk multiplication

/ forward dash division

^ caret exponentiation

Function

sin (a) sine a is the angle; returns the sine ratio

cos (a) cosine a is the angle; returns the cosine ratio

tan (a) tangent a is the angle; returns the tangent ratio

sec (a) secant a is the angle; returns the secant ratio

cosec (a) cosecant a is the angle; returns the cosecant ratio

cotan (a) cotangent a is the angle; returns the cotangent ratio

arcsin (a) inverse sine a is the sine ratio; returns the angle

arccos (a) inverse cosine a is the cosine ratio; returns the angle

atn (a) inverse tangent a is the tangent ratio; returns the angle

arcsec (a) inverse secant a is the secant ratio; returns the angle

arccosec (a) inverse cosecant a is the cosecant ratio; returns the angle

arccotan (a) inverse cotangent a is the cotangent ratio; returns the angle

abs (a) absolute value returns the absolute value of a


Name Notes

exp (n) exponential returns e raised to the power of n

log (a) logarithmic returns the natural log of a to the base e

sqr (a) square root returns the square root of a

int (a) integer returns a as an integer

sgn (a) sign returns the sign of a as -1 or 1

For example: sgn(-21) returns -1

Constant

pi pi ratio of the circumference to the diameter of a circle (3.14...)

Specifying Units of Measurement


You can specify the units of measurement for global variables, and for the values and equations that define the global
variables. You can define the units in the Equations and Modify dialog boxes for dimensions, and in PropertyManagers
that support equations.

Assigning units of measure in equations ensures that you do not need to edit the equations if you change the unit of
measure property of a document. It also allows you to create equations that mix values with different units of
measurement.

For example, you can create a global variable Length and define it by the equation: =100in + 3mm + 5cm. The
equation includes values with three different units of measurement. If the unit of measurement of the document is inches,
then Length evaluates to 102.087in. If you change the unit of measurement of the document to millimeters,
then Length automatically evaluates to the value of 2593mm. You do not need to edit the equation, or be concerned that
the size of the part will change.

If the part or assembly has multiple configurations, you can also specify a different unit of measurement for each
configuration. For example, you can have one configuration where a global variable is expressed in millimeters and
another where it is expressed in inches.

In the Equation and Modify dialog boxes, type-ahead lists help you assign a valid unit of measurement to each value in an
equation.

Using the Measure Option


To use the Measure option when creating or editing an equation:

1. Do one of the following:

• Click Equations (Tools toolbar).


• Click Tools > Equations.
• Right-click the Equations folder in the FeatureManager design tree, and select Manage Equations.

2. Select the Equations View .

3. In the Equations section, click an empty cell in the Name column.

4. Click a dimension in the graphics area.

The SOLIDWORKS software does the following:

• Propagates the dimension name to the empty cell in the Name column and encloses it in quotation marks.
• Moves the cursor to the Value/Equations column and inserts = (equal sign).
• Displays a flyout menu with options for starting the equation.

5. In the flyout menu, select Measure….

6. In the graphics area, select the references to create a reference dimension.

7. In the Dimension PropertyManager, make any changes to the parameters of the dimension and click .

The new dimension appears as part of the equation.

Changing Dimensions by Configuration


If a part has several configurations, you can decide whether changes to a dimension will affect one configuration, all
configurations, or selected configurations.

To specify configurations affected by a change in dimensions:

1. Select the Dimension View in the Equations dialog box.

2. Edit the Value/Equations field for the dimension.

If the dimension applies to more than one configuration, a configuration icon appears in the row.

3. From the flyout menu, select from the following choices:

• This Configuration
• All Configurations
• Specify Configurations

4. Click OK to close the dialog box.

Suppressing Features in the Equations


Dialog Box
You can define equations that conditionally suppress features. You can also suppress features directly in
the Equations dialog box.

To suppress features from the Equations dialog box:


1. Do one of the following:
• Click Equations (Tools toolbar).
• Click Tools > Equations.

• Right-click the Equations folder in the FeatureManager design tree, and select Manage Equations.

2. Select the Equations View .


3. Suppress the a feature:
a. In the Equations dialog box, in the Features section, click an empty cell.
b. In the FeatureManager design tree, click the feature to suppress.
The feature name appears in the Features section. The SOLIDWORKS software populates the next cell
with = (equals sign) and displays a drop-down list with options for Global Variables, Functions, File Properties,
and Measure.

c. Expand Global Variables, select suppress, and click .

Suppressed is added to the Evaluates to column.


You can also conditionally suppress features by using the syntax of the Visual Basic if function.
4. Click OK.

Visual Basic If Function


You can also use the Visual Basic If function when specifying a model dimension.

This function returns one of two values depending on the evaluation of an expression.

For example, if the equation specified is "D1@Sketch1" = (If("D1@Sketch4">15, 20, 10)) + 8, then:

If "D1@Sketch4" is ... Then "D1@Sketch4">15, 20, 10 is set to And "D1@Sketch1" is set to ...

> 15 20 28

<= 15 10 18

Global Variables
You can create global variables to use in equations. You define global variables in the Equations dialog box. For example,
Well_Volume = 20000.
You can:

• Define global variables using other global variables and dimensions. For example, Height =
"Well_Volume"/(pi*("D1@Sketch4"/2)^2)).
• Drive dimensions using global variables. For example, D1@Extrude1 = "Height".
• Share global variables among models.
• Configure global variables.
Global variables and their current values appear:

• In the Equations dialog box.

• In the Equations folder in the FeatureManager design tree.


• Under Value/Text Expression on the Custom tab in the Summary Information dialog box.
• Under Value/Text Expression in the Weldment dialog box.
PARENT TOPICEquations

RELATED CONCEPTS

Share Equations Among Models

Global Variables in Configurations

RELATED TASKS

Linking Dimensions Using Global Variables

Using Global Variables Instead of Linked Values


Global variables can be used for many of the same purposes as linked values (also referred to as shared values or linked
dimensions). Global variables are much easier to find, change, and manage than linked values.

To use a global variable to link dimensions:


1. Create a global variable in the Equations dialog box or the Modify dialog box for dimensions.
2. Set two or more dimensions equal to the global variable.
When you change the value of a global variable, both dimensions are changed to the new value.

Adding a Global Variable in the Equations Dialog Box


To add a global variable in the Equation View:

1. Do one of the following:

• Click Equations (Tools toolbar).


• Click Tools > Equations.

• Right-click the Equations folder in the FeatureManager design tree, and select Manage Equations.

2. Select the Equation View .

3. In the Global Variable section, click an empty cell in the Name column.

4. Enter a name for the global variable.

The SOLIDWORKS software does the following:


• Encloses the name in quotation marks.
• Moves the cursor to the Value/Equations column and inserts = (equal sign).
• Displays a flyout menu with options for starting the global variable

5. After = (equal sign), add a term or a dimension to the global variable by doing one of the following:

• Click a dimension in the graphics area. SOLIDWORKS propagates the dimension name in the cell.
• Type a number or a conditional statement.
• Select Measure ... from the flyout menu and use the Measure Tool to create the term.
A appears in the cell to indicate that the syntax is valid.

6. Type + (plus), - (minus) or another mathematical symbol.

7. Add another term to the global variable.

8. When the global variable is complete, click .

The solution to the global variable appears in the Evaluates to column and the cursor moves to the next cell in
the Comments column.

9. Add comments to document your design intent.

10. Click OK to close the dialog box.

Configuring Equations
You can configure equations and global variables in the same way as you configure dimensions.

You can create variations of equations and global variables, and apply them to configurations using
the Equations and Modify dialog boxes. You can also configure equations and global variables in design tables, and in
various PropertyManagers for parts and assembly features.

For example, when you create an equation in the Distance field of the Chamfer PropertyManager, you select
configurations by selecting an option from the configurations option list that appears in the field. You can edit the
equation and assign it to different configurations using the Equations or Modify dialog boxes.

You can also specify a different unit of measurement for each configuration. For example, you can have one configuration
where a global variable is expressed in millimeters and another where it is expressed in inches.
PARENT TOPICEquations

Selecting Configurations
To view global variables, dimensions, and equations for a specific configuration, click the configuration list in the upper
right corner of any view.

To apply a configuration to a dimension or equation, click the Configurations button in the row, and select one of the
following from the flyout menu:

• This configuration
• All configurations
• Specify configurations
• Link to parent configuration
Link to parent configuration is available when the dimension or equation is part of a derived configuration. This option links
the name to the parent configuration.

Using File Properties in Equations for Configurations


For parts that contain configured file properties, you must use the following syntax for file properties in equations:

filePropertyName@ConfigurationName@PartName.Part
For example, for the first configuration of a part, the value of a dimension D1@ThisPart might be expressed by the
equation D1@ThisPart= PropA@Config1@ThisPart.part where:

• PropA is the name of a file property


• Config1 is the name of the first configuration of the part
• ThisPart.part is the part name
The value for the second configuration might be expressed as D1@ThisPart =
PropA@Config2@ThisPart.partwhere Config2 is the name of the second configuration.

In this example, if the file property PropA is set at 100 for the first configuration, then in that configuration the
dimension D1@ThisPart is equal to 100, and if PropA is set at 200 for the second configuration, then D1@ThisPart is
equal to 200 in that configuration.

If you do not specify the configuration in the equation, the software might not return the correct value of the file property
for that configuration.

Linked Values
Use linked values (also referred to as shared values or linked dimensions) to link two or more dimensions without using
equations or relations. When dimensions are linked in this way, any member of the group can be used as a driving
dimension. Changing any one of the linked values changes all others to which it is linked.

The variable name you specify becomes the name of the linked dimensions.
Linked dimension names and their current values appear:
• In the Equations folder in the FeatureManager design tree.
• In the Equations dialog box.
• Under Value/Text Expression:
On the Custom tab in the Summary Information dialog box.
In the Weldment dialog box.

Linking Dimension Values Using Link Values


1. Right-click the dimension and select Link Values.

2. In the Shared Values dialog box, select or type a Name.

In addition to the linked variable names you create, global variables are also available for selection under Name.
You can delete unused dimension names from the Name list. Select the name and press Delete. You cannot delete
a name used by another dimension.

3. Click OK.

appears with the dimension in the graphics area and in the Equations dialog box.

4. Repeat for as many dimensions as needed.

The values of the selected dimensions become linked. Changing any of the linked values causes the others to
change.

Example:

The width and height dimensions of the block are linked. When you change the width of the block to 15, the height
changes accordingly.
To remove the link, right-click the dimension and select Unlink Value.

Linking Dimensions Using Global Variables


To link values by using a global variable in the Modify dialog box:

1. Double click the dimension, then in the Modify dialog box, type = (equal sign).
You must enter the equal sign to assign a global variable to the dimension. If you do not enter the equal sign, you
can create a new global variable, but it will not be assigned to the dimension.

2. Type a name for the global variable.

The name appears in yellow and Create Global Variable appears.

3. Click Create Global Variable .

4. Click .

appears next to the dimension in the graphics area.

5. Toggle the display of the value and the name by clicking the Global Variable button .

6. Find the dimension you want to associate with the global variable. Double click the dimension, then in
the Modify dialog box, type =(equal sign) and several characters of the global variable name.

A flyout menu appears with a name that matches the characters you have typed.

7. Select the global variable name and click .


Both dimensions become linked to the global variable.

8. Repeat for as many dimensions as needed.

You can edit the global variable by double clicking the dimensions and using the Modify dialog box, or by editing the
values in the Equationsdialog box.

Global variables are bi-directional, meaning that if two or more dimensions are defined in terms of a global variable, then
changing any one of the dimensions will cause the others to change.

Share Equations Among Models


You can share equations and global variables among models.

You can export all equations or selected equations to a text file, and import all equations or selected equations from a text
file. The text file can be shared with other parts and assemblies that use the same global variables and equations.

You can create permanent links with text files using the Link to external file, so that changes to the text file are propagated
to the model.

The Link to external file always creates a link with the external file. The Export and Import processes include options for
one-time exports and imports without a link.

CONTENTS
• Exporting and Linking Equations to External Files

These steps demonstrate the workflow for exporting and linking to text files.

• Importing Equations

You can import equations from a text file into a part or assembly.

• Creating Equations in External Files

You can create equations in a text file and then import them into one or more parts and assemblies.

• Changing Equations Through a Linked File


You can change equations in a linked text file and see the changes reflected in a part.

Exporting and Linking Equations to External


Files
These steps demonstrate the workflow for exporting and linking to text files.

To export part or assembly equations and link dimensions to a file:

1. Do one of the following:

• Click Equations (Tools toolbar).


• Click Tools > Equations.

• Right-click the Equations folder in the FeatureManager design tree, and select Manage Equations.

2. In the Equations dialog box, click Export.

3. In the Save As dialog box:

a. Specify a name and location for the text file.


b. Click Save.
The equations are saved in a text file. The Export Equations dialog box appears.

The Export Equations dialog box includes two columns. The first column indicates the equations that are
exported to a text file. The second column indicates the equations that are linked between the model and the
text file. You can change the equations for the items you link only in the target text file. By default, all equations
are exported and linked.

You can link and unlink individual equations by selecting and clearing the check boxes in the Links column.
You can also link and unlink in the Equations dialog box after you link to an external file.

4. In the Export Equations dialog box, click Export.

In the Equations dialog box, the Link to external file option is selected. The file path also appears.
5. In the Equations dialog box, click Open linked file .

The file opens in a text editor.

6. Change the value of a global variable that a linked dimension depends on and save the file.

7. In the Equations dialog box, click Rebuild .

All the dimensions that depend on the global variable are updated. The Equations dialog box displays an additional
column for all the entries linked to the external file.
Equations and global variables that are externally linked can no longer be changed in this dialog box. You must use
the external file to modify them. To unlink the linked equations and global variables, in the Equations dialog box,
clear Link to external file.

8. Click OK.

Importing Equations
You can import equations from a text file into a part or assembly.
1. In the part or assembly, click Tools > Equations.
2. In the Equations dialog box, click Import.
3. In the Open dialog box:
a. Select the text file.
b. Click Open.
4. In the Import Equations dialog box:
a. Select or clear Link to File.
b. In the Equations column, clear the check mark for any equation you do not want to import.
c. In the Link column, clear the check mark for any equation you do not want to link to the external file.
When Link to file is selected, changes you make in the text file update the equations and variables in the
model.
d. Click Import.
The equations from the text file are imported into the model.
If Link to File was selected, changes you make in the text file are propagated to the model. Then in the Equations dialog
box:
• A Link column appears and indicates which equations are linked to the file.
• The Link to external file check box is selected and the path to the external file displays.
Equations and global variables that are linked to an external file cannot be modified in the Equations dialog box. They
must be edited in the external file. To remove the link and modify an equation in the dialog box, clear the box for that
equation in the Linkcolumn.

Creating Equations in External Files


You can create equations in a text file and then import them into one or more parts and assemblies.
1. Open a text file in an application such as Notepad.
2. Type equations in the same format as used in the Equations dialog box.
For example, you might define a global variable, base, and define two related dimensions.
"base" = 20
"D1@Boss-Extrude1" = "base" + 10
"D2@Sketch1" = ("base"*3) + 5
3. Save the text file.
You can import the text file into one or more parts and assemblies with the Equations dialog box. You can choose to link
models to the text file, so that changes you make in the text file update the equations and variables in the models.

Changing Equations Through a Linked File


You can change equations in a linked text file and see the changes reflected in a part.

To change equations using a linked text file:

1. At the bottom of the Equations dialog box, click Open linked file from any view.

The text file opens.

2. Change one or more of the equations.

3. Save the text file.

4. In the Equations dialog box, you can link and unlink individual equations by selecting and clearing the check boxes
in the Links column.

5. Click Rebuild to see the changed equations.

Create Equations in the Modify Dialog Box


When working on a model, you can enter equations and global variables directly in the Modify dialog box for dimensions.
You do not have to open the Equations, Global Variables, and Dimensions dialog box to create an equation for a part or
component.

The equations and global variables that you create in the Modify dialog box are reflected in the Equations dialog box.

CONTENTS
• Creating an Equation
• Creating a Global Variable
• Modifying an Equation
• Changing Global Variables with the Modify Dialog Box
Creating an Equation
To create an equation in the Modify dialog box for a dimension:

1. In the model, double-click a dimension.

The Modify dialog box for dimensions displays, showing the name of the dimension and the current value.

2. In the second line of the Modify dialog box, enter = (equal sign). Then enter an equation in the same way as in
the Equations dialog box.

You can assign units of measurement to each value in the equation by using the type-ahead list or by typing the unit
directly. If you specify different units of measurement to each value, the equation will evaluate to the units of
measurement defined in the document.

3. If the dimension has multiple configurations, click Configurations , and select one of the following from the flyout
menu:
• This configuration
• All configurations
• Specify configurations

4. Click .

An Equations icon appears next to the equation.

The next time you open the Equations dialog box, the new equation is listed.
You cannot change the evaluated value of an equation in the Modify dialog box.

Creating a Global Variable


To create a global variable in the Modify dialog box for a dimension:

1. In the model, double-click a dimension.

The Modify dialog box for dimensions displays, showing the name of the dimension and the current value.

2. In the second line of the Modify dialog box, enter = (equal sign). Enter the name of a new global variable
and enclose it in quotation marks.

The text displays in yellow and the Create Global Variable button appears next to the name.

3. Click the Create Global Variable button, or hit Enter, or click and Yes.

The global variable button appears to the left side of the equation. Clicking the global variable button causes the
entry to toggle between the global variable name and the evaluated value.

4. Click to confirm.

Changes to the value of the global variable update all equations and variables in the model that reference that global
variable.
The next time you open the Equations dialog box it will include:
• The new global variable.
• The equation making the dimension equal to the global variable.

Modifying an Equation
To modify an equation in the Modify dialog box for a dimension:

1. In the model, double-click a dimension that has an equation.

An Equations icon appears next to the dimension.

The Modify dialog box for dimensions displays, showing the name of the dimension and the current value.

2. Edit the equation.

You can assign units of measurement to each value in the equation by using the type-ahead list or by typing the unit
directly. If you specify different units of measurement to each value, the equation will evaluate to the units of
measurement defined in the document.

3. Click Rebuild and then .

The model is rebuilt based on the modified equation.

Changing Global Variables with the Modify


Dialog Box
To change dimensions linked to global variables using the Modify dialog box:

1. In the FeatureManager design tree, click a feature with a dimension linked to a global variable.

The model opens in sketch mode.

2. In the sketch, double-click the linked dimension.

3. In the Modify dialog box, change the dimension value.

4. Click Rebuild and .

5. In the FeatureManager design tree, right-click the Equations folder and click Manage Equations.

The Equations dialog box displays the new value for the global variable and for the linked dimension.

Equations in Assemblies
The equation syntax for references between assembly components loads automatically when you select dimensions,
features, and global variables in the FeatureManager design tree, the graphics area, File Properties, and
the Equations dialog box.
Existing equations that do not follow this syntax are marked as errors because they create inconsistent results. You need
to edit these equations to correct the syntax.
In the following example, A1 is a subassembly of A2 containing the parts P1 and P2:

GV1 and GV2 are global variables in the documents. Use the following syntax:

Edit Target Reference to Syntax

A2 A2 “GV1” = “GV2”

A2 A1 “GV1” = “GV2@A1<1>.Assembly

A2 P1 “GV1” = “GV2@P1<1>.Part@A1<1>.Assembly

A1 A2 “GV1” = “GV2@A2.Assembly”

A1 A1 “GV1” = “GV2”

A1 P1 “GV1” = “GV2@P1<1>.Part”

P1 A2 “GV1” = “GV2@A2.Assembly”

P1 A1 “GV1” = “GV2@A1<1>.Assembly”

P1 P1 “GV1” = “GV2”

P1 P2 “GV1” = “GV2@P2<1>.Part@A1<1>.Assembly”

Design Tables and Equations


When you enter equation and global variables in a design table, the equations and global variables are automatically
reflected in the Equations dialog box.

In a design table, equations must be preceded by a single apostrophe and an equal sign ('=). The single apostrophe
ensures, that if the equation is exported to Excel, it is interpreted as an equation and not as a text string.
You can also disable or enable an equation across all configurations by specifying a unique identifier (Relation ID) in a
design table. This functionality is available when the Display unique equation identifier option is selected in System
Options > Display.

In Ordered View of the Equations dialog box, when you hover over an equation under the Name column, a tool tip
displays a unique ID (Relation ID) for that equation.

You use this ID in the following parameter: $Enable@Relation_ID@Equations, where Relation ID is a unique
number that identifies an equation. For example, the $Enable@1@Equations parameter applies to equation 1. Then in
the design table, under that parameter, enter Yes to enable or No to disable the equation for all configurations.
PARENT TOPICEquations

RELATED CONCEPTS

Design Table Configurations

Conditions Limiting the Use of Configurable Equations


For files created with SOLIDWORKS version 2013 or earlier, you can use configurable equations unless:

• The model has design tables.


• One or more equations are suppressed in one of the configurations.
• The model has two or more equations with the same name, for example D2@Sketch1.

To use configurable equations with one of these existing files:


1. Remove conflicts by performing the following actions:
• Delete design tables.
• Remove suppressed equations.
• Ensure that each equation has a unique name.
2. Save the file with SOLIDWORKS version 2014 or later, and re-open the file.

Direct Input of Equations in


PropertyManagers
For many features, you can enter and modify equations directly in PropertyManager fields that allow numerical inputs.
You can create equations with global variables, functions, and file properties without accessing the Equations, Global
Variables and Dimensions dialog box.
The following table lists many of the PropertyManagers where this capability is available:

Part Features Assembly Features


Extruded Boss/Base Extruded Cut
Extruded Cut Revolved Cut
Simple Hole Fillet
Revolved Boss/Base Chamfer
Revolved Cut Hole
Fillet Linear Pattern
Chamfer Circular Pattern
Shell
Rib
Draft
Base Flange
Edge Flange
Linear Pattern
Circular Pattern
Curve Driven Pattern
Extruded Surface
Revolved Surface
Fillet Surface
For example, in the PropertyManager for the Extruded Boss/Base feature, you can enter equations in:
• Depth fields for Direction 1 and Direction 2
• Draft fields for Direction 1 and Direction 2
• Thickness fields for a Thin Feature with two direction types
• Offset Distance field

To determine if a numeric field accepts equation input, hover over the field to display the following tool tip: Enter a value or
start with = to create an equation.

Numeric input fields that contain equations can display either the equation itself or its evaluated value. You can toggle
between the equation and the value by clicking the Equations or Global Variable button that appears at the
beginning of the field.

If the feature applies to more than one configuration, a configuration button appears in the input field. You can specify
whether the equation will affect one configuration, all configurations, or selected configurations.
You cannot change an evaluated value when it is displayed in the input field, but you can toggle to the equation and then
edit or delete the equation.

Equations that you create or edit in the PropertyManager, Equations dialog box, or Modify dialog box are reflected in all
areas.
Equations with Exponents of Negative
Numbers or Variables
In the Equations dialog box, if you use an equation that includes the exponent of a negative number, or the exponent of a
negative global variable, you should use parentheses to guarantee correct results. For example, to solve the equation "c"
= -3^2 the software first resolves the exponentiation operator (^), that is:
"c" = -3^2
= -(3^2)
= -(9)

Next, it resolves the unary negation operator (-):


"c" = (-3)^2
= 9

If a global variable has a negative value and you want to calculate an exponent, include parentheses around the global
variable in the equation. For example, if you have a global variable "b" = -4, and you want an equation to calculate its
square, use "c" = (b)^2. Then the equation is solved as:
"c" = (b)^2
= (-4)^2
= 16

Replacing Equation References for Deleted


Features
If you delete a feature that is referenced by equations, you might have errors in your equations. These errors occur when
the equations for a deleted feature contain driving dimensions. You can repair the equations by replacing the dangling
portion of the equations with other dimensions or variables in the Equations dialog box.

To use the Replace Reference tool:

1. Do one of the following:

• Click Equations (Tools toolbar).


• Click Tools > Equations.

• In the FeatureManager design tree, right-click Equations and click Manage Equations.

2. Select the Equation View .

3. Under the Value/Equation, in the dangling portion of the equation column, right-click Replace Reference.

The dangling portion displays in red.

4. In the Replace Dimension/Variable dialog box, type a global variable or dimension string to repair the dangling
portion of the equation, or select it from the graphics area.

5. Select one of the following to apply the replacement text and click OK:

• This Instance
• All instances in this configuration
• All instances in all configurations

S-ar putea să vă placă și