CAD Forum - tips, tricks, discussion and utilities for AutoCAD, Inventor and other Autodesk products [www.cadforum.cz]
Cesky English Deutsch
Login/Register:
 Visitors: 2644 

CAD tip CAD tip # 6606:

Question CAD 
 %  platform  category 
Q - question

How to create AutoCAD geometry from Excel?

A - answer If you need to automatically "generate" AutoCAD entities (lines, arcs, polylines, splines, blocks, texts, 3D objects...) from X-Y-Z coordinates in an Excel spreadsheet, you don't need any LISP or VBA macros - you can just use AutoCAD script files.

Scripts are text files with sequences of AutoCAD commands - the same as if they were typed in manually on the AutoCAD command line.

Let's say we have a simple Excel table with XY coordinates for a spline curve:

Excel table

In Excel, save (export) this table to a CSV file (comma-separated values format), preferably without the "A" column (point numbers) and without the header - for large tables you can first select and copy/paste the contents of the coordinate-cells to a blank sheet and export this new sheet.

Open this .CSV file in notepad and add "SPLINE" as the first line (similarly, you can use PLINE e.g. to draw a graph). Make sure there are no surplus space characters anywhere. You should get something like:

Notepad data

Please note that on some localizations with comma as decimal separator you would need to perfom a replacement: ","¨"." and ";"¨",".

Save the resulting file to something.scr. Now just drag and drop this SCR file into your AutoCAD drawing window (or use the SCRIPT command). AutoCAD will draw the spline - just finish the command execution with specifying the missing spline tangents (just press Enter twice). This is the resulting spline curve:

AutoCAD spline

For more advanced import of coordinate geometry from Excel see XLS2Curve.

ACADLT
100% *  CAD 
30.3.2009    56160x   FAQ  
Comments   Tell a friend
applies to: AutoCAD · AutoCAD LT ·

See also:
Tip 9911:How to copy an AutoCAD DWG drawing into MS Word or other Office software?
Tip 9855:Overview of postprocessors available in the CAM software Inventor HSM 2015.
Tip 7226:Add a number to an attribute in all blocks.
Tip 7193:How to create DWG layers from a list in CSV/Excel?
Tip 6304:How to insert a live-updated XLS table in an AutoCAD drawing?


Back   All CAD Tips All CAD tips&tricks

How to copy views from another drawing? « | » How to get World coordinates from the ID command?

Have we helped you? If you want to support the CAD Forum web service, consider buying one of our CAD applications, or our custom software development offerings, or donating via PayPal (see above). You may also add a link to your web - like this "fan" link: CAD Forum - tips, utilities, blocks for Autodesk products
CAD:    OS:    Categ: 
Text:  FAQ glossary   



Featuring:
Extend your AutoCAD LT productivity with our popular add-on
CADstudio LT Extension More info


Please use these tips at your own risk.
CAD Studio (Xanadu) is not responsible for possible problems that may occur as a result of using any of these tips.
TOPlist