Easy way to get drawing numbers into the file name?

Easy way to get drawing numbers into the file name?

luke_cope
Enthusiast Enthusiast
2,222 Views
19 Replies
Message 1 of 20

Easy way to get drawing numbers into the file name?

luke_cope
Enthusiast
Enthusiast

trying to create a system where machine builders can acess DWG on an ipad. However it uses drawing names. 

 

Now when I add a drawing between 2 other drawings I have to Manually change the following drawings. any way to do this automatically. I can resequence the drawing numbers to show in title block but want this to go into the filename aswell. also the desc 1,2 and 3 identifies would be helpful.

0 Likes
2,223 Views
19 Replies
Replies (19)
Message 2 of 20

rhesusminus
Mentor
Mentor

There's no standard functionality to do this. It would be a really helpful tool, but...  Maybe @arshdeepsingh404 can program something 😄


Trond Hasse Lie
EPLAN Expert and ex-AutoCAD Electrical user.
Autodesk Expert Elite Alumni
Ctrl Alt El
Please select "Accept Solution" if this post answers your question. 'Likes' won't hurt either. 😉
Message 3 of 20

arshdeepsingh404
Advisor
Advisor

This could be most likely done with the AutoLISP program, I have done some resequencing with custom lisp programming before.
Let me know If that is something would be interested in and I can look into it.

Arshdeep Singh
Electrical Designer & Programmer
C.Tech | CAPM | CMSE | Autodesk Expert Elite
LinkedIn | Autodesk App Store | GitHub

Did you find this post helpful? Please feel free to Like this post.
Did your question get successfully answered? Please click the Accept Solution button to help other users who may have the same question.

EESignature

0 Likes
Message 4 of 20

luke_cope
Enthusiast
Enthusiast

@arshdeepsingh404 that would certainly be helpful. my experience with lisp is very limited i must admit. I assumed it could probably be done this way but wouldn't have a clue where to start. (only done list programming of tables generated from reports)

0 Likes
Message 5 of 20

arshdeepsingh404
Advisor
Advisor

I can write something for you, can you give me more information on the breakdown of the sequence you are trying to achieve.

 

Can you post screenshots of before and after of the drawings name.

 

Arshdeep Singh
Electrical Designer & Programmer
C.Tech | CAPM | CMSE | Autodesk Expert Elite
LinkedIn | Autodesk App Store | GitHub

Did you find this post helpful? Please feel free to Like this post.
Did your question get successfully answered? Please click the Accept Solution button to help other users who may have the same question.

EESignature

0 Likes
Message 6 of 20

rhesusminus
Mentor
Mentor

If you decide to do this, why not support %I %L %P %1 %2 etc. ? And even create some new ones like %PROJECTNAME %PAGEDESC1 %PAGEDESC2 etc . ?

 

Then, you configure in a dialog that you want your file names be like

"%PROJECTNAME - %S.DWG"

 

 


Trond Hasse Lie
EPLAN Expert and ex-AutoCAD Electrical user.
Autodesk Expert Elite Alumni
Ctrl Alt El
Please select "Accept Solution" if this post answers your question. 'Likes' won't hurt either. 😉
Message 7 of 20

arshdeepsingh404
Advisor
Advisor

Thanks for the suggestion Trond, This could be a good tool for many users.

 

Did you had something like this dialog box in mind?

arshdeepsingh404_0-1746152873929.png

 

@luke_cope Would this concept work for you?

Arshdeep Singh
Electrical Designer & Programmer
C.Tech | CAPM | CMSE | Autodesk Expert Elite
LinkedIn | Autodesk App Store | GitHub

Did you find this post helpful? Please feel free to Like this post.
Did your question get successfully answered? Please click the Accept Solution button to help other users who may have the same question.

EESignature

0 Likes
Message 8 of 20

luke_cope
Enthusiast
Enthusiast

Something like that would be brilliant I basically want it to go Drawing Number_Desc1_Desc2_Desc3. That way when I do a contents page they only have to look at the drawing number on the contents page and open that drawing and the ipad autocad will pull the drawings in order.

0 Likes
Message 9 of 20

rhesusminus
Mentor
Mentor

That would be over engineering in my opinion. Just go for a textbox, like the rest of AcadE, where you can type %-variables.

 


Trond Hasse Lie
EPLAN Expert and ex-AutoCAD Electrical user.
Autodesk Expert Elite Alumni
Ctrl Alt El
Please select "Accept Solution" if this post answers your question. 'Likes' won't hurt either. 😉
Message 10 of 20

rhesusminus
Mentor
Mentor

And to be even MORE flexible, maybe have placeholders for the project descriptions also... *[number] in the WDP file 😄

 

 


Trond Hasse Lie
EPLAN Expert and ex-AutoCAD Electrical user.
Autodesk Expert Elite Alumni
Ctrl Alt El
Please select "Accept Solution" if this post answers your question. 'Likes' won't hurt either. 😉
Message 11 of 20

arshdeepsingh404
Advisor
Advisor

Hi @luke_cope 

 

The program is not 100% complete, but it's in a working enough state for what you need it to do.

Make sure you create a backup of your project first before trying out this code!

 

When you load the program, you will get two commands:
RenameDrawings (with Dialog Box)

_RenameDrawings (without Dialog Box)

Here is a snippet of the dialog

arshdeepsingh404_0-1746499792283.png

All the drawing and project properties are available with the %codes. Thanks @rhesusminus for the concept.

 

Add your name config under the Configure Filename Edit box and click on the Update Button.

The Updated Filename will show the new drawing name.


When happy with he name, click on the Rename Button.

The video below demonstrates the lisp in action (both with and without dialog versions).

(view in My Videos)

 

Now the limitations of v1 of the lisp.

The project descriptions (LINEXX elements) are also not available yet, I don't think you need these anyway.

The lisp currently only supports one drawing at a time. I need to find some more time test and add batch processing functionality.


I realize that's not very helpful since you want to batch process these drawings. That's why I included the dialog-less version of the command which could be used by calling something like (_renamedrawings "%S-%1")

The benefit of the dialog-less command is that it could be added to a simple one-line script file (.scr) and there is a utility in AutoCAD Electrical which allows you to run scripts on multiple drawings (Batch Processing).

 

The attached PDF exactly explains how to run a Lisp file across multiple drawings.

 

Let me know if you run into any issues.

Arshdeep Singh
Electrical Designer & Programmer
C.Tech | CAPM | CMSE | Autodesk Expert Elite
LinkedIn | Autodesk App Store | GitHub

Did you find this post helpful? Please feel free to Like this post.
Did your question get successfully answered? Please click the Accept Solution button to help other users who may have the same question.

EESignature

Message 12 of 20

ccad2509
Advisor
Advisor

f you want a simpler way use the data extraction tool in plain autocad

 

here a tutorial

https://www.scan2cad.com/blog/cad/autocad-data-extraction/

 

once you have configured your block data extraction

 

just use the free software lupas rename

https://rename.lupasfreeware.org/

 

where you can cofiguer a complex renaming routine for files

 

use the extracted data to cut and paste into lupus rename

 

 

0 Likes
Message 13 of 20

luke_cope
Enthusiast
Enthusiast

That runs amazingly thank you. Only thing is can you change the project descriptions to drawing descriptions if possible. Also any way of running this one whole project?

Message 14 of 20

rhesusminus
Mentor
Mentor

The drawing descriptions is %1 to %3

Use the lisp version with the project wide tools to rename multiple files in the project. 

 

I hope @arshdeepsingh404 is also updating the project with the new file name. 


Trond Hasse Lie
EPLAN Expert and ex-AutoCAD Electrical user.
Autodesk Expert Elite Alumni
Ctrl Alt El
Please select "Accept Solution" if this post answers your question. 'Likes' won't hurt either. 😉
0 Likes
Message 15 of 20

luke_cope
Enthusiast
Enthusiast

Sorry yep didnt see the %1 etc. How do I run it project wide? do I need to create a .scr file?

0 Likes
Message 16 of 20

rhesusminus
Mentor
Mentor

Yes. Create a script with the lisp-command in it, and use it with the project wide utilities:

rhesusminus_0-1746529439607.png

 


Trond Hasse Lie
EPLAN Expert and ex-AutoCAD Electrical user.
Autodesk Expert Elite Alumni
Ctrl Alt El
Please select "Accept Solution" if this post answers your question. 'Likes' won't hurt either. 😉
Message 17 of 20

arshdeepsingh404
Advisor
Advisor

@rhesusminus Yes, I’m updating the project wdp file with the new name.

 

@luke_cope To run this project-wide, Create a .scr file and put the dialog-less version of the command in it like Trond said.

The PDF I attached with lisp explains how to do that.

 

Arshdeep Singh
Electrical Designer & Programmer
C.Tech | CAPM | CMSE | Autodesk Expert Elite
LinkedIn | Autodesk App Store | GitHub

Did you find this post helpful? Please feel free to Like this post.
Did your question get successfully answered? Please click the Accept Solution button to help other users who may have the same question.

EESignature

Message 18 of 20

arshdeepsingh404
Advisor
Advisor

Hi @luke_cope 

 

Were you able to run the command project-wide to get the desired naming format you wanted? Any issues?

 

Arshdeep Singh
Electrical Designer & Programmer
C.Tech | CAPM | CMSE | Autodesk Expert Elite
LinkedIn | Autodesk App Store | GitHub

Did you find this post helpful? Please feel free to Like this post.
Did your question get successfully answered? Please click the Accept Solution button to help other users who may have the same question.

EESignature

0 Likes
Message 19 of 20

luke_cope
Enthusiast
Enthusiast

This worked very well. Only issue was it displayed the screen for every drawing. Also any way to change from default %F so I can make it default to what I want?

Message 20 of 20

arshdeepsingh404
Advisor
Advisor

Yes, change Line 160 for setting the default configuration field value.

 

arshdeepsingh404_0-1747270706755.png

 

 

"Only issue was it displayed the screen for every drawing."

This is because the sheet and drawing numbers are stored in the "WD_M" block on existing drawings, so I do have to open every drawing to read its local attributes.

 

Arshdeep Singh
Electrical Designer & Programmer
C.Tech | CAPM | CMSE | Autodesk Expert Elite
LinkedIn | Autodesk App Store | GitHub

Did you find this post helpful? Please feel free to Like this post.
Did your question get successfully answered? Please click the Accept Solution button to help other users who may have the same question.

EESignature

0 Likes