Anyway to extract coordinates into excel file?
Anyway to extract coordinates into excel file?
(OP)
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?





RE: Anyway to extract coordinates into excel file?
or window the profile. Then cut and paste
to a text file or whatever.
RE: Anyway to extract coordinates into excel file?
Scott
RE: Anyway to extract coordinates into excel file?
(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
RE: Anyway to extract coordinates into excel file?
Joe Stiles
RE: Anyway to extract coordinates into excel file?
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
RE: Anyway to extract coordinates into excel file?
RE: Anyway to extract coordinates into excel file?
Furthermore you assit to a school or course , the web is full of info, please register at the
http://www.theswamp.org/ and put the same topic
There is a good topic about what you need it allow to extract directly data to a excell sheet.
www.cadtutorforum.net
RE: Anyway to extract coordinates into excel file?
http://arcscripts.esri.com/details.asp?dbid=12779
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
RE: Anyway to extract coordinates into excel file?
RE: Anyway to extract coordinates into excel file?
RE: Anyway to extract coordinates into excel file?
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