Trimming Text Substitutions

I am using the filename text substitution in a pen table in order to print the path & filename of my drawing. However, for drawings in ProjectWise, the left part of the text is redundant - shows the server name, etc. Is there any way to trim the text substitution to get only the specific part of the path that I want to see? Something like trim off the first 25 characters of the text substitution.


Thanks,

I. Kinal

Parents Reply Children
  • I would be interested in learning how this can be done in CONNECT Edition - although we haven't deployed it yet, I think we will sooner or later.

    Thanks,
    I. Kinal
  • Talk to your IT gurus it may be  possible to remap the path and drives to something shorter  its  "an ANC pathing thing in windows " .. this is out of my  depth for detail but I know  it can be done and also how it can be a problem to you .. then  you may also need msnt to have  project pathing too.. but your IT dept should really  be able to help with this ........

    Lorys

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

    But was long time user V8iss10 (8.11.09.919) dabbler CE  update 16 (10.16.00.80) 

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

  • Correction, it is possible in MicroStation V8i using a named expression.  Say you define a named expression in one of your DGNLIBs called "TruncatedPrintDefSourceFile".  In the pen table, the replacement string would be "<expr?name=TruncatedPrintDefSourceFile>".  In a design script, the code would be something like "if (text == "__dgnfile__") then characters = "<expr?name=TruncatedPrintDefSourceFile>" endif"

    The "TruncatedPrintDefSourceFile" named expression would need the PrintDefinition and System.String symbol sets.  The expression itself could be one of two I came up with:

    (a) Rightmost 25 characters of print definition source file path if length longer than 25.  Otherwise entire string.

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

    (b) If print definition source file path contains "Documents", use everything to the right of that plus the folder separator character.  Otherwise entire string.  When in ProjectWise mode, this evaluates to the ProjectWise document URL without the datasource name and other characters you probably don't care about.

    IIf (System.String.Indexof (PrintDefinition.SourceFile, "Documents") >= 0,

    System.String.Substring (PrintDefinition.SourceFile, System.String.Indexof (PrintDefinition.SourceFile, "Documents") + 10, -1),

    PrintDefinition.SourceFile)

          
    .

  • Unknown said:

    Correction, it is possible in MicroStation V8i using a named expression.  

    Andrew  thats awesome  but is there any useful documentation on how to use named expressions, the  Mstn V8i help file on this is so lacking I have just avoided named expressions, and I think most  users have too...

    until last week when there was a really good example of how to use named expressions  in find replace  but that's about it,   its an even less understood feature than tags and tag reports ( which unfortunately I really  learned alot  from outside of bentley resources)... 

    Lorys

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

    But was long time user V8iss10 (8.11.09.919) dabbler CE  update 16 (10.16.00.80) 

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

  • Thanks - that sounds exactly like what I am looking for. We will try it out and will let you know if we run into any issues.

    I. Kinal