Pen Tables - Text Substitution - Windows Short Path

Hi all,

Would it be possible for me to use a pen table, text substitution, named expression combination in order to text substitute the windows short path of the dgn location I am printing from?

If possible, I would like text substitution result to look something similar to:


I have limited space available for the path, in the border (dictated by client standards), and my companies standards make the path quite long.
To add an additional wrinkle, the files are located on a network drive.

Unfortunately, FileL ,  FileA , and FileSdo not give me the results I am looking for.
I am definitely open to alternative suggestions, but If possible I would like to avoid VBA to avoid software changes outside of MicroStation effecting functionality.

The closest answer I have come up with is to truncate the path using this named expression:

IIf (System.String.Length (PrintDefinition.SourceFile) > 70, System.String.Substring (PrintDefinition.SourceFile, System.String.Length (PrintDefinition.SourceFile) - 70, -1),PrintDefinition.SourceFile)

But the above has the drawbacks of loosing critical drive location information on the left end of the path.

Currently, we are using MicroStation V8i (SELECTseries 3) - Version

Thanks for your help in advance,


  • Hi Christopher,

    I think there is no way how to obtain old 8.3 DOS style path of active file in MicroStation. Even though your request makes sense, I guess nobody takes care about so old FAT style today.

    It's possible to create and use own Named Expression(s), so it would be possible to implement code that will return 8.3 style path. But C# development plus how to create NE knowledge is required :-(

    With regards,

  • Hey Jan,

    Thank you very much for your quick response. I was afraid that that might be the answer. I looked for several hours, and didn't have any luck :-(
    But I was hoping maybe i was just using the wrong search terms.

    So, if that is not an option perhaps you might have some advice for another method to fix my problem.

    The biggest issue I think, is that the text that I am replacing is center center justified, and based on the location of the tag, above a certain length it would go off the edge of the page(say 70 characters), and above an even longer length (say 150 characters) it would interfere with another standard stamp.

    But, I wonder, would there be a way to trick the alignment?
    Perhaps by adding trailing spaces in the named expression equal to the length of the path over 70? or inserting a space in a place far away?
    Or would there be a way to adjust the alignment/location of the tag we are replacing through the pen table, without modifying the border?

    I am still a novice where it comes to using named expression.

    Perhaps something like:
    IIf (System.String.Length (PrintDefinition.SourceFile) < =70, PrintDefinition.SourceFile, IIf (System.String.Length (PrintDefinition.SourceFile) > 150,"..." & System.String.Substring (PrintDefinition.SourceFile, System.String.Length (PrintDefinition.SourceFile) - 150, -1) & System.String.ADDACOMMANDTHATADDSCHARACTERMULTIPLETIMES(" ",(System.String.Length (PrintDefinition.SourceFile) - 220),-1),PrintDefinition.SourceFile & System.String.ADDACOMMANDTHATADDSCHARACTERMULTIPLETIMES(" ",(System.String.Length (PrintDefinition.SourceFile) - 70),-1))

    For my guess this command works like System.String.ADDACOMMANDTHATADDSCHARACTERMULTIPLETIMES("character or string you want inserted",number of times insert the character or string,position you want the character inserted where -1 inserts to the right)

    The idea of the above string only truncating when it would run over the stamp ( i.e. 150 characters), then adding trailing spaces to move the text to the left because of center justification of the text as needed( i.e. some number of spaces between 150 and 70)

    Any thoughts or ideas?

    Thanks again for your responses!

  • I suppose you have  tried smaller font to put the  full long path? 

    Seems a bit  strange that you have to do this as it  wont mean anything when the client  gets  the  files in cad because it will change when they store them elsewhere, but I  have a sneaky low down dirty fix  for your prints..



    or whatever its meant to be  (it cant start with c:\  right was just example)

    as text  in front  of   but not  part of  $FileS$

    The end result will look like what you want not  perfect but heck if it cant  be  done  what do they your masters expect...

    you do this only in the title  block ref file   so its  global and save a copy of the  xref title block in the same folder as these  drawings live  so it doesnt change the one  you use for all drawings using same company std  title  block elsewhere


    Started msnt work 1990 - Retired  Nov 2022 ( oh boy am I old )

    But was long time user V8iss10 ( dabbler CE  update 16 ( 

    MicroStation user since 1990 Melbourne Australia.
    click link to PM me 

  • Hey Lorys,

    Thank you very much for your suggestion.

    Unfortunately, they are pretty strict on font size.

    We did bat around changing our standard workflow to include a different configuration project by project rather than client by client.
    But since we are sometimes working of 5 or more different projects in a day, sometimes more we we're concerned that it would lead to too many unforced errors :-)
    We also thought about changing our local border files with a permanent path.
    And, in a pinch, I thank that is what we will do as a last resort.
    But that is so easy to mess up.
    And, since we do move the files around quite a bit, we would have to be very careful with the pcf and/or border files

    Also, I am so forgetful :-)
    So, I like to try to automate if I can. :-)

    I do plan on working with our client on a few minor changes that would make our life easier ( and there's), but the next update of the border and seed files is still a bit off for them.



  • Hi Chris,

    Unknown said:
    The biggest issue I think, is that the text that I am replacing is center center justified, and based on the location of the tag, above a certain length it would go off the edge of the page(say 70 characters), and above an even longer length (say 150 characters) it would interfere with another standard stamp.

    It sounds like more complex issue than just to convert Windows path to old 8.3 format.

    • If a text uses proportional font, content modification has to be always done in the context of this specific text, so for 100% solution any simple processing is ot enough in my opinion. Simpler solution can be to define the worst case and to limit number of characters based on this evaluation. But it means some texts will be shorter and the space will be not utilized full in some cases.
    • If the text uses fixed width font (like Courier), it's easier, because you can define exact text length.

    To design the best solution more detail knowledge of the specific situation, requirements and conditions (can be tags moved, has to be implemented using plot preprocessing only etc.).

    Unknown said:
    I am still a novice where it comes to using named expression.

    Named expression (NE) is nothing else than function that can be called in different situations that are defined by MicroStation itself. NE cannot change design file content (well, I guess it can, but no such NE exists and it's not their intention and such NE can be potentially dangerous). It's possible also to develop own NE, but relevant information is not part of public SDK.

    Unknown said:
    Any thoughts or ideas?

    I don't want to change the main discussion question and to enlarge it to complex vague topic. If talking about your original question, you can try the attached symbol provider: I quickly modify some my testing code, so be aware no guarantee is provided.

    How to use it:

    1. Copy dll file into some folder, but it has to be local folder, not shared network one.
    2. Add configuration variables to your project accordingly, so MicroStation will now new NE provider (dll file) exists and should be loaded.
    3. Define own NE.

    Configuration variables:

    MS_ADDINPATH > <path to folder with dll file>/ ... e.g. MS_ADDINPATH > $(_USTN_PROJECTDATA)splibs/
    MS_SYMBOLPROVIDER_APPS > LabTech.SymbolProvider

    If it will work, it should looks like this:

    With regards,


  • Jan,

    Thank you so much for providing this and your very thorough and thoughtful answers above.

    It will take me a hot minute to digest the provided solution, but this one does look promising for sure!

    Rest assured I will be looking at this, and will reply soon.


Reply Children
No Data