CAD Forum - tips, tricks, discussion and utilities for AutoCAD, Inventor, Revit and other Autodesk products [www.cadforum.cz] ARKANCE | CONTACT | CAD ESHOP - CZ | SK | EN | DE
Over 1.077.000 registered users (EN+CZ). New 1D nesting and 3D nesting tools, updated Color converter. New AutoCAD 2025 commands and variables. Learn about twiGIS.
Plex.Earth connects AutoCAD and Google Earth

CAD tip CAD tip # 6606:

Question

CAD 
 %  platform  category 
A
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    115171×   FAQ  
Prices - CAD eShop:
applies to: AutoCAD · AutoCAD LT ·

See also:
Tip 14059:Import coordinates from CSV files into Fusion profiles.
Tip 12926:How to import point coordinates from Excel to AutoCAD?
Tip 12837:RenameCSV - rename layers, blocks, layouts, views, linetypes using Excel tables
Tip 10709:How to create a profile from imported XYZ points in Fusion 360?
Tip 3229:How to replace texts in many AutoCAD drawings? (regular expressions)


Back   All CAD Tips



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
  



Featuring:
Increase your productivity with our set of BIM add-on functions for Autodesk Revit
CADstudio Revit Tools More info


Please use these tips at your own risk.
Arkance Systems is not responsible for possible problems that may occur as a result of using any of these tips.
TOPlist