Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Help with exporting data from AutoCAD drawings into excel spreadsheet .............................................. 2
Range Import gives users the flexibility to import part of an Excel sheet.............................................. 11
Before importing your own spreadsheet ............................................................................................ 17
Import Excel drawing and symbol components................................................................................... 19
Update imported spreadsheet ........................................................................................................... 21
Spreadsheets imported with greater symbology precision and flexibility ............................................... 23
Excel to AutoCAD font mapping......................................................................................................... 26
Excel to AutoCAD cell shading/pattern mapping ................................................................................. 31
How to update Excel link .................................................................................................................. 36
How to unlink, relink imported Excel table ......................................................................................... 37
How to query a text and show linking info ......................................................................................... 39
Linking Excel to Text -- Import .......................................................................................................... 41
Linking Excel to Text -- Update ......................................................................................................... 48
Linking Excel to Text -- Explode Grouping .......................................................................................... 50
Linking Excel to Text -- Populating Data Feature ................................................................................ 51
Linking Excel to Text -- Populate Data .............................................................................................. 53
How to import Word text into AutoCAD or MicroStation ...................................................................... 58
Help with exporting data from AutoCAD drawings into excel spreadsheet
The problem:
I have an AutoLISP routine that I use to compile data created and embedded in drawings that are
electrical cable block diagrams. The data that is extracted is information of the pinning of and the type of
cable connectors of both ends of the cable. The AutoLISP routine can extract the data from cables on one
drawing sheet or many drawing sheets that are xreferenced in a temporary drawing. This AutoLISP
routine outputs the data as 8 x 11 cable connection sheets in AutoCAD drawing format.
What I need this AutoLISP routine to do now is output the same data in the same format into one (1)
Excel file with all of the cable connection sheets tabbed.
Here are two examples of how it works. Notice in the second example; it requires OpenExcel, one or
more calls to PutCell, and ends with CloseExcel.
Code:
(defun c:Get-Example ( )
;GetExcel - Stores the values from Excel into *ExcelData@ list
;Syntax: (GetExcelExcelFile$ SheetName$ MaxRange$)
(GetExcel "C:\\Folder\\Filename.xls" "Sheet1" "L30");<-- Edit Filename.xls
;GetCell - Returns the cell value from the *ExcelData@ list
;Syntax: (GetCell Cell$)
(GetCell "H21");Or you can just use the global *ExcelData@ list
);defun
(defun c:Put-Example ( )
;OpenExcel - Opens an Excel spreadsheet
;Syntax: (OpenExcelExcelFile$ SheetName$ Visible)
(OpenExcel "C:\\Folder\\Filename.xls" "Sheet1" nil);<-- Edit Filename.xls
;PutCell - Put values into Excel cells
;Syntax: (PutCellStartCell$ Data$) or (PutCellStartCell$ DataList@)
(PutCell "A1" (list "GP093" 58.5 17 "Base" "3'-6 1/4\""));Repeat as required
;CloseExcel - Closes Excel session
;Syntax: (CloseExcelExcelFile$)
(CloseExcel "C:\\Folder\\Filename.xls");<-- Edit Filename.xls
(princ)
);defun
For your project just use the format in the Put-Example function above.
There are several other options of the arguments explained in the function headings in the program
In any case, the problem seems to be that AutoCAD is importing the worksheet as a picture. If you only
want the worksheet's data--not a picture of the data--then you may consider getting the information into
AutoCAD in a different way. For instance, you might export the Excel data in CSV format (which is plain
text) and then import it into AutoCAD. Other intermediary formats may also fill the bill, but some
experimentation may be necessary.
One ExcelTips reader suggested following these general steps to make sure that the data is pasted
properly in AutoCAD:
1.
2.
3.
4.
To get the Excel data into the CAD model at the right size, it is necessary to zoom the model to the
correct size before you paste the Excel data. The simplest way is to attempt the paste the first time and
mark the width that you require by holding a piece of paper against the screen and marking the width of
the floating paste area on the paper. Then, escape and zoom the model to the required size and then
paste the data.
Office2CAD shows a rubber band outline for accurate placement when users import Excel sheet and Word text.
Office2CAD has the capability to populate single Excel table data into multiple drawings
In this tutorial, the Excel data is imported as the range of whole sheet. Office2CAD can automatically detect the las
the specified sheet and import cells ranging from cell A1 to the last used cell.
Step 1
Inside AutoCAD, Click on CADTool>>Import Excel Data from pull down menu
Step 2
On next dialog box click on Browse button
Step 3
Browse to C:\CADTool\tutorial\office folder and select tut01.xls
Click Open button
Step 4
In this tutorial we will try Sheet Import , not Range Import, so we leave Top Left Cell and Bot. Right Cell fields empty.
Go ahead to click on Start button to continue.
Step 5
Step 6
A rubber band box will show the imported table outline ( this feature is not available in AutoCAD 2000 version )
Place the table on your desired location in AutoCAD or MicroStation.
Users may have to Zoom Extent in AutoCAD to view the whole table.
10
Range Import gives users the flexibility to import part of an Excel sheet. Users can specify a
range in Excel sheet for importing.
Step 1
Inside AutoCAD, Click on CADTool>>Import Excel Data from pull down menu
Step 2
On next dialog box click on Browse button
Step 3
Browse to C:\CADTool\tutorial\office and select tut01.xls
Click Open button
11
Step 4
Follow instructions below to get import range's top left cell.
12
Step 5
Drag the dialog box to left so that you can view the import range's bottom right cell.
Step 6
Follow instructions below to get import range's bottom right cell.
13
Step 7
Click View Selection button, the import range will be highlighted.
Click Start button to continue
14
Step 8
As shown below, change text height from 10 to 2, width from 10 to 2.
Click OK button to continue
Step 9
A rubber band box will show the imported table outline ( this feature is not available in AutoCAD 2000
version )
Place the table on your desired location in AutoCAD or MicroStation.
Users may have to Zoom Extent in AutoCAD to view the whole table.
15
16
Office2CAD provides a command to trim Excel sheet and reset its last used cell.
Step 1
Click on CADTool>>Reset Excel Last Used Cell
Step 2
Browse to C:\CADTool\tutorial\office\ folder and open tut_bad_example.xls
Point your mouse to cell J8 and click on Reset button. It will reset the sheet's last used cell to cell J8.
Make sure to press Ctrl + End to verify that the last used cell has been reset.
17
When users encounter any problem on using Office2CAD, the first point to check is CADTool FAQ page.
Most of the time they can find solutions there.
18
19
Office2CAD is capable of importing Excel symbol components such as alpha, beta, sigma etc. User shall
separate these symbols from normal texts and put them in different cells, then map Excel Symbol font to
ACAD Symbol textstyle.
Try to import sample spreadsheet in C:\CADTool\tutorial\office\tut04.xlswhich has symbol components.
20
Step 3
All imported schedules in ACAD will get updated. Update status log file shows up in ACAD command line
window
To save update time, Office2CAD ignores Excel files which have no change and only update those files
modified since last import/update.
Office2CAD judges if an Excel file is changed or not based on the file's time stamp. Each time you save
an Excel file, the file's time stamp will be updated to current time.
21
If you have 10 tables coming from 10 different Excel files, Update All Tables will be the best
choice as it will only update the file which is modified based on its time stamp
If you have 10 tables coming from 10 different sheets containing in a single Excel file, Update
Selected Table will be the best choice as the time stamp decision does not work for this
scenario
Save Excel file only when you make changes on it. Do NOT save if you make no change,
otherwise it will trigger Office2CAD to update the imported table
To force an update, you must save the Excel file, otherwise it will be ignored during the update
22
For AutoCAD version, all existing text styles in your drawing will appear in Available
TextStyles in DWG list box. You can map font in Excel to any your predefined text style.
Office2CAD creates 2 true type font, Arial and Times New Roman, for you in advance and
automatically map the font for you.
For MicroStation version, all available fonts in MicroStation will appear in Available Fonts in
DGN list box. You can map your Excel font to any of them freely
Imported text and border line's color, layer (level in MS) and lineweight are all manageable
Border option gives you flexibility on importing table border. You can import based on actual
border in Excel, gridline in Excel, or import without any border line
Office2CAD will remember all your previous settings, and you need NOT to set these parameters
in every import.
23
24
25
Open Excel file C:\CADTool\tutorial\office\tut05.xls. This Excel sheet contains font Arial, Times New Roman, Impact, and
Arial Black. We will show users how to map these fonts to the same fonts into AutoCAD.
Step 1
26
as shown below.
Step 2
Similar to Step 1, create a new text style named Arial Black
27
Step 3
Click on CADTool>>Import Excel Data to sheet import C:\CADTool\tutorial\office\tut05.xls
Map XLS Impact to DWG Impact.
Step 4
Map XLS Arial Black to DWG Arial Black.
Click on OK button to place table in AutoCAD.
28
Step 5
We can find that
User can create any text style in AutoCAD, not only using Windows true type fonts, but also AutoCAD fonts such as
romans.shx or complex.shx. All Excel fonts can be mapped to AutoCAD fonts as well.
29
For the reason that Excel cell size is set to accommodate true type font, when a true type font is imported as an ACAD fon
it may run across the cell border. Office2CAD provides two scale factors to adjust this. Please refer to FAQ 3-4 for details.
In the next tutorial we will show users how to map Excel cell fill and pattern to any available AutoCAD hatch pattern.
30
In this tutorial we will show users how to map Excel cell shading/pattern to AutoCAD's hatch pattern.
The XLS Pattern Name corresponds to Excel cell pattern name as shown on the right.
User can map an Excel cell pattern to any available ACAD hatch pattern by editing the 2nd column.
31
The XLS Color Name corresponds to last two rows of Excel fill color as shown on the right.
User can map an Excel cell fill color to any available ACAD hatch pattern by editing the 2nd column.
Step 1
32
Step 2
Edit this file, set Light Yellow mapping to ACAD hatch pattern BRICK, Light Green to GRAVEL, set the Hatch Density to 0.5
Note:
Since users may try the import in different scale of drawing, setting Hatch Density to 0.5 may not produce the same result
as this tutorial. Users can try different values such as 5, 10 or 0.1 to get a better hatching output.
Step 3
33
We already show users how to import image, graphic shape, and cell fill color/pattern from Excel into AutoCAD.
Users can uncheck/check three switches below to disable/enable importing of these elements from Excel. These switches
give users more flexibilities to control the output of import.
34
35
Step 2
Click on any listed Excel file on the top box. The selected Excel file will appear in the Old Excel File
Path text field.
User can type/paste the new Excel file path into the second field.
Click on Change button to update all the links in this drawing.
36
Step 2
The link management dialog box will show you all current imported Excel table info with Excel file
path, sheet name and linking status. You can relink, unlink any table based on you needs.
37
38
Step 2
Click on any text in AutoCAD or MicroStation, it will show you the text's linking info
39
40
Step 3
41
Step 4
Follow instruction below to get top left cell of import range
42
Step 5
Drag the dialog box to left so that you can view the bottom right cell of import range
43
Step 6
Follow instruction below to get bottom right cell of import range
44
Step 7
Click View Selection button, the import range will be highlighted.
Click Start button to continue
Step 8
As shown below, change text height from 10 to 2, width from 10 to 2.
Click OK button to continue
45
Step 9
A rubber band box will show the imported table outline ( this feature is not available in AutoCAD 2000
version )
Place the table on your desired location in AutoCAD.
Users may have to Zoom Extent in AutoCAD to view the whole table.
46
47
Step 2
Click on CADTool>>UpdateAll Tables from pull down menu. The changes are updated in the
drawing.
Step 3
48
There is a dialog box showing you how the changes are made
Step 4
The update contents shown above are automatically written to a *.txt format log file in the same
directory of drawing.
You can trace all update history of your drawing in this log file
49
If users import the Excel data as a group, they are still able to explode the grouping using CADTool
command Explode Group command.
Double Click on the group name and the group will be highlighted
50
You may have 100 drawings and all their title block info, drawing no., name , scale,
rev no etc, is in an Excel table
All 100 drawings' title block texts are linking to the Excel table
When you make a change in Excel, the corresponding drawing's title block will be
automatically updated when it is open
You can prepare everything in Excel and have only one copy
You can import one drawing's text (one row or column in Excel) into one CAD
drawing, position the texts in title block
Prepare all you calculation in Excel and export it to CAD drawing without any
additional work
Prepare all you Bill of Material in Excel and link it to CAD drawing
51
Prepare all you specification data in Excel and export it to CAD drawing
52
Step 3
53
Click on the Sheet combo box and select Sheet 1, Excel will show Sheet 1 content as shown
below
Step 4
Select No Border, uncheck Empty Cell Is Updateable and Group All Import Contents, Click OK to
continue
54
Step 5
Place table as shown below
Step 6
Move imported text to its location in title block. You can move, rotate, scale these texts. All the changes
will be applied to populated drawings
55
Step 7
Save you completed drawing as Template.dwgin any location.
Step 8
Click on CADTool>>Populate Excel Data from pull down menu
Complete the form as shown below. Click Start to continue
56
Step 9
All populated drawings will be dumped into C:\CADTool\tutorial\ouput directory as specified in
above form
57
Step 2
Accept all defaults, click on OK button to continue.
Place the imported text in AutoCAD. User may need to Zoom Extent to view all the contents.
58
Note:
If users find every page's first line goes to last page, or every page's last line goes to next page, they
can check/uncheck the switch below to fix it.
If above line shifting applies to you, try a new import with check box below checked.
59
Step 3
Follow the same procedure to import C:\CADTool\tutorial\office\tut02.doc
User can find that all the format and symbol in Word are retained in AutoCAD.
60
Step 4
Make some changes on Word file and save the changes in Word.
Click on CADTool>>Update Selected Word File from pull down menu to update the imported
text.
Step 5
All the imported texts are grouped together with group name starting with WG_**. User can explode
the grouping using AutoCAD's group command.
61
62