Field to use first 2 characters of layout name but drop leading zero if present

Field to use first 2 characters of layout name but drop leading zero if present

claimed4all
Advocate Advocate
1,497 Views
2 Replies
Message 1 of 3

Field to use first 2 characters of layout name but drop leading zero if present

claimed4all
Advocate
Advocate

So I am trying to get a two value field to populate on to my title block.  I am currently looking to pull those numbers from the frist two charcaters of my layout tab, and then drop the leading zero if present.

 

My tabs could currently be named as such = and my end result I am look for would be:

01A-TB = 1

12B-PROP = 12

09N = 9

12B-TEM = 12

 

I can currently get the first two characters by using this DieselExpression

 

$(substr,$(getvar, "CTAB"),1, 2)

 

Now is there any way to have that expression drop the leading zero?

0 Likes
1,498 Views
2 Replies
Replies (2)
Message 2 of 3

nrz13
Advisor
Advisor

You might get a better response to this question in the Customization Forum.

 


Work:  AutoCAD 2022.1.3, Windows 10 Pro v22H2 64-bit, Intel Core i7-8700K, 32GB RAM, Samsung 960 Pro SSD, AMD Radeon Pro WX 5100, 3 Dell Monitors (3840x2160)
Home: AutoCAD 2022.1.3, Windows 10 Pro v22H2 64-bit, Intel Core i7-11700, 64GB RAM, Samsung 980 Pro SSD, NVIDIA Quadro P2200, Dell Monitor (3840x2160)
0 Likes
Message 3 of 3

doni49
Mentor
Mentor

You'll need the "IF" statement within your diesel expression.

 

http://docs.autodesk.com/ACD/2010/ENU/AutoCAD%202010%20User%20Documentation/index.html?url=WS73099cc...

 

Use the substr function to find out if the first char is zero.  If it is, get the 2nd and 3rd chars -- if it's NOT, get the 1st and 2nd as you are now.



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.

0 Likes