Issue:

The user's file naming convention is Drawing Number+Space (Unique character)+Drawing Name, for example, G08XXX-01-01 Shell Welded Assembly. Automatically extracting the drawing number as G08XXX-01-01 and the name as Shell Welded Assembly.

Note: Applicable for users with unique character(s) separating the name and varying character lengths in the name.

Solution:

In ZW3D 2024, a new function type substrsec(X,Y,Z) is introduced:

  • X: Character string
  • Y: Unique character(s) within X from which the substring will be extracted (one or more characters).
  • Z:
    • 1: Indicates that the substring will be taken from the right side of X, including all characters on the right side but excluding the character string Y.
    • -1: Indicates that the substring will be taken from the left side of X, including all characters on the left side but excluding the character string Y.

The usage method is as follows:

  1. Using the Equation Manager, with the type set to String, name set as Drawing Number, and the expression as substrsec(part_name," ",-1), you can extract all characters to the left of the space character in the part_name, then add the string Drawing Name with the expression substrsec(part_name," ",1) to extract all characters to the right of the space character in the part_name,

  2. After adding user attributes Drawing Number and Drawing Name in the User tab of the Properties window, click the Link to variable button.

  3. Select the corresponding variables and click the OK button.

  4. As shown in the picture, you can extract both the drawing number and the name from the file name using this method.