Search code examples
copyprogramming-languagesautocadbatch-rename

Code to perform multiple copies of AutoCad Electrical template drawings and rename


I am trying to create a script that will make copies of a template.dwg from AutoCAD Electrical multiple times (10 - 100 times) and rename it at the same time. I have seen programs like this online for excel workbooks but unsure if it will work outside of excel files.

My problem is I am not sure which language would be best suited for such a code. I have experience with C++, Java, Matlab, and just recently started playing around with VB and Macros.

I can make coppies of this file through windows explorer, but am hoping to streamline this process by using excel to make copies of files that are not excel.

Right now I am making one copy at a time and it takes up a lot of my time at work.

Is this possible? and if so what language would be best suited to do so?


Solution

  • BATCH FILE TO PERFORM MULTIPLE COPIES
    The following is batch (.bat) script to make multiple copies of a file, and works to make copies of AutoCAD dwg through the computer vs AutoCAD. This is written and tested on a PC platform. To run this copy and paste the script into Notepad++ and change the Lang. option to Batch, update the following line for the path of the file you wish to copy:

    set Pathname="C:\<enter file path to dwg to copy>"
    

    and then save. This will bring up a dialog box when ran promting the user for filename (template name) and number of copies deisired.

    `@echo OFF
    title File Duplicator
    color 0a
    :start
    set /P TemplateName=Please enter the template name you wish to copy:
    set /P NumberOfCopies=Please enter how many copies you wish to make:
    set Pathname="C:\<enter file path to dwg to copy>"
    cd /d %Pathname%
    :init
    for /L %%f in (1,1,%NumberOfCopies%) do copy %TemplateName%.dwg C:\Temp\%%f%TemplateName%.dwg