CloudJack Posted December 2, 2015 Share Posted December 2, 2015 Currently, I have an Excel table. Numbers of column contains 0 or 1. I have to copy column by column into notepad and then copy the notepad contain to CAD. After that, I have serval individual column of Mtext. Then I further explode them into text. A numbers of individual text are pasted on CAD and this is what I want. However, if I do copy multiple column into notepad, the result is a whole Mtext which is containing all columns. I explode the Mtext and I will obtain multiple line of text. I am searching for a lisp to convert/separate Mtext to individual text. For more advance, I want these 1 and 0 located in different destination point from excel to CAD by a lisp. Quote Link to comment Share on other sites More sharing options...
Happy Hobbit Posted December 2, 2015 Share Posted December 2, 2015 I found this somewhere, the user copies text from Excel or Word for example. The user invokes the PSTSP command & the text gets pasted as individual text items. I've changed it slightly to capitalise the text: (defun c:PSTSP (/ _GetClipBoardText ent_last last_ent pt str) (vl-load-com) (defun _GetClipBoardText (/ htmlfile result) (setq result (vlax-invoke (vlax-get (vlax-get (setq htmlfile (vlax-create-object "htmlfile")) 'ParentWindow ) 'ClipBoardData ) 'GetData "Text" ) ) (vlax-release-object htmlfile) result ) (if (not (setq ent_last (entlast))) (progn (entmake '( (0 . "POINT") (100 . "AcDbEntity") (100 . "AcDbPoint") (10 . (0.0 0.0 0.0)) ) ) (setq ent_last (entlast) last_ent ent_last ) ) ) (if (and (setq str (_GETCLIPBOARDTEXT)) (setq pt (getpoint "\nSpecify text start point: ")) ) (progn (setq str (strcase str)) (entmake (list '(0 . "MTEXT") '(100 . "AcDbEntity") '(100 . "AcDbMText") (cons 10 pt) (cons 1 str) ) ) (command "_.explode" "_L") ) ) (if last_ent (entdel last_ent) ) (princ) ) Quote Link to comment Share on other sites More sharing options...
CloudJack Posted December 3, 2015 Author Share Posted December 3, 2015 Thank you! However, I would like to do this: If I copy muliple column in Excel, the result is left one. I want the right instead of left. Each 1 and 0 should be seperated text. Quote Link to comment Share on other sites More sharing options...
BIGAL Posted December 3, 2015 Share Posted December 3, 2015 There are lots of examples of read excel file into Autocad via each individual cell as say a text value. Have a search here for "excel", you do not need a intermediate step via notepad etc. There was something maybe last week will try to find. Quote Link to comment Share on other sites More sharing options...
rlx Posted December 3, 2015 Share Posted December 3, 2015 This tool may have what you want : http://www.cadtutor.net/forum/showthread.php?93900-VT-atrribute-amp-text-editor-RLX Follow instructions (rename vt.lsp to vt.vlx and then use (load "vt.vlx") ...) When you start the command press space or R-mouse to start quick menu and select function PasteSpec. Rest should be easy. gr. Rlx Quote Link to comment Share on other sites More sharing options...
CloudJack Posted December 3, 2015 Author Share Posted December 3, 2015 Thank you BIGAL and rlx!! I found Lee Mac: http://www.lee-mac.com/readcsv.html and I am successful to use this to make as individual text. rlx, I tried your lisp. It is quite powerful lisp. However, I want more code example to study how to write a lisp for a task. By the way, thank you all a lot! Quote Link to comment Share on other sites More sharing options...
rlx Posted December 3, 2015 Share Posted December 3, 2015 (edited) Thank you BIGAL and rlx!!I found Lee Mac: http://www.lee-mac.com/readcsv.html and I am successful to use this to make as individual text. rlx, I tried your lisp. It is quite powerful lisp. However, I want more code example to study how to write a lisp for a task. By the way, thank you all a lot! You're welcome , see also link below , last part of lsp has the excel code http://www.cadtutor.net/forum/showthread.php?93959-VT-Attribute-amp-text-editor-lsp-amp-dcl Gr. Rlx Edited December 4, 2015 by rlx Quote Link to comment Share on other sites More sharing options...
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.