Community
Civil 3D Forum
Welcome to Autodesk’s Civil 3D Forums. Share your knowledge, ask questions, and explore popular AutoCAD Civil 3D topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Diesel Expression that reads the Layout tab?!

40 REPLIES 40
SOLVED
Reply
Message 1 of 41
JCyganiak
8658 Views, 40 Replies

Diesel Expression that reads the Layout tab?!

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.

Joe Cyganiak
Civil Engineering Senior Designer
AutoCAD Civil 3D 2017
40 REPLIES 40
Message 2 of 41
Charlie.Ogden
in reply to: JCyganiak

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)

 



Charlie Ogden, PE
Product Manager
Message 3 of 41
jmayo-EE
in reply to: Charlie.Ogden

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

EESignature

Message 4 of 41
jmayo-EE
in reply to: jmayo-EE

Actually I get the whole string. With your code I didn't get any of the string.

John Mayo

EESignature

Message 5 of 41
AllenJessup
in reply to: jmayo-EE

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

Message 6 of 41
Charlie.Ogden
in reply to: jmayo-EE

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.



Charlie Ogden, PE
Product Manager
Message 7 of 41
jmayo-EE
in reply to: Charlie.Ogden

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

EESignature

Message 8 of 41
JCyganiak
in reply to: Charlie.Ogden

Thanks! Worked Perfect Smiley Happy

Joe Cyganiak
Civil Engineering Senior Designer
AutoCAD Civil 3D 2017
Message 9 of 41
brendanbutt1
in reply to: JCyganiak

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

 

Message 10 of 41
JCyganiak
in reply to: brendanbutt1

Do you use stationing? Our match lines read the stations from the alignment.

Joe Cyganiak

Sent from my iPhone
Joe Cyganiak
Civil Engineering Senior Designer
AutoCAD Civil 3D 2017
Message 11 of 41
brendanbutt1
in reply to: JCyganiak

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

Message 12 of 41
JCyganiak
in reply to: brendanbutt1

Sorry it took so long for me to respond... i'm not sure if it can.

Joe Cyganiak
Civil Engineering Senior Designer
AutoCAD Civil 3D 2017
Message 13 of 41
brendanbutt1
in reply to: JCyganiak

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

Message 14 of 41
JCyganiak
in reply to: brendanbutt1

I've only been able to get it to work on text strings myself!
Joe Cyganiak
Civil Engineering Senior Designer
AutoCAD Civil 3D 2017
Message 15 of 41
brendanbutt1
in reply to: brendanbutt1

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

 

Message 16 of 41
brendanbutt1
in reply to: brendanbutt1

It works on any alphanumeric string where the last 3 or more characters are numeric.

Message 17 of 41

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?

Message 18 of 41
gazgumby
in reply to: JCyganiak

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.

Message 19 of 41
AllenJessup
in reply to: gazgumby

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

Message 20 of 41
gazgumby
in reply to: AllenJessup

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

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Rail Community


Autodesk Design & Make Report