Extract circle diameter from autocad to excel

Extract circle diameter from autocad to excel

Anonymous
Not applicable
1,326 Views
3 Replies
Message 1 of 4

Extract circle diameter from autocad to excel

Anonymous
Not applicable

Hello everyone,

 

   How to extract circle diameter from autoCAD to excel??????

 

 

 

Thanks in advance.....

0 Likes
1,327 Views
3 Replies
Replies (3)
Message 2 of 4

ВeekeeCZ
Consultant
Consultant
Have you tried DATAEXTRACTION command? There shoud be a RADIUS.
0 Likes
Message 3 of 4

SeeMSixty7
Advisor
Advisor

Here you go.

 

(defun C:CIR2CSV()
 (setq ent (entsel "\nSelect Circle to Export to CSV file [ENTER for SelectionSet]:")
    outlist nil
 )
 (if ent
  (progn
   (setq ent (car ent)
      data (entget ent)
      dia (* (cdr (assoc 40 data)) 2.0)
      cen (cdr (assoc 10 data))
      xcoord (nth 0 cen)
      ycoord (nth 1 cen)
      zcoord (nth 2 cen)
      layer  (cdr (assoc 8 data))
      outlist (list (list "CIRCLE" layer dia xcoord ycoord zcoord))
   )
  )
  (progn
   (princ "\nSelect Circles to export to CSV File: ")
   (setq circless (ssget '((0 . "CIRCLE"))))
   (if circless
    (progn
     (setq cnt 0
        num (sslength circless)
        outlist (list)
     )
     (while (< cnt num)
      (setq ent (ssname circless cnt)
         data (entget ent)
         dia (* (cdr (assoc 40 data)) 2.0)
         cen (cdr (assoc 10 data))
         xcoord (nth 0 cen)
         ycoord (nth 1 cen)
         zcoord (nth 2 cen)
         layer  (cdr (assoc 8 data))
         outlist (append outlist  (list (list "CIRCLE" layer dia xcoord ycoord zcoord)))
         cnt (1+ cnt)
      )
     )
    )
    (princ "\nNothing Selected.")
   )
  )
 )
 (if outlist
  (progn
   (setq csvfilename (getfiled "CSV File Name" "Circleout" "csv" 1)
         fileout (open csvfilename "w")
   )
   (if (and csvfilename fileout)
    (progn
     (foreach cir outlist
      (setq outline (strcat (nth 0 cir) ","
                      (nth 1 cir) ","
                      (rtos (nth 2 cir) 2 8) ","
                      (rtos (nth 3 cir) 2 8) ","
                      (rtos (nth 4 cir) 2 8) ","
                      (rtos (nth 5 cir) 2 8)
              )
      )
      (write-line outline fileout)
     )
     (close fileout)
    )
    (princ "\nFile Error")
   )
  )
  (princ "\nNothing to do!")
 )
)

 

Good luck

0 Likes
Message 4 of 4

Anonymous
Not applicable

Attached lisp program written by Terry Miller. Includes Autolisp functions to open, read/write , save and close data from AutoCAD to/from Excel. Eliminates the step to write data to a text file and then open in Excel.

 

Good Luck.

0 Likes