Jump to content

How to extract xdata into excel or txt

Recommended Posts

This will get you started. This retrieves the data and output to a txt file or excel would happen where the Alert is. There is a lot of variables and depending on object xdata varies so it will require further coding to match what it is you want to exactly output.


; xdata retrieve example by Alan H Aug 2017
(defun c:test ( / ent vals x codes datas)
(setq ent (entget (car (entsel "select an object"))))
(vla-GetXData (vlax-ename->vla-object (cdr (assoc -1 ent))) "" 'codes 'datas)
(if (/= datas nil)
(setq vals (vlax-safearray->list datas))
(setq ans "Xdata is\n\n")
(repeat (setq x (length vals))
(setq ans (strcat ans   (vlax-variant-value (nth (setq x (- x 1)) vals)) "\n"))
(alert ans)
(alert "Please pick again object has no xdata")

Edited by BIGAL

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now