About Formulas

SOLIDWORKS Electrical uses variables that send information from the database (Component marks, wire numbers). You can manage this information with Formula management so that it is presented according to your needs.

For example:

Equipotential number coming from the database: 5

This value is stored in the variable EQU_NO.

If you want to present this information on your drawing as 005 (displayed with three characters), use the following formula: STRZ(VAL(EQU_NO), 3, 0)

Using Formula Management

SOLIDWORKS Electrical has many predefined formulas, and we recommend using them. However, if you need to create your own formula, consider the following:
  • A formula is made up of variables (available in the third tab) and text. Strings of text are placed within quotes and each variable or string of text must be separated by a + sign. For example: CHAN_TYP + ":" + COM_VAL1 + "." + CHAN_ADDR
  • The variables are generally of Text type, even when they have a numeric appearance (for example: EQU_NO variable that sends the equipotential number).
  • Certain functions are often used to work on a variable.
    • STRZ (VAL(FIL_NO),2,0) sends the drawing number represented by two characters. The missing character here is replaced by a 0 (example: 01, 02, ...).
    • VAL: Converts a chain of characters into a number. As EQU_NO is a string of characters, it needs to be transformed into a number as the function STRZ handles only numeric values.
    • STRZ: Converts a numeric value by imposing a certain number of digits (2 in this example), and the number of decimals (0 in this example).
  • You can use mathematical functions (+ - * /) to modify the result of the variables.
    • STRZ(VAL(EQU_NO)*2,3,0) sends the equipotential number represented as three characters, but only using even numbers.
    • STRZ((VAL(EQU_NO)*2)-1,3,0) sends the equivalent of the result of the previous formula, but only using odd numbers.

If you enter an invalid formula, a message appears at the bottom of the dialog box.

The list of variables used in the formula appears in the upper part of the dialog box. Neutral values that you can change to look like the values used in your project appear next to this list. The lower part of the dialog box displays the formula result with the values used previously.