How can I combine the path to the design file name, date and time file into a single string inside of a MicroStation pen table?

By default a MicroStation pen table does not allow you to string variables together but via a named expression you can easily accomplish this.

First open  .dgnlib file where you are going to store your named expression

From the pull down menus select Utilities->Named Expressions

Select the New icon

Enter an “Internal Name” and an “External Name”.  For this example we will use the same name “FilenameDateTime”

Under Keywords, check the box next to File and Print Set

Under Symbol Sets add “ActiveFile, PrintSet, System.Path, System.String, PrintDefinition, System.DateTime”

In the expression field enter:
System.Path.GetDirectoryName (PrintDefinition.SourceFile) & "\" & System.Path.GetFileName (PrintDefinition.SourceFile) & "-" & System.String.Format("{0:G}", System.DateTime.Now())

Now in your MicroStation pen table you need to add a new entry under Text Substitutions.  In the “Actual” field enter the text exactly as it appears in your design file.  In the “Replacement” field enter the following:
<expr?name=FilenameDateTime>

Where the FilenameDateTime is the Internal Name of the expression you created earlier.  Save the pen table and you should see your results in the preview and/or output.

You can customize this expression to suite your needs.  Look under Utilities->Report Symbols for options available.

Anonymous