Jump to content

Recommended Posts

Posted

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

  • Replies 30
  • Created
  • Last Reply

Top Posters In This Topic

  • fbby

    7

  • Lee Mac

    7

  • wannabe

    6

  • ReMark

    4

Top Posters In This Topic

Posted Images

Posted

You want to insert block's at those coordinates?

Posted
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:

Posted

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

Posted

Was this any good for your needs??

Posted

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.

Posted
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.

Posted
* 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.

Posted
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.

Posted

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

Posted

What format are the points in? i.e. comma delimited? x,y,z

Posted
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

Posted

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)))

Posted

In that case I'll take a beer as my prize. Thank you very much.

Posted

I attached my some coordinates

Please check it

thanks :)

 

 

 

__________________________

sorry for my english

X-Y Coordinates.JPG

Posted

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.

Posted

It's space

 

X Y

135643 4740

135650 4737

135656 4734

Posted

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)))

Posted
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

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...