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 Properties dialog box.
  • Under Value/Text Expression in the Weldment dialog box.

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 OTTool_Equations_Tools.gif (Tools toolbar).
    • Click Tools > Equations.
    • Right-click the Equations FM_equations.gif folder in the FeatureManager design tree, and select Manage Equations.
  2. Select the Equation View equations_view_icon.
  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 PM_OK.gif 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 PM_OK.gif.
    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.