Paul Hanson Posted March 19 Posted March 19 I'm looking to use DIESEL expressions to automate some of the work involved in filling in title block attributes for drawings. Specifically, I'm looking to fill in a drawing number field, two drawing title fields and a revision field, each of which I would like to be populated with different substrings of the drawing file name. My drawing filenames following the following format: 0000-00-0000 Customer Name - Drawing Title Rev X ...where the leading digits will be different each time but always in the 4-2-4 format shown, followed by a customer/client name (the length of which will vary from customer to customer), followed by a hyphen and then a title for the specific drawing (again, the length of this field is variable). Finally, a revision number is appended to each file prefixed by 'Rev'; this could potentially by anything, but in practice will likely by a single letter (for example. 'A') or a number ('0.1', 2, or 11, to give examples). It's unlikely to be anything other than those, but I mention this just to point out that it could come in a number of different formats and isn't locked into being a single character. I've used the following expression: $(substr, $(getvar,dwgname), 2, 12) ...to give me my drawing number field, and it works well. Deriving the other fields is proving much tricker though, given that they're not of a fixed length. Does anyone know how to consistently pluck these values out of the drawing filename? Quote
BIGAL Posted March 19 Posted March 19 If you can use a lisp instead much easier, your profile says LT2019 so a problem. It may be worthwhile looking at Bricscad as it has Lisp and is an up to date program, you can purchase a perpetual license. Quote
Paul Hanson Posted March 21 Author Posted March 21 Thanks for replying. There's a distinct possibility that I might be getting an upgrade to LT 2025 pretty soon, and from what I've seen that should have Lisp support. Know of any good Lisp reference sources? Quote
SLW210 Posted March 21 Posted March 21 Can you post a drawing? What exactly are the sources for the rest of the information? You should be able to use fields, depending on source. AutoCAD 2024 Developer and ObjectARX Help | DIESEL Functions Reference | Autodesk I have a post or two on CADTutor about DIESEL, you might try a search. For LISP learning... Learn AutoLISP for AutoCAD productivity | AfraLISP Quote
Paul Hanson Posted March 21 Author Posted March 21 I've attached a copy of the template I'm working from. It identifies where I work but hey, does anyone really care? You can see from this how I've been able to populate a few fields in the title block using some very basic DIESEL expressions, but I'm having trouble populating the TITLE1 and TITLE2 attributes in the same fashion. I'd like if all these attributes can be derived from the filename if possible as it reduces the number of places that info has to be entered in. Thanks for the LISP reference. Some nice light reading to go through there, by the looks of it! 9999-00-1001 A1 Project - Description Rev 0.1.dwg Quote
BIGAL Posted March 21 Posted March 21 Just a comment as previously mentioned if you have lisp can get what you want as different values. One of the lisps I have is for multiple title blocks in layouts, just fill in one title block and all the details are copied to the other layouts. Stuff like rename & renumber layouts etc. Quote
SLW210 Posted March 22 Posted March 22 If still stuck with LT and no LISP, you might look into leveraging EXCEL. There was a member here did a whole lot of stuff with LT and Excel before LT had basic LISP ability. No guarantee that what you need done can be done in newer LT with LISP as it has limitations. I'll check your drawing when I return to work Monday. Quote
Paul Hanson Posted March 28 Author Posted March 28 Just chasing this up. Were you able to take a look at it? Absolutely fine if you weren't able to, just to be clear. Quote
SLW210 Posted March 28 Posted March 28 I do believe this will need adjusting on a case by case basis. AFAIK, DIESEL has no method to determine automatically the change in positions and lengths. Maybe see if this helps any... Solved: Diesel Expression on variable length drawing file names. - Autodesk Community shortening fields in attributes - AutoCAD Drawing Management & Output - AutoCAD Forums I moved your thread to the AutoLISP, Visual LISP & DCL Forum. Maybe there could be a LISP solution, but doesn't look simple to me. See this updated drawing and work with adjusting the numbers for different file names. 9999-00-1001 A1 Project - Description Rev 0.1 SLW.dwg Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.