2.2.7.2. File name: set generation options ("FileName" key)

[Note]Note

If you are a new customer or have decided to no longer use the old V 8.1 pool data in CAD for new assemblies, leave the default setting.

Of course you can optionally change the default setting (standard name plus material in the file name).

Based on a few examples the most important options to set the file name will be shown below.

  • Example 1:

    This example shows the default setting.

    Declaration for an individual part (is3dpart )

    FileName(isCreaOptNotSet,is3dpart)=?GetObject("iface.calcnameservice").start(0).
    Format("<GENNAME>").toFileName("_").
    add("<.Dateiendung>").value()

    Declaration for an assembly (is3dasm ).

    FileName(isCreaOptNotSet,is3dasm)=?GetObject("iface.calcnameservice").start(0).
    Format("<GENNAME>").toFileName("_").
    add("<.Dateiendung>").value()

    There are two categories: one for individual parts and one for assemblies.

    <GENNAME>: The file name contains the Standard Name (NB).

    [Note]Note

    The material is only automatically inserted into the file name if you go to PARTdataManager -> Extras -> Settings. [Settings...].. -> Table the option Show material selection has been activated.

    Further information on the material column and entering the material can be found Section 3.3.10, “ "Table" tabbed page ” in PARTsolutions user manual" Section 3.3.10, “ "Table" tabbed page ” in PARTsolutions user manual. Information on material mapping can be found at Section 2.2.9.1, “Material mapping without ERP integration ”.

    toFileName("_"): Not allowed characters[47] are automatically replaced by an underscore.

    <.FileExtension>: By default the correct file extension is already inserted.

  • Example 2:

    Take over prefixes in file name.

    "<PREFIXLIST(_)>" is inserted.

    For projects that contain more than one prefix, these are automatically inserted into the file name with underscore as separator (e.g. Norm9, core hole)

    Declaration once for component part (is3dpart ) and once for assembly (is3dasm ).

    FileName(isCreaOptNotSet,is3dpart)=?GetObject("iface.calcnameservice").start(0).
    Format("<PREFIXLIST(_)><GENNAME>").toFileName("_").
    add("<.Dateiendung>").value()
    
    FileName(isCreaOptNotSet,is3dasm)=?GetObject("iface.calcnameservice").start(0).
    Format("<PREFIXLIST(_)><GENNAME>").toFileName("_").
    add("<.Dateiendung>").value()

  • Example 3:

    Take over catalog names in the file name.

    "<CATALOG>_" is prefixed to the file name.

    Declaration once for component part (is3dpart ) and once for assembly (is3dasm ).

    FileName(isCreaOptNotSet,is3dpart)=?GetObject("iface.calcnameservice").start(0).
    Format("<CATALOG>_<GENNAME>").toFileName("_").
    add("<.Dateiendung>").value()
    
    FileName(isCreaOptNotSet,is3dasm)=?GetObject("iface.calcnameservice").start(0).
    Format("<CATALOG>_<GENNAME>").toFileName("_").
    add("<.Dateiendung>").value()

  • Example 4:

    • <GenNAME(25)>: Limit the length of the file name

    • alnum("_"): Only allow alphanumeric characters; others are replaced by an underscore

    • ToLower(): Convert all letters to lower case

    • MaxLen(28): Limit the total length of the file name to 28 characters

    FileName(isCreaOptNotSet,is3dpart)=?GetObject("iface.calcnameservice").start(0).
    Format("<GenNAME(25)>").alnum("_").ToLower().MaxLen(28).add(".prt").value()

  • Example 5:

    This example covers the file name creation with existing ERP-connection.

    • The file name is built from GENNAME (NB) by default.

      FileName(isCreaOptNotSet,is3dasm)=?GetObject("iface.calcnameservice").start(0).
      Format("<GENNAME>").alnum("_").add("<.Dateiendung>").value()

    • However you can build the file name using the ERP number. The advantage would be to get an absolutely unique file name.

      FileName(isCreaOptNotSet,is3dasm)=?GetObject("iface.calcnameservice").start(0).
      Format("<ATTR(ERP_PDM_NUMBER)>").alnum("_").add("<.Dateiendung>").value()

      Using <ATTR(any_ERP_column)> you can refer to any ERP column.

      FileName(isCreaOptNotSet,is3dasm)=?GetObject("iface.calcnameservice").start(0).
      Format("<ATTR(beliebige_ERP_Spalte)>").alnum("_").
      add("<.Dateiendung>").value()

    • The creation via ERP number + standard name (NB) is an option as well in order to have a meaningful section in the name.

      FileName(isCreaOptNotSet,is3dasm)=?GetObject("iface.calcnameservice").start(0).
      Format("<ATTR(ERP_PDM_NUMBER)>_<GENNAME>").alnum("_").
      add("<.Dateiendung>").value()

  • Example 6:

    In this complex example an ERP integration is used.

    The file name shall be overtaken from an ERP column.

    The key FileName is defined three times with the help of categories:

    • for assemblies

    • for part

    • for subparts

    The file name definition for assembly and part is standard syntax, such as known from the preceding examples.

    The SubParts of the assembly should be composed of the file name...

    • ...prefix from the ERP column,

    • followed by the generic name (NB).

    ;Assembly
    FileName(isCreaOptNotSet,is3dAsm)=?GetObject("iface.calcnameservice").start(0).
    Format("<ATTR(xy)>").alnum("_").ToLower().MaxLen(28).add(".asm").value()
    
    ;Single part
    FileName(isCreaOptNotSet,is3dpart)=?GetObject("iface.calcnameservice").start(0).
    Format("<ATTR(xy)>").alnum("_").ToLower().MaxLen(28).add(".prt").value()
    
    ;SubPart
    FileName(isCreaOptNotSet,is3dpart,isSubPart)=?GetObject("iface.calcnameservice").start(0).
    SetObj(GetObject("iface.metaoptionservice").GetRoot()).Format("<ATTR(xy)>_").
    value()+GetObject("iface.calcnameservice").start(0).Format("<GenNAME(25)>").alnum("_").
    ToLower().MaxLen(28).add(".prt").value()

    Result:

    AAAA is the value from the ERP column "xy"

    AAAA is the value from the ERP column "xy"

    Explanations:

    isSubPart: A category is set for SubParts. This special key "FileName" therefore only applies to SubParts.

    The expression before the plus sign reads the content from the ERP column.

    The expression after the plus sign determines the part name by default, as in the previous examples.

    [Note]Note

    Example 6 may show how differentiated the file name can be build. However we recommend to approve such complex adjustments by a consultant to avoid any side effects.




[47] You can find more information on this at Section 2.2.1.3, “Variable values - functions ”.