Export Extended Data to Excel

Export Extended Data to Excel

wilsonm2000
Advocate Advocate
2,337 Views
8 Replies
Message 1 of 9

Export Extended Data to Excel

wilsonm2000
Advocate
Advocate

We have drawings with blocks that have custom Extended data attributes.  Is there a way to export the data within these attributes to Excel file?

0 Likes
2,338 Views
8 Replies
Replies (8)
Message 2 of 9

Moshe-A
Mentor
Mentor

check DATEXTRACTION command

 

0 Likes
Message 3 of 9

Anonymous
Not applicable

Would this work? Using the burst command, then use the scripts.

 

(defun LM:writecsv ( lst csv / des sep )
(if (setq des (open csv "w"))
(progn
(setq sep (cond ((vl-registry-read "HKEY_CURRENT_USER\\Control Panel\\International" "sList")) (",")))
(foreach row lst (write-line (LM:lst->csv row sep) des))
(close des)
t
)
)
)
(defun LM:lst->csv ( lst sep )
(if (cdr lst)
(strcat (LM:csv-addquotes (car lst) sep) sep (LM:lst->csv (cdr lst) sep))
(LM:csv-addquotes (car lst) sep)
)
)

(defun LM:csv-addquotes ( str sep / pos )
(cond
( (wcmatch str (strcat "*[`" sep "\"]*"))
(setq pos 0)
(while (setq pos (vl-string-position 34 str pos))
(setq str (vl-string-subst "\"\"" "\"" str pos)
pos (+ pos 2)
)
)
(strcat "\"" str "\"")
)
( str )
)
)

(defun C:ttt(/ lst ss i el x fn)
(setq lst (list) ss (ssget (list (cons 0 "TEXT"))) )
(repeat (setq i (sslength ss))
(setq x (ssname ss (setq i (1- i))))
(setq el (entget x))
(if (= (cdr (assoc 0 el)) "TEXT")
(setq lst (append lst (list (list (cdr (assoc 1 el))))))
)
)
(setq fn (vl-filename-mktemp nil nil ".csv"))
(if (and lst (LM:WriteCSV (reverse lst) fn))
(startapp "explorer" fn)
)
)

 

 

0 Likes
Message 4 of 9

wilsonm2000
Advocate
Advocate

@Moshe-A wrote:

check DATEXTRACTION command

 


That was the first thing I tried, it doesn't pick up the Extended Data 😞

0 Likes
Message 5 of 9

wilsonm2000
Advocate
Advocate

@Anonymous wrote:

Would this work? Using the burst command, then use the scripts.

 

(defun LM:writecsv ( lst csv / des sep )
(if (setq des (open csv "w"))
(progn
(setq sep (cond ((vl-registry-read "HKEY_CURRENT_USER\\Control Panel\\International" "sList")) (",")))
(foreach row lst (write-line (LM:lst->csv row sep) des))
(close des)
t
)
)
)
(defun LM:lst->csv ( lst sep )
(if (cdr lst)
(strcat (LM:csv-addquotes (car lst) sep) sep (LM:lst->csv (cdr lst) sep))
(LM:csv-addquotes (car lst) sep)
)
)

(defun LM:csv-addquotes ( str sep / pos )
(cond
( (wcmatch str (strcat "*[`" sep "\"]*"))
(setq pos 0)
(while (setq pos (vl-string-position 34 str pos))
(setq str (vl-string-subst "\"\"" "\"" str pos)
pos (+ pos 2)
)
)
(strcat "\"" str "\"")
)
( str )
)
)

(defun C:ttt(/ lst ss i el x fn)
(setq lst (list) ss (ssget (list (cons 0 "TEXT"))) )
(repeat (setq i (sslength ss))
(setq x (ssname ss (setq i (1- i))))
(setq el (entget x))
(if (= (cdr (assoc 0 el)) "TEXT")
(setq lst (append lst (list (list (cdr (assoc 1 el))))))
)
)
(setq fn (vl-filename-mktemp nil nil ".csv"))
(if (and lst (LM:WriteCSV (reverse lst) fn))
(startapp "explorer" fn)
)
)

 

 


Unfortunately it won't work in this situation.  I have took a screenshot of the data I am trying to extract:

 

Extended Data.PNG

0 Likes
Message 6 of 9

Moshe-A
Mentor
Mentor

you are mixing phrases

 

1) there is block attributes

2) there is extended data (XDATA)

3) there is dictinary extended data

 

anyhow to extract option 2, 3 you need an application

 

0 Likes
Message 7 of 9

wilsonm2000
Advocate
Advocate

@Moshe-A wrote:

you are mixing phrases

 

1) there is block attributes

2) there is extended data (XDATA)

3) there is dictinary extended data

 

anyhow to extract option 2, 3 you need an application

 


You have an Extended Data tab in properties, My block has custom fields in this tab, that's the data I am trying to extract, see my screenshot

0 Likes
Message 8 of 9

Moshe-A
Mentor
Mentor

The Extended Data is available through vertical products built on AutoCAD like AutoCAD Architecture and AutoCAD MEP. 

 

maybe you need to move this to:

https://forums.autodesk.com/t5/autocad-architecture-forum/bd-p/248

or

https://forums.autodesk.com/t5/autocad-civil-3d-forum/bd-p/66

or

https://forums.autodesk.com/t5/autocad-map-3d-forum/bd-p/85

 

0 Likes
Message 9 of 9

ismar.salkicevicLFF93
Explorer
Explorer

Did you find a solution to the Problem?
I´m still searching

0 Likes