Quick to the Diesel

Edit -As noted in the comments below – the original post had a typo in the line of code, SUBTR should actually be SUBSTR. Yet another reason to have values auto populate.  🙂

Scene: There we are, reviewing the title block and someone asks, can the title block have text be automatically generated based on a portion of the file path?

Mission: find a way to make the scene happen….

My first thought was to ignore the obvious – enter the desired text by hand into the appropriate sheet set field and move on. But that simply defeats the “automatically generated” aspect. Then, I thought, how do I build an expression in a field?

Several help and forum searches guided me to the ancient AutoCAD language of DIESEL, which stands for – I have no idea. According to Dietmar Rudolph, it stands for “Dumb Interpretively Evaluated String Expression Language” which you can download apparently and include in your apps if you so desire.  I soon found myself browsing the different functions to see which could help me.

After some trial and error, I again turned to the Google Genie.  And there it was, a link that used a similar reference. Although in his case, the desired text string has variable length, making it a bit more difficult. My solution had a fixed length and place in the file path. Here’s an example:


We want to grab the 2 digit number and 6 digit number and have it display like this:


So, re-using his methodology, I tested to see if I could just grab the first 2 digits. My expression began like this:

$(SUBSTR,$(GETVAR, DWGPREFIX),4,2) and yielded 50

Success! That worked? So, now I can grab the remaining digits but how do I get the dash to display? At first I tried using “-” after the field.

That gave me 50″-” as a result. Ah hah! I’m on to you DIESEL. So I took out the quotes and ran with my expression:


The field returned 50-6103-02, exactly what was desired! Now, I can simply place this field in the title block and not have to populate the sheet set property.  Moving forward though, it would be extra beneficial to grab this value and place it in the sheet set ProjectNumber property so I can search based on project number in the Vault…. but that’s another day.


About Kevin
Hi… I am a husband, father, brother and neighbor. I am employed as a Civil Engineer and have enjoyed playing the drums for the last 30+ years.

2 Responses to Quick to the Diesel

  1. Neil Jones says:

    You’ll probably find that the command is SUBSTR rather than SUBTR – that caused me some headscratching 🙂 🙂


    • Kevin says:

      Thanks! That’s exactly my point, although completely unintentional. I’ve updated the blog post accordingly.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: