Issue:

Sometimes when creating a part, the part name is named by adding the drawing number and name. The drawing number and name in the attributes are directly intercepted by reading the part name. In this case, the drawing number separation operation is required to implement automatic extraction.
The following explains the operation of automatically separating drawing numbers on ZW3D through the substr function.

Solution:

  1. Create templates of the part and Drawing Sheet: Create a new part, and enter TEST123456-Drawing test as the part name.
  2. Use Tools → Equation Manager to create the following two variables: Drawing = substr(part_name,0,10), Drawing test = substr(part_name,11,100). The variable Type should be String. Click OK to complete the variable setting.
    Function description: Extract 0-10 characters and 11-100 characters of part name respectively.
    Note: The length of extracted characters is set according to the actual design requirements of the company.
  3. Click Tools → Properties, switch to the User tab and add new attributes. Fill in the Property name, Type, Data/Expression of the new property.
    Click Expression to use the Variable browser to reference the Drawing and Drawing test variables. Click OK to complete user attribute customization.
  4. Save the file to the resource folder of the template in the installation directory. 
  5. Create a new drawing file, use the corresponding template. 
  6. Double-click the Title Block to modify the content. Double-click the variable $part_name and change it to $part_drawing test.
  7. Copy the changed variable and place it in the box below. Double-click to modify the variable name and change the name to $part_drawing.
  8. Click Sketch → Exit in Ribbon to complete the title block modification.
  9. Save the drawing file to the template folder in the installation directory.
  10. Use the template files to create a new part file. We can find the template file we just saved in Template.
  11. Create a new 2D sheet with the drawing template we created.
  12. In the 2D sheet we can find that the drawing number and the name are separate.