2.3.9.2.2.  Key "FileName" - Specify creation of file name

Default:

FileName(is3dpart,isCreaOptNotSet)=?_FORMAT_0("<GENNAME>").toFileName("_").add(".par").value()

FileName(is3dasm,isCreaOptNotSet)=?_FORMAT_0("<GENNAME>").toFileName("_").add(".asm").value()

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

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

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

Examples:

The following examples 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.

Example 1:

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)

Declare once for part (is3dpart) and once for assembly (is3dasm).

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

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

Example 2:

Take over catalog names in the file name.

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

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

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

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

Example 3:

<GenNAME(25)>: Restrict length of file name

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

ToLower(): Convert all characters into lower-case characters

MaxLen(28): The entire length of the file name is restricted 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 covers the file name creation with existing ERP-connection.

The advantage is to get an absolutely unique file name.

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

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

FileName(isCreaOptNotSet,is3dasm)=?GetObject("iface.calcnameservice").start(0).Format
 ("<ATTR(any_ERP_column)>").alnum("_").add(".asm").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("_").asm(".asm").value()

Example 5:

In this complex example an ERP integration is used.

The file name shall be overtaken from an ERP column.

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

  • for assemblies

  • for parts

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

;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(".sldprt").value()

Result:

AAAA is the value from the ERP column "xy"

Explanations:

isSubPart: A category is set for subparts. This special key is therefore 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.