Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

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

Attributes into excel

Status
Not open for further replies.

Firerunner

Civil/Environmental
Joined
Dec 30, 2004
Messages
49
Location
US
I was wondering is there a way to extract the x,y coordinates of two or more block into Excel. It was easy in AutoCAD 2000 but the attribute extraction wizard in 2006 has changed.

I have a spreadsheet that uses length in the calculations, for now I am manually inputting the length.

Is there a lisp routine that I can use or would I have to make one of my own??
 
I assume that attribute extraction will do the job just fine once you figure it out :)

For me it is easier to write a quick lisp:

princ "\nStart with XYOUT")
(defun c:xyout ()
(setq f1 (open "c:\\blockpoints.csv" "w"))
(prompt "\nSelect blocks to write to file \"c:\\blockpoints.csv\": ")
(setq blockset (ssget '((0 . "INSERT"))))
(setq Item 0)
(repeat (sslength blockset)
(setq ename (ssname blockset Item))
(setq edata (entget ename))
(setq InsPt (cdr (assoc 10 edata)))
(setq xval (car InsPt))
(setq yval (cadr InsPt))
(setq xtxt (rtos xval 2 2))
(setq ytxt (rtos yval 2 2))
(write-line (strcat xtxt "," ytxt) f1)
(setq Item (+ 1 Item))
)
(close f1)
(princ)
)
 
That's what I needed

thank you
 
Is there a version to extract all 3 coordinates (X,Y, & Z) ?
Tks-
C. Fee
 
Sure is, just took a minor revision. And if you need more than 2 decimal places change the last number in each of the 3 lines; (setq ytxt (rtos yval 2 2))



;;--------------------------------------
(princ "\nStart with XYZOUT")
(defun c:xyzout ()
(setq f1 (open "c:\\blockpoints.csv" "w"))
(prompt "\nSelect blocks to write to file \"c:\\blockpoints.csv\": ")
(setq blockset (ssget '((0 . "INSERT"))))
(setq Item 0)
(repeat (sslength blockset)
(setq ename (ssname blockset Item))
(setq edata (entget ename))
(setq InsPt (cdr (assoc 10 edata)))
(setq xval (car InsPt))
(setq yval (cadr InsPt))
(setq zval (caddr InsPt))
(setq xtxt (rtos xval 2 2))
(setq ytxt (rtos yval 2 2))
(setq ztxt (rtos zval 2 2))
(write-line (strcat xtxt "," ytxt "," ztxt) f1)
(setq Item (+ 1 Item))
)
(close f1)
(princ)
)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top