Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations MintJulep on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Anyway to extract coordinates into excel file?

Status
Not open for further replies.

joestiles

Mechanical
Apr 12, 2005
4
I have some test locations that are plotted in AutoCAD 2002. I need to extract the coordinated into an excel file so that they can be imported into a program that will plot them using a profile wiew. I'm not sure what program the engineer is using, but I know he won't use AutoCAD. Is there anyway that I can select the points (About 40 of them), and extract the coordinates?
 
Replies continue below

Recommended for you

you can use the list command and select
or window the profile. Then cut and paste
to a text file or whatever.
 
I can do that for you if you can get me your drawing. They don't like us putting email addresses on this site. So that option is out. You might post your question at They can probably help you out as well.

Scott
 
(defun c:CoordinatesOut(/ nnn k14 p1 p2 p3 p4 p5 nno zz)

(setvar "cmdecho" 0)
(if (= olcek nil)
(load "olcek")
)

(command "ddosnap")
(setq
k14 (getvar "osmode"))
(
princ
"Name of an ascii file <")
(

princ z)
(

princ ">:")
(setq zz (getstring))
(if (= zz "")
(terpri)
(setq z zz))
(setq isim (open z "a"))
(princ z)
(terpri)
(princ "Initial number of point ID <")
(princ no)
(princ ">:")
(setq nno (getint))
(if (= nno nil)
(terpri)
(setq no nno)
)
(setq no (- no 1))
(while
(/= nnn 1000)
(setq no (+ no 1))
(terpri)
(princ no)
(princ ".")
(setq a (getpoint "Point:"))
(if (/= a nil)
(progn

(setq yuksek (* olcek 2))
(command "text" a yuksek 100 no)

(setq p1 (car a))
(setq p2 (cadr a))
(setq p3 (caddr a))
(print no isim)
(princ (rtos p1 2 3) isim)
(princ (chr 32) isim)
(princ
(rtos p2 2 3) isim)
(princ (chr 32) isim)
(princ
(rtos p3 2 3) isim)

)
(setq nnn 1000)
))
(command "redraw")
(setvar
"osmode" k14)
(close isim)
(princ)
)

Try the above lisp. You have to select the points individually, but it will pull out your coordinates to a txt file. Make sure you list the directory when it asks for a file name example: c:/acaddwg.txt You should be able to open your text file in excel. I didn't write this, and I don't know where it came from. Maybe someone can modify it do you don't have to select the points individually. I'm not smart enough to figure that out. Let me know if you need help.

Scott
 
I'm sorry for asking a newbie question. Where do I paste this program and how do I run it. Am I supposed to paste this code into a text file and then open it up in autocad? Please help. Thanks?

Joe Stiles
 
Copy the code into a text editor
Save it in your autocad support path as CoordinatesOut.lsp (don't forget the .lsp)
Open autocad
Click Tools - Load Application
Navigate to the CoordinatesOut.lsp file and double click it. To run the application type coordinatesout in the command line. The application will ask a question in some foreign language. Basically it is asking you for a map scale. I just press enter and except the default (100). You will then be asked to name the output file. Make sure you give the path as well as the file name: example: c:/autocaddrawing.txt

Don't forget the .txt. Select your points one by one. The application will number the points as you select them. Press enter after you select all the points. You should have a text file named autocaddrawing.txt saved on your c: drive after you press enter. You can then open this in excel.

If you have any questions feel free to ask.

Scott
 
Thanks Scott. I got an olcek error, but at least I know how to run these lisp programs. I had no idea autoCad was capable of doing this. How many years have you worked with cad. I ask because I have been working since highschool (4yrs), and now I feel like there are many things that I need to learn. What are your suggestions for me taking my drafting to the next level. ie. school, trade school, ITT Tech, etc.??
 
Just realized there is another file required to run that lisp. Follow this link and download the full application. There might be other things there you can use.

As for taking your drafting to the next level, I have no idea. I've been using autocad for about 4 years and learned a lot from the website hyposmurf mentioned. I highly recommend you register at that site. It's free too. And the people that inhabit the site are very knowledgable with autocad, lisp and just about everything else that deals with cad.

scott
 
You can get a lot of good training on cad at your local Junior college. This is generally much cheaper and the info is usually as good. Also ask your local CAD Vendors they usually hold specialized classes. And lastly watch Autodesk website for seminars coming to your town.
 
I got another question pertaining to this post.....

I used the Lisp function that you provided...It worked great. However I wish to append it so that I can label the distance between point 1 and point 2, line1. Label distane between point 2 and 3, line 2...so on and so on...

Is there a quick way of doing this other than running it in VB?

thanks,
Harsimran Braich
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor