Guptil Posted January 16, 2018 Posted January 16, 2018 I have a Excel sheet showing around 500 drawings numbers and i would like to create just dwg files with the same drawings numbers as shown in excel. any help in this regards will be highly appropriated. Quote
BIGAL Posted January 17, 2018 Posted January 17, 2018 Like maratovich lots of missing answers here. Do you just want to create blank dwgs with a new name ? Do they need to have something drawn inside each one ? Do they ned a title block created with dwg name ? 500 blank dwgs can be done outside autocad by copying a predefined dwg using a batch file. Take advantage of excel to create. Quote
SunnyTurtle Posted January 17, 2018 Posted January 17, 2018 (edited) I would use a batch file like the one below setLocal EnableDelayedExpansion SET count= for /f "tokens=* delims= " %%x in (c:\Temp\filelist.csv) do ( REM ["-----template file to be copyed-----"]["-----location of new files-----\%%x"] cOPY "[color="red"]Template File[/color]" "[color="red"]New file location[/color]\%%x" /y ) endlocal The filelist.csv would have to be in the following format. drawing 1.dwg drawing 2.dwg drawing 3.dwg drawing 4.dwg drawing 5.dwg Edited January 17, 2018 by SunnyTurtle 1 Quote
Guptil Posted January 17, 2018 Author Posted January 17, 2018 Like maratovich lots of missing answers here. Do you just want to create blank dwgs with a new name ? Do they need to have something drawn inside each one ? Do they ned a title block created with dwg name ? 500 blank dwgs can be done outside autocad by copying a predefined dwg using a batch file. Take advantage of excel to create. Just Empty drawings with a name as shown in excel sheet. Quote
Guptil Posted January 17, 2018 Author Posted January 17, 2018 I would use a batch file like the one below setLocal EnableDelayedExpansion SET count= for /f "tokens=* delims= " %%x in (c:\Temp\filelist.csv) do ( REM ["-----template file to be copyed-----"]["-----location of new files-----\%%x"] cOPY "[color="red"]Template File[/color]" "[color="red"]New file location[/color]\%%x" /y ) endlocal The filelist.csv would have to be in the following format. drawing 1.dwg drawing 2.dwg drawing 3.dwg drawing 4.dwg drawing 5.dwg Where is thumbs up button..:thumbsup: Thanks allot. It works like a champ. Quote
SunnyTurtle Posted January 17, 2018 Posted January 17, 2018 Where is thumbs up button..:thumbsup: Thanks allot. It works like a champ. Glad to help Quote
Mushtaq86 Posted August 7, 2018 Posted August 7, 2018 Hi All, Hope I am not too late here. I am at rookie level at VBA in excel and totally new to VBA in CAD. I am also have the same requirement as that of Mr. Guptil. Till yesterday I was looking for a VBA code in excel. Can anyone guide me through this. Thanks in advance. Quote
maratovich Posted August 7, 2018 Posted August 7, 2018 I am at rookie level at VBA in excel and totally new to VBA in CAD. You need to study the connection from Excel to AutoCAD. If there is no time - you can use it. CopyFile.zip 1 Quote
BIGAL Posted August 8, 2018 Posted August 8, 2018 Nice maratovich simple excel copy the E column to notepad save as a batch file .BAT and use CMD from windows all done. Quote
Mushtaq86 Posted August 8, 2018 Posted August 8, 2018 Dear Maratovich, Thanks for the attachment. It is helpful to some extent. Quote
Mushtaq86 Posted August 8, 2018 Posted August 8, 2018 @ maratovich... thanks for the response and attachment. @Bigal: thanks for the "batch" file process explanation. Both options are helpful to an extent. Anyways, i will keep on exploring other options and post here when find any suitable. Cheers !!!! Quote
Mushtaq86 Posted August 8, 2018 Posted August 8, 2018 Dear Bigal, Thanks for the explanation of batch process. Though renaming isn't accepting "spaces", it is also helpful to some extent. Thanks again. Quote
hanhphuc Posted August 30, 2018 Posted August 30, 2018 (edited) Here's another method creating multiple new drawing by LISP (defun c:newdwg (/ dwg dwgname str l i ls ok fold fn) ;hanhphuc (if (not *start-End*) (setq *start-End* "1-10") ) (if (and (setq dwgname "Drawing " ; <-- default output prefix dwg (getenv "lasttemplate")) (setq str (getstring (strcat "\nEnter start-end number [" *start-End* "] : "))) (setq *start-End* (cond ((and (/= *start-End* "") (= str "")) *start-End*) ((wcmatch str "#*-*#") str) (t "1-10") ) ) (setq l (read (strcat "(" (vl-string-translate "-" " " (read *start-End*)) ")"))) (setq i (1- (car (vl-sort l '<))) fold (acet-ui-pickdir) ) ) (progn (repeat (1+ (abs (apply '- l))) (setq ok (vl-file-copy dwg (setq fn (strcat fold "\\" dwgname (itoa (setq i (1+ i))) ".dwg")))) (if (not ok) (setq ls (cons fn ls)) ) ) (princ (strcat "\nTotal "(itoa (- (apply 'max l)(length ls))) " new drawings created.")) ) (princ "\nInvalid file name or folder") ) (if ls (progn (princ (strcat "\n" (itoa (length ls)) " duplicate files : ")) (foreach x (reverse ls) (terpri) (princ x)) ) ) (princ) ) In order to minimize user input, get rid of 'getstring' for output drawing prefix also use minus sign '-' as delimiter upon prompt for input. Command: NEWDWG Enter start-end number [1-10] : 1-10 Total 7 new drawings created. 3 duplicate files : C:\Users\hp\Desktop\CAD\Drawing 1.dwg C:\Users\hp\Desktop\CAD\Drawing 2.dwg C:\Users\hp\Desktop\CAD\Drawing 3.dwg Edited August 30, 2018 by hanhphuc 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.