Hello everybody, my name is Felipe Gualberto, I'm new in this forum and am an Excel enthusiast.
I don't use AutoCAD often but I've been scrathing it's model object surface lately because I changed my job and am having to work with AutoCAD drawings.
I maintain a Microsoft Office/VBA website in portuguese (Brazil) at http://www.ambienteoffice.com.br
I'd like to share something with you: I created a free add-in called CADXL with vba code unlocked that has two tools:
(A) - Import an AutoCAD table (with borders from class AcadLine) to Excel.
(B) - Import texts objets (texts, mtexts and attributes) to Excel.
After the import, you can freely edit the text of the objects and the make the changes to reflect the text objects in the actual drawing.
I can do that because for (A) I used the Comment property from Excel's Range Object to keep the Handle property of each cell or text, so you can freely filter your data and even use tools for filling cells, as long you don't change the text of the Comment property of each cell.
For (B) I createad an auxiliar column that keeps the Handle property. I also decided to display the X and Y coordinates of each text object.
Attention: This Add-in works only with Excel 2007 or later.
As I said before, I don't know if such thing already exist. Probably it does, as I noticed this is a common request from coworkers. This tool has been helping our departament a lot.
The page (only in portuguese) of my addin is at http://www.ambienteoffice.com.br/suplementos/cadxl
I recommend visiting the website because even it has a lot of step-by-step pictures of how use the tool and I'm pretty that you can understand how it works even if you can't read portuguese.
The .rar direct link to download is http://www.ambienteoffice.com.br/suplementos/cadxl
This archive has 3 files: the actual Addin and two drawings.
How to use tool for a table (A):
1 - Open the file called CADXL.xlam. Excel will open and display a new menu in the ribbon called CADXL.
2 - Open the drawing called exemplo1.dwg. This drawing has a table with a text in each cell.
3 - Back to Excel, click on the CADXL menu and click on the button Obter Tabela (which means Get Table). When clicking, you may have the AutoCAD focus now. If you can't see, just Alt+Tab to AutoCAD.
4 - Select the entire table, including borders (you could select only a part of the tablea, but have to select the desired's cells' borders). After the selection, press Enter or right-click with the mouse.
5 - You will get the table at Excel. Make some changes and click the Executar Alterações button (which means make changes)
6 - Check your table in AutoCAD: the values you edited on Excel were changed.
How to use tool for a table (B):
Same as before, but try opening file exemplo2.dwg. Then, select the texts you want (including lines on your selection won't be a problem). You'll have all the texts at Excel. Edit them and click on the Executar Alterações button to reflect the changes at AutoCAD.
I'd like some feedback concerning my addin. What did you guys think? Is there another tool avaible for doing that? I might be reinventing the wheel. Worse yet, you guys don't use Excel at all.
For the code that gets a table, I had a pretty hard time because I had to create collections of X and Y lines intersections, then sorted and did a loop through all cells.
Felipe, thanks so much for your amazing work,
however,when i bring the coordinates data, it does not come in proper sequence,it is scattered randomly , can some thing be done about it??
please let me know how to rectify this error
Thanks in advance..
"when i bring the coordinates data, it does not come in proper sequence,it is scattered randomly"
Unfortunately, "proper sequence" is something that it is logical in a specific context for us humans. Programatically, that can't be done.
The texts aren't listed random either - they're listed in order they were selected. If you select more then one object, I think it is listed in the order they were created.
Tip: try using Excel's AutoFilter PosX and PosY to sort the texts.