Extracting filename to field

Extracting filename to field

JohnMartin6269
Contributor Contributor
2,107 Views
2 Replies
Message 1 of 3

Extracting filename to field

JohnMartin6269
Contributor
Contributor

Hello all,

 

I am looking for a way to extract a portion of the full filename of my drawings to a field for my titleblock on drawings. I can use DIESEL to extract part of it but am trying to figure out how to extract a portion of the filename UP TO BUT NOT INCLUDING the first space in the name. Example file names are as follows:

 

LUIB_A-101 FIRST FLOOR PLAN

LUIB_S-101A STRUCTURAL FLOOR PLAN AREA 1

 

What I want to extract is the bold portion of the file name, but this portion is not consistent in length. I am not sure how to accomplish this and would love some guidance on this issue. If they were the same length every time a simple DIESEL expression would work well, but the change in total characters is throwing me for a loop.

 

Thanks in advance.

 

John Martin

 

0 Likes
2,108 Views
2 Replies
Replies (2)
Message 2 of 3

Bob_Zurunkle
Advisor
Advisor

I don't know if what you ask is possible, but if you were to only name your drawing by the portion you want to show up, it's easy as pie! We do it all the time here. You can have a field look at the filename and report it without showing the full path or file extension. We name our parent files strictly by the project's job number.

Another thing I do is I name my layout tabs the same as the sheet numbers. That way, whatever is on that sheet that normally would have the sheet number, would now report it automatically in a field. The variable for that is CTAB.

If by some odd chance my nattering was useful -- that's great, glad to help. But if it actually solved your issue, then please mark my solution as accepted 🙂
0 Likes
Message 3 of 3

BrianBenton
Collaborator
Collaborator

I would approach this differently if it were me doing it. My first idea is to shorten the file names to just the number, the part you want to display. The rest of the file name might not really be needed any way. However, that might be out of your control. Your file naming procedures might be a company standard thing that you can not change.

 

What we do where I work is to use Sheet Sets. The file name is whatever, but then there are fields for Drawing number, Drawing title, or any custom item you want to create and use. Fields can see this data from a Sheet Set.

 

If you aren't using Sheet Sets then you can try putting the info in the Drawing Properties (DWGPROPS). There are several fields already there or you can create a custom field with any information there. Fields can get this info too similar to a sheet set.

 

dwgprops.JPG

Brian C. Benton

bbenton@cad-a-blog.com
http://CAD-a-Blog.com
twitter.com/bcbenton
www.facebook.com/CADaBlog


0 Likes