mohammadreza Posted April 28 Posted April 28 hi every body is there any lisp about this issue? : i have a excel sheet that include coordinates and a text in every row i need to import that text to those coordinate in autocad! Quote
devitg Posted April 28 Posted April 28 5 hours ago, mohammadreza said: hi every body is there any lisp about this issue? : i have a excel sheet that include coordinates and a text in every row i need to import that text to those coordinate in autocad! @mohammadreza. Please upload both xls and DWG to apply it. It will be easiest. if the XLS is saved as CSV,"comma separated value"Â Â Quote
BIGAL Posted April 28 Posted April 28 (edited) Like devitg post XLS, yes can read Excel direct. Only question is there always a header line ? Â You could do it in Excel using a Concatenate command just copy in example column E to Autocad command line. Â Â =CONCATENATE("(command ",CHAR(34),"TEXT",CHAR(34)," ",CHAR(34),A1,",",B1,CHAR(34)," ","2.5 0 ",CHAR(34),C1,CHAR(34),")") Â Edited April 28 by BIGAL 1 Quote
Jonathan Handojo Posted April 29 Posted April 29 If all you're after is importing the text, then I'd go with what @BIGALÂ suggested. By forming some formulae, you can create the necessary strings that you can simply just paste into the command line: Â Â 30000 is just an example text height that's set, and 0.0 is the rotation angle. 1 Quote
fuccaro Posted April 29 Posted April 29 I do agree that the "Excel" way is easier. But if you wish my Lisp solution, here you are: (defun c:pp() (setq separator ";") (setq textHeight 0.5) (setq fileName (getfiled "coords text" "" "CSV" 0) file (open fileName "r") ) (while (setq row (read-line file)) (setq p1 (1+ (vl-string-position (ascii separator) row)) p2 (1+ (vl-string-position (ascii separator) row p1)) x (read (substr row 1 p1)) y (read (substr row (1+ p1) (- p2 p1))) txt (substr row (1+ p2)) ) (entmake (list (cons 0 "TEXT") (list 10 x y 0) (cons 1 txt)(cons 40 textHeight))) ) (close file) ) Save the Excel sheet in CSV format. Because the "comma" sometimes is not comma, open the file in notepad and examine the separator. Change the second line in this Lisp accordingly. Also you may wish to change the text height -in the third line. Enjoy! 1 Quote
BIGAL Posted April 30 Posted April 30 You can say open an excel, then in CAD get current range eg A1:C100 skip row 1 as its a header, then just read the 3 cells in the row. Â Need a sample XLS then can do code. Quote
SLW210 Posted April 30 Posted April 30 You can set up the Excel as shown by BIG AL, then make it a Script file to put the text in AutoCAD.  You can also use VBA in Excel to send the text to AutoCAD. Add Text In AutoCAD Using Excel & VBA - My Engineering World  We need a File from you. Quote
BIGAL Posted May 1 Posted May 1 Thats a good Excel example may add to my add line, circle, pline, macro example. 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.