Lisp To Extract Data From DwgProps And Place In Excel

Lisp To Extract Data From DwgProps And Place In Excel

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

Lisp To Extract Data From DwgProps And Place In Excel

Anonymous
Not applicable

Hi 

 I was wondering if there was a way through lisp to extract data from dwgprops or the drawing Summary info and create an Excel file. Can someone please help?

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

_gile
Consultant
Consultant

Hi,

You should be able to get some inspiration from this:

 

(defun c:dwgprops2csv (/ doc info filename sep file i prop val)
  (setq doc      (vla-get-ActiveDocument (vlax-get-acad-object))
        info     (vla-get-SummaryInfo doc)
        filename (strcat (getvar 'dwgprefix) (vl-filename-base (getvar 'dwgname)) "_SummaryInfo.csv")
        sep      (vl-registry-read "HKEY_CURRENT_USER\\Control Panel\\International" "sList")
        file     (open filename "w")
  )
  (foreach prop '("Title" "Subject" "Author" "Keywords" "Comments" "HyperlinkBase" "LastSavedBy" "RevisionNumber")
    (write-line (strcat prop sep (vlax-get info prop)) file)
  )
  (setq i 0)
  (repeat (vla-NumCustomInfo info)
    (vla-GetCustomByIndex info i 'prop 'val)
    (write-line (strcat prop sep val) file)
    (setq i (1+ i))
  )
  (close file)
)


Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

Message 3 of 4

Anonymous
Not applicable

I am full aware of how to extract the data in several ways however I cant seem to place the data in excel.

Is there someone that could help me with that?

0 Likes
Message 4 of 4

cadffm
Consultant
Consultant

Checkout sample code for attribut extraction or other things to excel via activex.

 

Use your internet search engine:

site:autodesk.com forum vlax excel

 

 

Sebastian

0 Likes