Strip XData from the Layer Table using LISP

<?xml encoding=”UTF-8″>By Fenton Webb

Issue

How do I remove the XDATA that is attached to my Layer Table ?

Solution

The following AutoLISP code will remove all the XData attached to the Layer Table:

<br>(defun StripLayerXdata ()
<p> (setq aLayerLst (tblnext "LAYER" T))<br> (while aLayerLst<br>   (setq aLayerName (cdr (assoc '2 aLayerLst)))<br>   (setq aLayerELst (entget (tblobjname "LAYER" aLayerName) '("*")))<br>   (if (setq xdata (assoc '-3 aLayerELst))<br>     (progn<br>    (setq newLayerLst (subst (cons (car xdata) (list (list (caadr xdata))))<br>xdata aLayerELst))<br>    (entmod newLayerLst)<br>     )<br>   )<br>   (setq aLayerLst (tblnext "LAYER"))<br> )<br> (princ)<br>)<br>(vl-doc-export 'StripLayerXdata)<br>(princ "nStripLayerXdata loaded, type (StripLayerXdata) to run.")<br>(princ)<br></p>

Comments

Leave a Reply

Discover more from Autodesk Developer Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading