Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations IDS 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
Dec 30, 2004
49
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??
 
Replies continue below

Recommended for you

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