itacad Posted November 2, 2022 Posted November 2, 2022 Hello, I don't remember where, however long ago I found the following lisp to "capture" the value of a series of attributes to form a string, save it in the windows clipboard and paste it out of autocad (defun c:catchattcum (/ att html result) (vl-load-com) (setq stringa "") (while (setq att(car(nentsel "\nSeleziona attributo: "))) (setq stringa(strcat stringa (cdr(assoc 1 (entget att))) " ")) ) (setq stringa (substr stringa 1 (- (strlen stringa) 1))) (setq html (vlax-create-object "htmlfile") result (vlax-invoke (vlax-get (vlax-get html 'ParentWindow) 'ClipBoardData) 'setData "Text" stringa ) ) (vlax-release-object html) ) Later thanks to some help, I modified it to be able to paste the set of attributes specifically in excel, pasting each attribute on a cell of the same column (defun c:catchattcumex (/ att html result) (vl-load-com) (setq stringa "") (while (setq att(car(nentsel "\nSeleziona attributo: "))) (setq stringa(strcat stringa (cdr(assoc 1 (entget att))) "\n")) ) (setq stringa (substr stringa 1 (- (strlen stringa) 1))) (setq html (vlax-create-object "htmlfile") result (vlax-invoke (vlax-get (vlax-get html 'ParentWindow) 'ClipBoardData) 'setData "Text" stringa ) ) (vlax-release-object html) ) the difference between the two lisp is in the fifth line, where "\ n" is used as a separator... If I understand correctly "\ n" = newline and this allows to distribute vertically as I described the attributes on an excel sheet. I ask you if there is an expression for "tab" that in my opinion should allow to paste the string generated horizontally on the excel sheet, one cell after another in the same row. Thank you in advance Quote
BIGAL Posted November 3, 2022 Posted November 3, 2022 You can get attributes and send direct to excel as cells if you want. Start with Getexcel.lsp, removes the need to do a paste. It has a Putcell function. I have written my own version of getexcel but it is a work in progress and is normally customised to suit a particular client export needs. Think beer money. Quote
Steven P Posted November 3, 2022 Posted November 3, 2022 or add in (chr 32) into your text which is the code for a tab Quote
itacad Posted November 3, 2022 Author Posted November 3, 2022 Hi Steve P, it seems to me that \ t was what I was missing to get me to the solution of the problem! For Bigal: I do not know the lisp that you have reported to me and I will look for it in the discussions of the forum, I will see what it is, thanks for the report 1 Quote
Steven P Posted November 3, 2022 Posted November 3, 2022 33 minutes ago, itacad said: For Bigal: I do not know the lisp that you have reported to me and I will look for it in the discussions of the forum, I will see what it is, thanks for the report Google.... https://autolisp-exchange.com/LISP/GetExcel.lsp Quote
BIGAL Posted November 3, 2022 Posted November 3, 2022 This is another good excel functions done by Denon Deterding. Deterding <denon@alxfunctions.com> Check the help. ALX.zip Quote
itacad Posted November 5, 2022 Author Posted November 5, 2022 I will read what you have proposed to me! In the meantime, I ask you one more thing with an excel argument! Given the excellent solutions I received on this forum, I would like to try to subscribe to an excel forum in English (excel and VBA), can you tell me someone you think is valid and calm as a cadtutor? Thank you Quote
BIGAL Posted November 5, 2022 Posted November 5, 2022 (edited) I just google my questions "get range excel vba" For autocad answers ""get range excel lisp autocad" Edited November 5, 2022 by BIGAL 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.