View Full Version : Automating table insertion
ccowgill
2005-10-19, 12:06 PM
does anyone know how to get a lisp routine to automatically insert copied cells from excel into an AutoCAD entity with specific cell sizes, alignments, and cell borders.
this is the start of my code, I dont know how to get it to automatically select AutoCAD Entities, or how to automate the modification of the table.
(defun c:psp ()
(command "layer" "make" "Text" "color" "3" "Text" "set" "Text" "")
(command "color" "bylayer")
(command "_pastespec")
)Any help would be appreciated
jim.vipond
2005-10-20, 02:22 PM
Attached is a file I wrote many moons ago which may be of some help mainly for ideas. Don't comment on the coding as it was early in my lisp days. I have now re-written the lisp file using vba which I think gives a better link to Excel (IMO). If you are interested in the vba version let me know.
ccowgill
2005-10-20, 03:31 PM
Attached is a file I wrote many moons ago which may be of some help mainly for ideas. Don't comment on the coding as it was early in my lisp days. I have now re-written the lisp file using vba which I think gives a better link to Excel (IMO). If you are interested in the vba version let me know.
I'm not very good at LISP myself, I was wondering, Does this insert the information as an AutoCAD table object?, we have a very specific way our tables look for our quantity boxes and I am just trying to make it as automated as possible, basically go into excel, highlight what info is needed, come back to AutoCAD, run the command, and everything is done, width is set, height is set, borders are set, the only thing left is to delete unnecessary rows. attached is a copy of the dwg for what the table looks like, right now it is using our current method of highlight one column at a time, paste into notepad, copy from notepad, paste into Autocad mtext object. Any help would be appreciated.
jwanstaett
2005-10-20, 04:55 PM
???.
how dose the qty get in the excel file is it exported form the drawing file.
ccowgill
2005-10-21, 11:30 AM
Our engineers use an estimating program called MERL (Michigan Engineer's Resource Library) they export their estimate in a csv format, and then save it as an excel file, in it they take multiple tabs and place quantities for individual sheets in them. from this file we copy and Pastespec to AutoCAD, it alleviates any spelling errors, and copy errors from the way we used to do it, which was have a mark up and make the changes, this removes the need for a mark up and just eliminates a lot of mistakes all around attached is a copy of an excel file that we use. and hopefully a drawing with our quantity table style.
jim.vipond
2005-10-21, 12:38 PM
From memory what happens is that you select what you want in Excel and copy to the clipboard. When you run the lisp file it pastes as AutoCAD text which you then select again and choose a position to place the text. The routine then breaks down each text string into individual text. We placed into an existing table hence the formatting is for our standards (Tables of 8 columns), you would have to work out your own.
As I mentioned it has now been re-written in vba which exports information to excel formats it for a BOM and re-imports into the table. The only thing the designer needs to do is specify the Excel file name and choose an insertion point.
vBulletin® v3.6.7, Copyright ©2000-2009, Jelsoft Enterprises Ltd.