Hi
I have a question about named expressions. Maybe we use them in a strange way or we don't use all their capabilities.
When we create a plot file the name of the file is for example: "js_A01_Situation.dgn"
We create a named expression attached in all the plot files that is:
System.String.Substring(System.Path.GetFileNameWithoutExtension (ActiveFile.FileName),7,-1)
It is obviously based in the length of the string.
We use this named expression to take parts of this file name " js_A01_Situation.dgn" and fill the border of the drawing thanks to the pen table.
Project code: js
Sheet number: A01
Sheet title: Situation
For us is very useful. We change the name of file o rewrite it once and we change the name of pdf we generate without open the file.
Now we have a little problem. We must deliver the sheets with the sheet title in two languages in two different lines.
Continuing with the previous example a possible file name would be: "js_A01_Situation-Emplazamiento.dgn"
And obviously the length of the string is different in every case. Is there any way to trim the string based in a special character. In this case it would be "-"
Lot of thanks
Regards
Hi Steve
We are here again with this subject. I know you told me you don't dominate this world very well, but maybe you can help me.
We have this name file.
mv_A01_Situación__Situation.dgn
1. I can get with a named expression extract the number "A01" of the name file and put it into the border. It always has three characters. Always the same lenght. That's important.
The named expression we use is:
System.String.Substring(System.Path.GetFileNameWithoutExtension (ActiveFile.FileName),3,3)
2. I can get the english word "Situation" with the info you showed me in the link. I can get from the "__" till the end of file name.
The named expression we use is: (I know we have to polish it, but by now it works)
IIf (System.String.Indexof (System.Path.GetFileNameWithoutExtension (ActiveFile.FileName), "__") >= 0,System.String.Substring (System.Path.GetFileNameWithoutExtension (ActiveFile.FileName), System.String.Indexof (System.Path.GetFileNameWithoutExtension (ActiveFile.FileName), "__") +2, -1),System.Path.GetFileNameWithoutExtension (ActiveFile.FileName))
3. We don't know how to get the spanish word "Situación". In this case is "Situación" but it can be "Alzado interior". The length changes everytime. Is it possible to trim a string between to characters, in this case "_" and "__", with named expressions?
Maybe there's another way to get this things. Maybe VBA Macro loaded on the pen table but I can not find examples.
Lots of thanks
Borja
It would be good to use espressions on DGS info... like Openplant communities.bentley.com/.../31184.how-to-get-inside-diameter-calculated-in-openplant-modeler
It would be good if Bentley stops shooting itself in the foot by having multiple lagacy API's to store, edit and manage non-graphic information, as soon as possible.