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: 

Help with a Diesel script

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
chado
589 Views, 5 Replies

Help with a Diesel script

Hello,

 

I was wondering if someone might be able to help me figure out a small diesel script for pulling some characters from files names of drawings

 

eg,

i have dwg files with a naming scheme that looks like this.

01-C0-01.dwg
02-C0-02.dwg

03-C1-01.dwg

04A-C1-02.dwg <---

04B-C1-03.dwg <---

etc

 

i would like the script to display the first 2 characters of the file name which i have below.

$(substr,$(getvar,dwgname),1, 2)   

 

but also display the 3rd (A or B or C) character in the file name only if the 3rd character is not a - (hyphen)

 

i guess my first question is this possible? becuase i have been trying with no luck and with limited knowledge of diesel scripts etc.

 

Thank you very much

 

5 REPLIES 5
Message 2 of 6
doni49
in reply to: chado

Here's a link to the if function in the Deisel help. 

 

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



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 3 of 6
chado
in reply to: doni49

hi again

 

thank you i have been toying around with that function for a while now and cant seem to make it work not sure how to implement it into the ex script i have

 

thanks again for any help you can give

Message 4 of 6
doni49
in reply to: chado

$(if,$(eq,$(substr,$(getvar,"dwgname"),3,1),"-"),$(substr,$(getvar,"dwgname"),1,2),$(substr,$(getvar,"dwgname"),1,3))

 

Edit:  I had the false and true conditions backwards -- if the third character was a hypen, then it showed it.  It's switched.



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 5 of 6
chado
in reply to: doni49

Thank you very much it works perfect and now i see where i went wrong

 

Thank you Smiley Happy

Message 6 of 6
doni49
in reply to: chado

Happy to be of assistance.



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.

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

Post to forums  

Rail Community


Autodesk Design & Make Report