Jump to content

Automating CAD Dwg by attributes from Excel


Recommended Posts

Posted

Hi All,

 

I am really hoping some of you real smarties can help me out with this.

 

I work for a company who's trying to automate the production of their mechanical and electrical cad drawings. We eventually want to integrate this into our website, so that a customer can select a few options, and a detailed drawing is generated based on what they pick.

 

To begin with, I'm trying to integrate AutoCAD with MS Excel. I've managed to automate in excel the options a customer can choose from. Now, the tricky part is, how can I trasmit information to AutoCAD to perhaps pick blocks and strategically place them in specific locations of the drawing.

 

For example, if I have the option of Cats, Dogs, Elephants and Monkeys, and I have the option of quantities... 1, 2, 3, 4, 5, and I pick 3 Monkeys and 2 Cats, I want CAD to be able to place 3 monkeys and 2 cats side by side in a row.

 

I hope my problem makes some sense... and I certainly hope someone can help! :)

 

Thanks in advance!

Posted

You would be looking at VB or VBa to perform this, ideally using Access and not Excel.

It's relatively straighforward stuff, but not an easy thing to achieve for a beginner.

First off, you need all the rules and criteria for the drawing to follow... what if this.. what if that... block spacing etc

Most of what you need is already in the help files, it's just a case of searching to find the bits you need and then stringing them all together.

unless you have a lot of time to develote to this, you may want to look at hiring the services of someone to write the program for you

Posted

Thank you!

 

I just needed a general direction from where I could begin searching further. I looked a little into AutoLISP routines, but it didn't seem exactly relevant. Anyway, I'll look into Visual Basic as you suggested.

 

Just a followup question though... what is VBa?

  • 4 years later...
Posted

Hi All,

 

May be this is a very old thread , but i am facing similar issue in the product developed at my company.

 

All the Google search done so far yields AutoLISP as the best option for automating Autocad Electical drawings. Is it possible to use Excel or VB .NET for the similar task ? Any directions to start in this area will be immensely helpful.

 

Thanks,

Manil

Posted

One thing often overlooked is the ability for excell to write a script that can be used by Autocad this is a pretty simple way of achieving a result its not as good as an integrated solution but works.

 

If you want 4 monkeys then script is

Insert monkey 1,1 1 1 0
insert monkey 1,2 1 1 0
insert monkey 1,3 1 1 0
insert cat 1,4 1 1 0
insert cat 1,5 1 1 0

 

Excel has VBA as its macro language so just record a macro that would do the script above and thats where you can start

Posted
One thing often overlooked is the ability for excell to write a script that can be used by Autocad this is a pretty simple way of achieving a result its not as good as an integrated solution but works.

 

If you want 4 monkeys then script is

Insert monkey 1,1 1 1 0
insert monkey 1,2 1 1 0
insert monkey 1,3 1 1 0
insert cat 1,4 1 1 0
insert cat 1,5 1 1 0

 

Excel has VBA as its macro language so just record a macro that would do the script above and thats where you can start

 

In that example, what does

1,1 1 1 0

represent? Is it a coordinates array or something?

Posted

Thanks for the reply BIGAL !

 

Is there any tutorial which can tell me how to link Excel & AutoCAD ? (I am using 2008 version currently)

Posted

"Insert monkey 1,1 1 1 0"

 

Insert - command name

monkey - name of item (block) to insert

1,1 - insertion coordinates

1 - x scale

1 - y scale

0 - rotation angle

 

It's just an automated Insert command via a script file.

Check out the help for "Script".

It's a very basic, simple type of Macro for AutoCAD.

Posted (edited)

Thanks Arizona I just typed it so hoped it was right, suprised no one commented on 3 monkeys 2 cats.

 

Back to simple excel you need to create a new line for each insert the number of lines will be from a excel cell value and say the next value the bock name you may also want to put a starting point co-ords and block spacing.

 

25,55 50

3 monkeys

2 cats

 

becomes

Insert monkey 25,55 1 1 1 0
insert monkey 75,55 1 1 0
insert monkey 125,55 1 1 0
insert cat 175,55 1 1 0
insert cat 225,55 1 1 0

 

this is pretty easy to create in excel without a program just set up your columns with the answers and have a final column that uses the concatenate command you can copy and paste this last column directly to autocads command line.

 

25 55 3 monkeys 1 1 0 insert CONCATENATE (e1," ",a1,",",b1," ",c1," ",d1," ",e1) = insert 25,55 monkeys to make life easier use a blank column for the space in between cells.

 

1st go For me I would write out a txt file from excel and then just read it via lisp asking for start pt.

 

2nd go would be to use the excel to autocad route which requires knowing how to jump between excel and autocad to retrieve information. It would still use a lot of the code in 1st go.

 

Bottom line here how many are you doing a day will determine the level of complexity. Search the posts here for excel it is a bit long winded but there are good examples.

 

Can you post the excel ?

Edited by BIGAL
  • 1 month later...
Posted

hi Sigma,

 

that was my problem before ad iam not sure if this still currently your problem. Iam a autodesk product user for a decade and i really tried hard to combine excell or access and everything. i found the solution and i can now automate evrything just by inputing dimensions to excell table if you want ad every cofigurations follow..no need to go into command prompt anymore...if youre still interested just email me ad i will automate your drawinngs in instant...maybe i can help you.

Posted

Flight28

This site is not "e-mail based". If you wish to share with others some valuable content you could describe or even show us a short video about the solution you found.

This is how this forum works: we come here and we learn the each from the others in a very friendly manner.

  • 2 years later...
Posted

Can you tell us how did you do the automated drawings?

Do you have scripts to prepare Single line diagrams automatically??

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