Does anyone have a diesel expression that would read a layout tab? for example if i have a layout tab names 244180101 I would need it to read the last 2 digits in the layout tab.
Solved! Go to Solution.
Solved by Charlie.Ogden. Go to Solution.
The variable for the layout tab is ctab.
So the following expression should grab the last 2 characters:
$(substr,$(getvar,ctab),$(-,$(strlen,$(getvar,ctab)),1),2)
Thank you Charlie! You made my lurking pay off. One note. I had better luck using this
$(upper,$(getvar,ctab),$(-,$(strlen,$(getvar,ctab)),1),2)
To get the layout name into Rtext.
John Mayo
Funny. In order to get the last 2 characters of the CTAB. I had to use:
$(substr,$(getvar,ctab),$(-,$(strlen,$(getvar,ctab)),-2),4)
The layout name was 11x17 BOR TOSHIBA. The results were BA. If I change it to numbers it doesn't work. I don't know Diesel well but you may have to change the number to a string first.
Allen Jessup
Allen Jessup
Engineering Specialist / CAD Manager
John, I believe you're getting the entire string because you're not using substr which grabs only a portion of the string from the specified start character for the given length:
$(substr, string, start [, length])
To get the last two characters I was starting on the second to last character, string length minus 1:
$(-,$(strlen,$(getvar,ctab)),1)
... and then using the length as 2 characters. Length is optional, so maybe try without it and it should read to the end of the string.
I don't know Diesel all that well either (I've only used it in the past for similar expressions in RTEXT) so maybe the start and length needs to be varied from what I have - since two of you aren't seeing the same thing as me... although I seem to still get results (using RTEXT in C3D 2013) even when the tab name is text, numbers or a combination.
Thanks Charlie. I really need to brush up on the diesel expressions and rtext. I have a few rtext strings I made years ago and when I couldn't get the expression you posted to work I compared it to what I saw working and did some funny things with this keybord thingy they threw on my desk. 🙂 I did manage to work out what I need. Thanks again.
John Mayo
Thanks! Worked Perfect
I'm trying to create a simple method for match line text on plan and profile sheets that doesn't require SSM.
How about a variation of this code that would read the previous or next layout tab? Maybe an expression that would subtract or add 1 to the number, or last 3 numbers.
Brendan Butt, C.Tech.
Senior Railway Designer
AECOM Canada
The match lines are in paper space because they're outside the viewport. They reference the station value and refer to the last or next sheet number. If the expression can read the CTAB value, can it be combined with the add or subtract function?
Brendan
Sorry it took so long for me to respond... i'm not sure if it can.
I got this code to work:
For last sheet... SEE SHEET: $(-,$(substr,$(getvar,ctab),$(-,$(strlen,$(getvar,ctab)),4),3),1)
For next sheet... SEE SHEET: $(+,$(substr,$(getvar,ctab),$(-,$(strlen,$(getvar,ctab)),4),3),1)
However, it only works on text strings, not alpha-numeric combinations, so I have to limit the field string to the numbers only. Any ideas?
Brendan
I've got it...
Current Tab -1 for Last Sheet:
$(-,$(substr,$(getvar,ctab),$(-,$(strlen,$(getvar,ctab)),2),3),1)
Current Tab +1 for Next Sheet:
$(+$(substr,$(getvar,ctab),$(-,$(strlen,$(getvar,ctab)),2),3),1)
Brendan
It works on any alphanumeric string where the last 3 or more characters are numeric.
Sorry to ressurect this thread, but I am having trouble getting this to work.
Can you use Diesel expressions in the "Text Component Editor" dialog? My match lines are NOT in paperspace, but are standard, Civil 3D generated match lines. How can I accomplish "ctab + 1" or "ctab - 1" in this situation?
Can either of you guys help me please...
I’m looking for a diesel expression that will extract the data from between two special characters.
For example my Layout Tabs are called: AB123-CD-456A (XX)[DRAWING TITLE]
I already have a code for extracting the first 13 characters for my drawing number.
However, I would really like to be able to also extract the data between the ‘( )’ and the ‘[ ]’.
From example I would like my title block to show XX in one field and DRAWING TITLE in another field.
Is anyone aware of a code that could do this…..?
Any help with this would be greatly appreciated.
That's difficult unless your XX and Drawing Titile are always the exact same length. If you have a layout title of AB123-CD-456A XX DRAWING TITLE then $(substr,$(getvar,ctab),$(-,$(strlen,$(getvar,ctab)),12),13) will give you "DRAWING TITLE". In the same example $(substr,$(getvar,ctab),$(-,$(strlen,$(getvar,ctab)),15),2) will result in "XX".
Allen
Allen Jessup
Engineering Specialist / CAD Manager
Yeah, unfortunately the XX & Drawing title is variable.
I was hoping by inserting them between a special character such ( ) or [ ], there would then be a way to tell the code to extract the data that can be found between these special characters.
Thanks