Print Page | Close Window

Diesel Field Expression - If Statement

Printed From: CAD Forum
Category: EN
Forum Name: AutoCAD
Forum Description: Discussion about AutoCAD and AutoCAD LT, viewers, DWG and DWF formats, Design Review, AutoCAD 360, add-ons
URL: https://www.cadforum.cz/forum_en/forum_posts.asp?TID=11859
Printed Date: 01.Jun.2026 at 01:23


Topic: Diesel Field Expression - If Statement
Posted By: martingtc
Subject: Diesel Field Expression - If Statement
Date Posted: 17.Jun.2016 at 10:30
Hi, I'm new to the world of fields and diesel (using 2008 LT so I dont have a right click menu)

I've managed to set up some auto fills based on partial filenames etc. One I'm stuck on is a drawing ref


Basically we call our drawing files a 5 digit reference. I have done this one.
Our sheet numbers are 3 digits, again, this is sorted.

When we revise the drawing, it will become XXXXX-Rev01. I'm trying to add the -Rev01 part to the sheet number which I can do, but if the drawing is not yet revised (so still XXXXX) it shows up as ----

I'd like to remove these and show blank, unless there is a -Rev01, then show that if that's the case.


Can anyone help??

Thanks in advance



Replies:
Posted By: martingtc
Date Posted: 20.Jun.2016 at 09:51
Can anyone help??


Posted By: Vladimir Michl
Date Posted: 20.Jun.2016 at 10:01
This DIESEL expression will take the drawing name from the sixth character:
 
$(substr,$(getvar,dwgname),6)
 
You can combine it with $(if - based on string length or the "Rev" substring.
 


-------------
Vladimir Michl (moderator)
ARKANCE - https://arkance.world" rel="nofollow - https://arkance.world - Autodesk Platinum Partner


Posted By: martingtc
Date Posted: 20.Jun.2016 at 12:25
Can you explain the IF side of it please?

Example;

Drawing no. 101 - my paperspace (at the moment) shows 101 - perfect

filename 12345-Rev01
I want my paperspace to show 101, but also the -Rev01 from the filename. I can get this to work, but only if there is a Rev.

If the file is 12345, the paperspace titleblock shows 101----

:( I'd like to hide the dashes if there are no characters to show and I'm so new, I don't know how to control an IF statement just yet

Thanks,

[edit, the 101 drawing no. is pulled from a tab, the Rev01 needs to be pulled from the filename - so in theory 2 different diesel expressions next to each other?]


Posted By: martingtc
Date Posted: 21.Jun.2016 at 09:25
Anyone please? It's for work and I'm really struggling :(


Posted By: martingtc
Date Posted: 24.Jun.2016 at 15:34
Anyone?



Print Page | Close Window