This blog will contain different stuffs I found to be useful for me and hope for you too especially NIA design engineers.
Saturday, February 16, 2013
Export point coordinates from Autocad to Excel
Export point coordinates from Autocad to Excel::
This tutorial uses a programming language called Lisp to
be loaded in autocad.
First copy this code to a text file then save it as exportPoint.lsp,
(defun c:ptexp (/ file points c i) ;POints to TeXT
(setq file (open (getfiled "specify output file" "c:/" "TXT" 1) "w"))
(setq points (ssget) i 0)
(repeat (sslength points)
(if (= "POINT" (cdr (assoc 0 (entget (ssname points i)))))
(setq c (cdr (assoc 10 (entget (ssname points i))))
i (1+ i)
)
)
(write-line
(strcat (rtos (car c)) " ; "
(rtos (cadr c)) " ; "
(rtos (caddr c))
) file)
)
(close file)
(Princ)
)
Then go to autocad with the points that you want to export.
Type "lsp" without the quotation mark.
This will open a dialog box to locate your saved file from the above.
Load the file and you will see a message "Successfully loaded."
Close the dialog window and you will be back on autocad.
Run a command "ptexp" without the quotation mark then press enter.
This will open a dialog for you to locate and specify the filename where you want to save it.
After that on the autocad, it will say 'select objects'.
Select all the points that you want to export then enter.
Now open Microsof Excel and press open.
Change the filter to text files and open your exported file.
he TEXT IMPORT WIZARD will pop up. Select DELIMITED in the first step, click next and select SEMICOLON as delimiters. Click FINISH and the coordinates are on your screen!
Subscribe to:
Post Comments (Atom)
awesome man
ReplyDeletehow can i learn to create such app on my own?
i tried using visual studio.
bt here u used simply note pad
ok tanks i love U broowwwwwww
ReplyDeleteX Y Z
ReplyDelete1151.5641 1848.9976 0 UCS ORIGIN>>>>
1401.5641 1848.9976 0
2401.5641 2348.9976 0
2401.5641 1848.9976 0
2401.5641 1223.9976 0
2401.5641 848.9976 0
My ucs origin is suppose to show 0.0.0 at x.y.z but it didn't worked that way. please advice on how to fix it. Thanks
super bro nice method
ReplyDeleteNow i try ,thank a million
ReplyDelete