Jump to content

Creating dwg files (dwg. format) using Excel sheet.


Guptil

Recommended Posts

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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 by SunnyTurtle
  • Thanks 1
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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..:D:thumbsup: :thumbsup:

 

Thanks allot. It works like a champ.

Link to comment
Share on other sites

  • 6 months later...

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.

Link to comment
Share on other sites

@ 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 !!!!

Link to comment
Share on other sites

Dear Bigal,

Thanks for the explanation of batch process. Though renaming isn't accepting "spaces", it is also helpful to some extent.

Thanks again.

Link to comment
Share on other sites

  • 3 weeks later...

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 by hanhphuc
Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...