×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Attributes into excel

Attributes into excel

Attributes into excel

(OP)
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??

RE: Attributes into excel

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

RE: Attributes into excel

(OP)
That's what I needed

thank you

RE: Attributes into excel

Is there a version to extract all 3 coordinates (X,Y, & Z) ?
Tks-
C. Fee

RE: Attributes into excel

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

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources