2.3.8.1.4.  Key "FileName"

Name for file in pool directory, file extension "prt" for part, "asm" for assembly. Also see keys "PoolPath", "Material", "MaterialDBFile" and block "MatMap".

Default:

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

FileName(isCreaOptNotSet,is3dasm)=?_CALCNAME.start(0).Format("<GenNAME(25)>")
 .alnum("_").ToLower().MaxLen(28).add(".asm").value()

(There are two categories: one for parts and one for assemblies)

<GENNAME> The file name contains the standard designation (NB).

toFileName("_"): Non-permitted characters are automatically replaced by an underscore.

Examples:

The following examples may show how differentiated the file name can be. However, we recommend obtaining the approval of a consultant for such complex adaptations in order to avoid undesirable side effects.

Example 1:

Include prefixes in the file name.

"<PREFIXLIST(_)>" is inserted.

For projects that have several prefixes, these are automatically inserted into the file name with an underscore as a separator (e.g. Norm9, Kernloch)

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

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

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

Example 2:

Include the catalog name in the file name.

The file name is prefixed with "<CATALOG>_ ".

Declaration once for parts (is3dpart) and once for assemblies (is3dasm).

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

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

Example 3:

<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 4:

This example deals with the creation of the file name for ERP coupling.

By default, the file name is formed from GENNAME (NB).

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

You can also create the file name using the ERP number. The advantage is an absolutely unique file name.

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

You can reference any ERP column using <ATTR(any_ERP_column)>.

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

Formation via ERP number + standard designation (NB) is also an option in order to also have a "speaking" part in the name.

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

Example 5:

An ERP integration is assumed in this complex example:

The file name shall be overtaken from the ERP column.

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

  • for assemblies

  • for parts

  • for lower parts

The definition of the file name for assemblies and parts is standard syntax as known from the previous examples.

The SubParts of the assembly should combine the file name with ...

  • ...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(".iam").value()

;Part
FileName(isCreaOptNotSet,is3dpart)=?GetObject("iface.calcnameservice").start(0).Format
 ("<ATTR(xy)>").alnum("_").ToLower().MaxLen(28).add(".ipt").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(".ipt").value()

Result:

AAAA is the value from the ERP column "xy"

Explanations:

isSubPart: For SubParts a category is set. That's why this special key is only valid for SubParts.

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

The expression behind the plus sign creates the file name such as in the preceding examples.