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
8792 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 21 of 41
~Opie
in reply to: gazgumby

You might explore a different method using an AutoLISP variable. You could have a routine either populate a custom property in the dwg properties. This routine could be added to your startup routine. If the dwg properties are out, the routine could populate a set of variables at dwg load.

 

AutoLISP or Visual LISP could do the varying string lengths within the ctab name you are searching for.

 

Message 22 of 41
jason
in reply to: Charlie.Ogden

I am trying to use a field to get the "ctab" and add a variable to it to populate the field with different letter. Like "P02.00A-UG" +3 to get "P02.00D-UG".
I think I am accomplishing this with 3 fields.

The first returns the static prefix from the tab name $(substr,$(getvar,ctab),$(-,$(strlen,$(getvar,ctab)),9),6)
The third returns the static suffix from the tab name $(substr,$(getvar,ctab),$(-,$(strlen,$(getvar,ctab)),2),3)

The second I want to read the 7th character (letter) from the tab name and count up or down by a variable can modify later.

any ideas?

Message 23 of 41
doni49
in reply to: jason

A deisel expression can't include Autolisp code directly.  But if you were to create a lisp routine that runs when you OPEN the file, the routine could store the info in the setvars USERS1, USERS2 etc (if I remember correctly, there are 5 of them).  Then your lisp routine could read the value of the appropriate variable using the getvar deisel function.



Don Ireland
Engineering Design Technician




If a reply solves your issue, please remember to click on "Accept as Solution". This will help other users looking to solve a similar issue. Thank you.


Please do not send a PM asking for assistance. That's what the forums are for. This allows everyone to benefit from the question asked and the answers given.

Message 24 of 41
CCarleton
in reply to: doni49

Hi all,

 

I'm glad I found this thread. The solution was half of the answer I was looking for.

 

Here's my question: Is there a way to tell the DieselExpression to start from the beginning of the layout name, but exclude the last three characters?

 

Thanks for any and all help.

 

 

Message 25 of 41
doni49
in reply to: CCarleton

Yes. Have a look for the substr function.


Don Ireland
Engineering Design Technician




If a reply solves your issue, please remember to click on "Accept as Solution". This will help other users looking to solve a similar issue. Thank you.


Please do not send a PM asking for assistance. That's what the forums are for. This allows everyone to benefit from the question asked and the answers given.

Message 26 of 41
~Opie
in reply to: JCyganiak

You'll need to also use the strlen function, as Jason is showing above, in conjunction with the substr function. You can't subtract the last three characters if you don't know how many characters there are available.
Message 27 of 41
CCarleton
in reply to: doni49

Awesome, did some searching and got what I wanted!

 

$(substr,$(getvar,ctab),1,$(-,$(strlen,$(getvar,ctab)),3))

 

Thanks all!

Message 28 of 41
bberryFPFK3
in reply to: JCyganiak

I just want this code in this thread for the next time I search for it.

This is for matchline referencing layout name plus adding or subtracting one number.

 

Left

$(-,$(getvar,ctab),1)

Right

$(+,$(getvar,ctab),1)

Message 29 of 41

I have plan production with two plan viewports.

I'm trying to get my title block to display

sta (beginning sta # in plan viewport 1) ~ sta (end sta # in plan viewport 2)

 

The stations are also in the matchlines, in model view.

 

Right now I have my tab/ sheet/ layout name displaying sta (beginning sta # in plan viewport 1) ~ sta (end sta # in plan viewport 2). The title block is pointing to this layout name. I'm wondering if I just need a custom code instead.

 

Are there formulas for pointing to a second viewport?

 

I've attached a screenshot. 

Message 30 of 41
henry_lozano
in reply to: AllenJessup

I want to share my Solution

My Layout name is  SHEET 425 CH. 134+720.00 CH. 134+980.00  to run Diesel Express First is Extraction Layout page Number with that Value of  5 and  7  to fix in my template Page well be wo090-8802-03-01 page 426

 

PREVIOUS PAGE WO090-8802-0301 PAGE $(+,$(substr,$(getvar,ctab)5,7,$(-,$(strlen,$(getvar,ctab)5,7),2),3),1)


CURRENT PAGE....WO090-8802-0301 PAGE $(substr, $(getvar,ctab), 7, 5)


NEXT WO090-8802-0301 PAGE $(-,$(substr,$(getvar,ctab)5,7,$(-,$(strlen,$(getvar,ctab)5,7),2),3),1)

on Diesel expression I just Added Prefix project name 

i Got Correctly what i wanted to fix in my Project

hdl
Message 31 of 41
lynn_zhang
in reply to: henry_lozano

Hello @henry_lozano ,

 

Glad to hear you fixed the problem and thanks so much for sharing the solution! 





Lynn Zhang
Community Manager


Message 32 of 41
mserrano1967
in reply to: lynn_zhang

You solution is close to what I am looking for but I can't seem to make it work for me.

 

What I am trying to accomplish is using the previous tab's name in my mtext and the next tab's name in another piece of mtext.

 

Could someone please assist with this?

 

Thanks, Mike

Message 33 of 41
giscivil92
in reply to: Charlie.Ogden

@Charlie.Ogden 

Hi

Where should I put this code!?

 

Message 34 of 41
giscivil92
in reply to: Charlie.Ogden

@Charlie.Ogden Hi

But for me hasn't changed the number!

giscivil92_0-1704223526488.png

 

Message 35 of 41
gary_s_wright
in reply to: giscivil92

Hi, so sorry. 
The code (diesel expression) should be typed as a field insert, into the default value of your block attribute. 
then you’ll need to ATTSYNC the block and REGEN. 

Message 36 of 41
giscivil92
in reply to: gary_s_wright

@gary_s_wright 

Thanks my problem is solved!

Now, can I define a dynamic attribute that can read a text such as a kilometre like this from Excel or something!?

giscivil92_0-1704225295650.png

 

Message 37 of 41
gary_s_wright
in reply to: giscivil92

Hmmm, please expand on what you’re exactly trying to achieve….? 🤔
In the mean time, You could try a field insert as a formula and selecting the data via object.
However, it wont allow this from within the block editor, so your attribute will have to be editable.
Message 38 of 41
giscivil92
in reply to: gary_s_wright

Actually, I have a lot of layouts and each layout has a unique kilometre how can define a field to read text from Excel !

Message 39 of 41
gary_s_wright
in reply to: giscivil92

Sorry, when you say each layout tab has a Kilometre value, how is this data expressed?
Is this kilometer figure a value of an attribute?
We may be able to use DataExtraction to extract the attribute value from a block….
Message 40 of 41
giscivil92
in reply to: gary_s_wright

this kilometre is not a value of attribute I wrote it manually for each layout separately!

but now I am looking for a way that I can arrange it automatically!

 

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

Post to forums  

Rail Community


 

Autodesk Design & Make Report