fbby Posted June 17, 2009 Posted June 17, 2009 hi everyone! I have coordinates in MS excel and I want to plot it in autocad 2008, is there any autolisp on this so that I cant spend a lot of time typing coordinates one by one in autocad? can anyone help me on this? thanks ___________________________ sorry for my english Quote
wannabe Posted June 17, 2009 Posted June 17, 2009 You want to insert block's at those coordinates? Quote
oliver Posted June 17, 2009 Posted June 17, 2009 hi everyone! I have coordinates in MS excel and I want to plot it in autocad 2008, is there any autolisp on this so that I cant spend a lot of time typing coordinates one by one in autocad? can anyone help me on this? thanks ___________________________ sorry for my english this one works perfectly..but 1st convert excel to txt format. http://www.cadtutor.net/forum/showthread.php?t=36808 :wink: Quote
wannabe Posted June 17, 2009 Posted June 17, 2009 Here's an application I created myself if you want to Insert blocks. User-guide attached, although the only real issue is formatting your excel spreadsheet. Like standard AutoCAD pallettes, you can drag this around your screen and doesn't need to be docked at the edge of your screen. MBP.zip Quote
ReMark Posted June 17, 2009 Posted June 17, 2009 I see no mention of the OP inserting blocks at these coordinates. There is no need to use AutoLISP. Click on the link at the top of this page to Michael's Corner. Look at the May 2009 column. Page down until you get to the heading named The Odd Spot. In this month's entry, aptly named Coordinates from Excel to AutoCAD, Michael Beall explains how to get coordinates from Excel into AutoCAD using a script (scr) file. Quote
rkmcswain Posted June 17, 2009 Posted June 17, 2009 hi everyone! I have coordinates in MS excel and I want to plot it in autocad 2008, is there any autolisp on this so that I cant spend a lot of time typing coordinates one by one in autocad? * Open your Excel file. * Save it as a CSV file. * Close Excel. * Find the CSV file, open it in Notepad. * At the TOP of the file, add two lines: MULTIPLE POINT * Save the file as a .SCR file. * Run this script file in AutoCAD. Quote
wannabe Posted June 17, 2009 Posted June 17, 2009 * Open your Excel file.* Save it as a CSV file. * Close Excel. * Find the CSV file, open it in Notepad. * At the TOP of the file, add two lines: MULTIPLE POINT * Save the file as a .SCR file. * Run this script file in AutoCAD. Great tip. The application I've attached will insert user-selected blocks and also populate the attributes field if it's of use to anyone. Quote
wannabe Posted June 17, 2009 Posted June 17, 2009 I see no mention of the OP inserting blocks at these coordinates. There is no need to use AutoLISP. Click on the link at the top of this page to Michael's Corner. Look at the May 2009 column. Page down until you get to the heading named The Odd Spot. In this month's entry, aptly named Coordinates from Excel to AutoCAD, Michael Beall explains how to get coordinates from Excel into AutoCAD using a script (scr) file. There's no mention of what he does want, to be fair. Quote
fbby Posted June 17, 2009 Author Posted June 17, 2009 sorry guys if I late reply I want to connect the coordinates by polylines, like if I type the coordinates in excel it will automatically connect by the polylines Quote
Lee Mac Posted June 17, 2009 Posted June 17, 2009 What format are the points in? i.e. comma delimited? x,y,z Quote
wannabe Posted June 17, 2009 Posted June 17, 2009 sorry guys if I late reply I want to connect the coordinates by polylines, like if I type the coordinates in excel it will automatically connect by the polylines I think ReMark's referal wins:D Quote
Lee Mac Posted June 17, 2009 Posted June 17, 2009 If not, this should work (assumes 2D): (defun c:ptpoly (/ doc spc file nl ptlst) (vl-load-com) (setq doc (vla-get-ActiveDocument (vlax-get-Acad-Object)) spc (if (zerop (vla-get-activespace doc)) (if (= (vla-get-mspace doc) :vlax-true) (vla-get-modelspace doc) (vla-get-paperspace doc)) (vla-get-modelspace doc))) (if (setq file (getfiled "Select File" "" "txt" ) (progn (setq file (open file "r")) (while (setq nl (read-line file)) (setq ptlst (cons (StrBrk nl 44) ptlst))) (close file) (if ptlst (progn (setq ptlst (apply 'append (mapcar (function (lambda (x) (list (car x) (cadr x)))) (reverse (mapcar (function (lambda (x) (mapcar 'distof x))) ptlst))))) (vla-addLightweightpolyline spc (vlax-make-variant (vlax-safearray-fill (vlax-make-safearray vlax-vbdouble (cons 0 (1- (length ptlst)))) ptlst)))) (princ "\n<< No Points Found in File >>"))) (princ "\n<< No File Selected >>")) (princ)) (defun StrBrk (str chrc / pos lst) (while (setq pos (vl-string-position chrc str)) (setq lst (cons (substr str 1 pos) lst) str (substr str (+ pos 2)))) (reverse (cons str lst))) Quote
ReMark Posted June 17, 2009 Posted June 17, 2009 In that case I'll take a beer as my prize. Thank you very much. Quote
fbby Posted June 17, 2009 Author Posted June 17, 2009 I attached my some coordinates Please check it thanks __________________________ sorry for my english Quote
Lee Mac Posted June 17, 2009 Posted June 17, 2009 If you do not want to go with ReMarks method - could you copy your coordinates into a Text file and tell me what separates them, whether it be a TAB, SPACE or COMMA. Quote
fbby Posted June 17, 2009 Author Posted June 17, 2009 It's space X Y 135643 4740 135650 4737 135656 4734 Quote
Lee Mac Posted June 17, 2009 Posted June 17, 2009 Ok, if you remove the X Y from the top of the text file, this should work: (defun c:ptpoly (/ doc spc file nl ptlst) (vl-load-com) (setq doc (vla-get-ActiveDocument (vlax-get-Acad-Object)) spc (if (zerop (vla-get-activespace doc)) (if (= (vla-get-mspace doc) :vlax-true) (vla-get-modelspace doc) (vla-get-paperspace doc)) (vla-get-modelspace doc))) (if (setq file (getfiled "Select File" "" "txt" ) (progn (setq file (open file "r")) (while (setq nl (read-line file)) (setq ptlst (cons (StrBrk nl 32) ptlst))) (close file) (if ptlst (progn (setq ptlst (apply 'append (mapcar (function (lambda (x) (list (car x) (cadr x)))) (reverse (mapcar (function (lambda (x) (mapcar 'distof x))) ptlst))))) (vla-addLightweightpolyline spc (vlax-make-variant (vlax-safearray-fill (vlax-make-safearray vlax-vbdouble (cons 0 (1- (length ptlst)))) ptlst)))) (princ "\n<< No Points Found in File >>"))) (princ "\n<< No File Selected >>")) (princ)) (defun StrBrk (str chrc / pos lst) (while (setq pos (vl-string-position chrc str)) (setq lst (cons (substr str 1 pos) lst) str (substr str (+ pos 2)))) (reverse (cons str lst))) Quote
fbby Posted June 17, 2009 Author Posted June 17, 2009 Ok, if you remove the X Y from the top of the text file, this should work: (defun c:ptpoly (/ doc spc file nl ptlst) (vl-load-com) (setq doc (vla-get-ActiveDocument (vlax-get-Acad-Object)) spc (if (zerop (vla-get-activespace doc)) (if (= (vla-get-mspace doc) :vlax-true) (vla-get-modelspace doc) (vla-get-paperspace doc)) (vla-get-modelspace doc))) (if (setq file (getfiled "Select File" "" "txt" ) (progn (setq file (open file "r")) (while (setq nl (read-line file)) (setq ptlst (cons (StrBrk nl 32) ptlst))) (close file) (if ptlst (progn (setq ptlst (apply 'append (mapcar (function (lambda (x) (list (car x) (cadr x)))) (reverse (mapcar (function (lambda (x) (mapcar 'distof x))) ptlst))))) (vla-addLightweightpolyline spc (vlax-make-variant (vlax-safearray-fill (vlax-make-safearray vlax-vbdouble (cons 0 (1- (length ptlst)))) ptlst)))) (princ "\n<< No Points Found in File >>"))) (princ "\n<< No File Selected >>")) (princ)) (defun StrBrk (str chrc / pos lst) (while (setq pos (vl-string-position chrc str)) (setq lst (cons (substr str 1 pos) lst) str (substr str (+ pos 2)))) (reverse (cons str lst))) can you please tell what I will do? thanks ____________________________ sorry for my english Quote
Lee Mac Posted June 17, 2009 Posted June 17, 2009 can you please tell what I will do?thanks ____________________________ sorry for my english Regarding loading the routine: http://www.cadtutor.net/faq/questions/28/How+do+I+use+an+AutoLISP+routine%3F Once loaded, invoke it with "ptpoly" in ACAD. Select your text file, and the job is done (hopefully!) 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.