Jump to content
Berbero

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

Recommended Posts

Berbero

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

Share this post


Link to post
Share on other sites
BIGAL

Your excel is no where near what you need

 

Sheet size x y

start pt x y

points x y

points x y

points x y

points x y

Share this post


Link to post
Share on other sites
Berbero

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?

Share this post


Link to post
Share on other sites
BIGAL

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

Share this post


Link to post
Share on other sites
Berbero

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?

Share this post


Link to post
Share on other sites
BIGAL

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.

Share this post


Link to post
Share on other sites
Berbero

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.

Share this post


Link to post
Share on other sites
BIGAL

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

Share this post


Link to post
Share on other sites
hanhphuc

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?

Share this post


Link to post
Share on other sites
BIGAL

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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×