How to create a Named Expression that will give you the name of the pen table and the name of the de

 Applies To 
 Environment: N\A
 Area: Printing
 Subarea: N\A
 Original Author:Frank Reimann, Bentley Technical Support Group


This document illustrates how to create a Named Expression that will give you the name of the pen table (without file extension) and the name of the design file being printed (without file extension) separated by an _ character. 
The Named Expression should be store in a global Design (DGN) library (*. Dgnlib) for all User. The MicroStation Variable MS_DGNLIBLIST is referencing to this Design (DGN) library
Create and open a Named Expression.dgnlib in …\WorkSpace\Interfaces\MicroStation\default.
Open the MicroStation print dialog box (absolutely necessary)
Open Utilities -> Named Expressions
Select the icon New and enter a name Internal name and External Name for example PenTableName. Enter a description for this Named Expression.
Keywords Dialog box -> Select Print Set
Symbol Sets -> Select the drop down box and select PrintDefenition -> Add and System.Path -> Add
Enter the following expression
System.Path.GetFileNameWithoutExtension(PrintDefinition.PenTableFile) & "_" & System.Path.GetFileNameWithoutExtension(PrintDefinition.SourceFile)
Save and close the Named Expression dialog box and open a design file for example House_Model.dgn.
Now you have to insert the Named Expression in the printer configuration file
MicroStation -> File -> Print-> the Print Dialog box opens -> File -> Select Bentley Driver -> select the Bentley driver pdf.pltcfg -> open -> the print dialog box is open -> file -> Edit Printer Driver Configuration
Base Properties TAB ->  Default Print File Name ->
Here is the place to insert the Named Expression
File Name =  <expr?name=PenTableName>
After you have changed the resolution go to File -> Save; File -> Exit.
The Print Dialog box is now open go to File -> Reload Printer Driver Configuration
If you create now a PDF file from the design file House_Model.dgn and the Pen Table Project_0001_2015, the file name will have the name