rcb007 Posted April 12, 2022 Posted April 12, 2022 I am trying to come up with a method to have a routine read an excel cell value in column A. (There might be 50+ Values in Column A). Then create a folder and a drawing with the same name within the folder. I have found some ways using Excel VBA to create the folders, but not so much with lisp. Would anyone have any suggestions on how to possible get this to work or not? Thank you for your help! Hopefully I am going down the right direction on this. Quote
exceed Posted April 13, 2022 Posted April 13, 2022 (edited) http://docs.autodesk.com/ACD/2011/ENU/filesALR/WS1a9193826455f5ff1a32d8d10ebc6b7ccc-68a2.htm you can make directory with vl-mkdir https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/create-a-new-drawing-from-lisp/m-p/787043/highlight/true#M12701 you can make dwg file with vla-add (defun c:makeempty ( / filepath filename) (setq filepath "c:\\test3\\") (setq filename "test3.dwg") (ex:makeempty filepath filename) (princ) ) (vl-load-com) (defun ex:makeempty ( filepath filename / doc ) (vl-mkdir filepath) (setq fullpath (strcat filepath filename)) (setq doc (vla-get-templatedwgpath (vla-get-Files (vla-get-preferences (vlax-get-acad-object))))) (setq doc (findfile (strcat doc "\\acad.dwt"))) (setq doc (vla-add (vla-get-documents (vlax-get-acad-object)) doc)) (vla-saveAs doc fullpath) (vla-activate (vla-item (vla-get-documents (vlax-get-acad-object)) filename)) ) https://www.cadtutor.net/forum/topic/74681-cad-output-excel-specified-page/?do=findComment&comment=591539 and you can get excel cell value (current activated cell) and can move it. Edited April 13, 2022 by exceed 1 Quote
Steven P Posted April 13, 2022 Posted April 13, 2022 I don't do Excel to AutoCAD really but recently it has caused a lot of questions - my answer is based on an apparent difficulty reading and writing to a spreadsheet via a LISP.. So if you can make a folder with Excel easily... why not do that then? In my way of working I would have a look through the spreadsheet first just to check that it looks OK, simple thing then to run a small macro while you are there. Getting a list of data from a spreadsheet column is easier and if you can do that to get a list of new folders, you can make a couple of simple changes to Exceeds example code above to add an empty dwg to each of the folders in a location. Quote
BIGAL Posted April 14, 2022 Posted April 14, 2022 Did you google use excel to open a new Autocad dwg should be a VBA example out there. You can open a new excel work book from Acad lisp so opposite must exist. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.