Jump to content

Generate mutiple AutoCAD drawings from data stored in an Excel file.


Berbero

Recommended Posts

Dear smarties

I read a few articles here and there regarding a way to generate multiple drawings from an excel file, but no one had explained step by step on how to do it. So, I am lost half way. I am very new to this kind of things, but I will try to follow, so please go slow on me.

here is what I want to fix:

1. I need to automatically generate 10 drawings both in dwg and pdf copied into a folder.

2. All the variables (VAR1 to VAR3) are stored in an excel file. refer to the attached files as an example.

3. I only need to create one original drawing, which will be used to generate all the 10 drawings.

 

 

Please help

 

 

 

 

 

 

EXCEL-VAR.xls

ORIGINAL-DWG.dwg

Link to comment
Share on other sites

BIGAL, thanks a lot for your reply.

I may be wrong with the excel file I shared, but I don't know any better.

As long as I explained what I wanted, so if there is anything that I should add in the file, please let me know.

Could you please help me with a working sample and all the steps that I need to follow to get it to work?

Link to comment
Share on other sites

If your doing closed shapes then just enter in excel the difference in X Y then you need to write a script from this entry or copy column. You need to use "concatenate" in excel.

ScreenShot035.jpg

Link to comment
Share on other sites

BIGAL

Thank you for the example, but you didn't understand what I am trying to achieve. Let me re-explain what I want:

I have a drawing in AutoCAD (Already drawn) with a drawing number VAR01, the variable width of the shape VAR02 and the variable height of the shape VAR03.

Meanwhile, I have all the variables VAR01, VAR02 and VAR03 in a spread sheet.

I want to generate all the shop drawings automatically from that spread sheet without the need to actually draw every drawing separately one by one especially if I had 100s of drawings to generate.

Would you have a solution to that?

Link to comment
Share on other sites

I blieve I understand you, a shape 3 side a shape 4 side a shape 5 sides you can not have a auto solution, (you can but not right now) you need to post a excel that means something not just var1 var2 var3 etc we dont have a clue. I am more than happy to say you can draw an object from excel data, but it must make sense. The example I posted as a beam 4 lines and holes in it just cahnge some numbers in excel and get next beam.

Link to comment
Share on other sites

BIGAL

I know there is a way using either AutoLisp, VB and/or connect Excel/CSV files to AutoCAD with a small code that to connect and run the generation of the shop drawings.

Your solution is not what I am after and I am not planning to enter coordinates to DRAW anything but only to replace text/Block/etc within the original shop drawing and print out all the rest in either pdf or dwg into a folder.

As you can see, that's very different that what you were suggesting, but thank you for trying to help.

Link to comment
Share on other sites

Ok my final real big hint others know what I am talking about search here for "SHAFT" & Excel. Autocad about 10+ years ago supplied a sample drawing called "shaft" and a excel called "shaft" change the values a cell in the excel and watch the drawing of a shaft change in Autocad. I have no idea why they no longer put it in their samples.

 

Its a dynamic block linked to a excel.

 

Trying to find, a google post "Does anyone remember the shaft.xls sample which used to ship with R12 " it is here.

 

search for Ibeam3d.dvb in c:\programfiles\Autocad\Autocad...xxx \samples\vba

VBAMAN and load Ibeam3d

Link to comment
Share on other sites

1. I need to automatically generate 10 drawings both in dwg and pdf copied into a folder.

2. All the variables (VAR1 to VAR3) are stored in an excel file. refer to the attached files as an example.

3. I only need to create one original drawing, which will be used to generate all the 10 drawings.

 

 

Please help

 

 

 

hi, my $0.02 of workaround

1. actually you can save your VAR in *.txt or *.csv

VAR1 VAR2 VAR3

Dwg1 Dim1 Dim11

Dwg2 Dim2 Dim12

Dwg3 Dim3 Dim13

Dwg4 Dim4 Dim14

 

2. use read-line to obtain contents then split as list

;example:

(setq dwg '(("VAR1" "VAR2" "VAR3")
    ("Dwg1" "Dim1" "Dim11")
    ("Dwg2" "Dim2" "Dim12")
    ("Dwg3" "Dim3" "Dim13")
           ("Dwg4" "Dim4" "Dim14")
    )
     ) ;_ end of setq

 

 

3. copy the source drawing according to list

(if (and (setq fn (findfile [color="red"][b]"ORIGINAL-DWG.dwg"[/b][/color])) (setq l (fnsplitl fn)))
 (foreach x (mapcar 'car (cdr dwg)) 
   ([color="blue"]vl-file-copy[/color] fn (apply 'strcat (subst x (cadr l) l)))
   ) ;_ end of foreach
 ) ;_ end of if

 

now we open the newly created drawing, example "Dwg3.dwg"

all handles are identical for each copied drawing,

(mapcar '[color="blue"]handent[/color] '([color="red"]"1f6"[/color] [color="#006400"];VAR1[/color]
	   [color="red"]"1f9"[/color] [color="green"];VAR2[/color]
	   [color="red"]"212"[/color][color="green"] ;VAR3[/color]
	   ))[color="green"]
;(<Entity name: 7efa13b0> <Entity name: 7efa1408> <Entity name: 7efa1490>)[/color]

 

 

4. finally, since new drawings have been created,

BIGAL can give some advise using script to modify entities?

Link to comment
Share on other sites

Ok I realise now how to do it 3 steps and yes you can have single cell entries like 200 50 100

 

1 make a dynamic block for each basic shape 3, 4, 5 side etc

2 pretty sure Lee-mac has dynamic block update code

3 use something like getexcel.lsp to read spreadsheet

 

see d1 d2 d3 these are your Vars I dont play with dynamic blocks so can not help much.

Screen Shot 02-05-16 .PNG

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...