Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Importing from a program (Excel) to AutoCAD 1

Status
Not open for further replies.

RFreund

Structural
Aug 14, 2010
1,873
0
36
US
What options are there to import a set of data into autoCAD either as a dxf or have autocad draw it.

Basically I would like to have a graph that was created in excel be a polyline in autocad but thats not all. I would also like a grid to be drawn as well. I know that I can write scipts for the graph poly lines and probably for the grid as well but are there other ways?

How do programs that export there 'drawing' or 'data set' to excel operate? How are they communicating with AutoCAD?

This may be a pretty involved topic so maybe a reference would be most helpful. I know almost nothing about LISP's would it be help to start here or maybe there is a way to use VB/Macro's in excel?

Thanks!

EIT
 
Replies continue below

Recommended for you

Thanks guys!

I'm not sure how I can you use the file insert or input commands. I mean you can insert different files but I'm not sure how to create those files. Also I'm not trying to show the actually sheet. I am basically drawing an object (like a graph) with excel functions and wanting the result to be drawn in autocad.

Cherrypicker - thanks this may prove to be a solution.

I am still curious though how do other programs communicate their outputs with AutoCAD? Usually I see they are imported as .DXF files.

EIT
 
It sounds like you are wanting to import the data points in X,Y format so AutoCAD connects them with a continuous line. This is not hard. Of course if you are just looking to have the Excel chart in CAD, you can use Copy/Paste.
 
IFR's yes I want autocad to connect lines in X,Y format. I currently have a couple scripts for a couple of poly lines but I'd like to expand on this. When you say this is not hard are you referring to scripts?

Ideally I would like to be able to define the line types, color, even add text or a leader line. Now I'm guessing I wouldn't be able to do all that in excel but do you know of a different program or how I could use to create such a program? I guess this is almost getting into software creation.

EIT
 
If you learn the syntax of the dxf file you can do just about anything. For instance, in cad, create a sample, then use DXFOUT or SaveAs DXF and open the DXF file in Notepad. You will see the various codes that define layers, colors, etc. Essentially you can make a dxf file that is almost anything.
 
IFR's - aaahh, yes. I should have thought of that. Another good leed. I am not very familiar with many coding languages. I have some experience with php but I image this is a different animal.

Any suggestions on where to start with this, any references?

Basically I have a series of data points that are the result of excel equations. I need to take this information and get it to excel. I'm just struggling on how to put this all together.

EIT
 
I have not personally tried it, but it should, in theory, be possible to make Excel generate a proper DXF file, given that a DXF file is a text file containing no binary information, and the file format is documented.

I will volunteer a little caution about the effort. Autodesk's supporting information for DXF makes some sly digs at competitive products, stating that a program that must read DXF files as input should be flexible about the order and format in which DXF elements are presented, because according to the documentation, there should be several legitimate ways to organize the information in a DXF file.

Ironically enough, AutoCAD itself is one of the more fussy readers. It is possible to generate DXF files that other CAD programs can read without error, and which AutoCAD will barf upon.

So the most logical way to proceed is to generate a nearly-null DWG file in AutoCAD, e.g. something with just one line, export it from AutoCAD as a DXF, and then use that as a template for what Excel must generate. In particular, you can capture and 'can' the required preamble and postamble generated by AutoCAD, and set up Excel to spit those out from fixed files, or to generate preamble and postable in exactly that format, and to interpose the geometry you wish to export in the documented way.

Good luck and have fun.


Mike Halloran
Pembroke Pines, FL, USA
 
Thanks guys. It should be interesting. I have always been intrested in coding and software development so hopefully I can learn something here.

I'm still debating whether to write a fairly involved script or try and generate a dxf file. I believe in the long learning the how to generate a dxf file will be more useful.

Just a little background on where this stems from - there are a couple different segmental block retaining wall manufactures that have software which allows you to enter top of wall and bottom of wall points. This then automatically generates the retaining wall which you can export to a pdf with some notes and a grid, etc. I would like to develop something similar but this does not need to be its own program as it would be for my use only.
I wonder if it would be worth while to use a programming language and try do the whole thing in a program editor..hhmmm...

EIT
 
I have written many routines in Basic, QBasic, etc to create complete drawing dxf files. Once you get used to the syntax, it is tedious but not hard.
 
IFRs -

Please forgive my terminology and general lack of knowledge here:

In excel I have equations which result in different x,y values for different poly-lines. Can I then write a program using VBA in excel to pull these vales from the worksheet and into the code/syntax needed to create the dxf file?
Or is there a better way to do this?

Also is there any particular resource that you would suggest. It sounds like saving a DXF file and analyzing it is a good way to go also I found the autocad dxf referance manual:

Thanks again

EIT
 
Status
Not open for further replies.
Back
Top