How to remove the xdata information attached to an entitiy
; 08/04/2003 ; BitFlg = 1 prompts ON ; BitFlg = 2 erase Xdata on all objects ; Use: ; (ALE_DelXdataSs '("MyApp1" "MyApp2") 1) ; delete by AppID's and by selection ; or ; (ALE_DelXdataSs '("*") 3) ; delete all AppID's from all objects ; ; Comments: ; The filter in ssget is not useful, because in case of a block with ; Attribute Xdata only, it doesn't work. ; The argument of the function should be a list. This allows you to ; delete Xdata's with different AppID's. ; (defun ALE_DelXdataSs (ApsLst BitFlg / SsXdat ApsStr EntNam Countr) (setq ApsStr "") (foreach AppNam ApsLst (setq ApsStr (strcat ApsStr "," AppNam)) ) (if (= 2 (logand 2 BitFlg)) (setq SsXdat (ssget "_X" (list (list -3 (list (substr ApsStr 2)))))) (setq SsXdat (ssget (list (list -3 (list (substr ApsStr 2)))))) ) (cond ( SsXdat (repeat (setq Countr (sslength SsXdat)) (setq Countr (1- Countr) EntNam (ssname SsXdat Countr)) (ALE_DelXdataEnt EntNam ApsLst BitFlg) (and (= "INSERT" (DXF 0 (entget EntNam))) (while (= "ATTRIB" (DXF 0 (entget (setq EntNam (entnext EntNam))))) (ALE_DelXdataEnt EntNam ApsLst BitFlg) ) ) );repeat (and (= 1 (logand 1 BitFlg)) (princ "\nXdata erased. ")) ) ( (= 1 (logand 1 BitFlg)) (princ "\nNo objects with Xdata found. ") ) ) ) ; ; BitFlg is only for my special use ; Use: ; (ALE_DelXdataEnt ename '("MyApp1" "MyApp2") 0) ; ; In AutoCAD 14 Xdata on dimension entities will be not erased if they are substituted ; with an empty list when there are no Xdata of another application, see AND condition ; (defun ALE_DelXdataEnt (EntNam ApsLst BitFlg / EntDat TmpLst) (setq EntDat (entget EntNam ApsLst)) ; (and ; (= 14 (atoi (getvar "ACADVER"))) ; (eq "DIMENSION" (DXF 0 EntDat)) ; (not (DXF -3 (entget EntNam '("ACAD")))) ; (entmod (list (cons -1 EntNam) '(-3 ("ACAD" (1000 . "DSTYLE"))))) ; ) (foreach AppDat (DXF -3 EntDat) (setq TmpLst (cons (list (car AppDat)) TmpLst)) ) (entmod (list (cons -1 EntNam) (cons -3 TmpLst))) ) ; For single AppName (Doug B.) - Use: (ALE_DelXdata1AppEnt ename "MyApp1") ;(defun ALE_DelXdata1AppEnt (EntNam AppNam) ; (entmod (list (cons -1 EntNam) (list -3 (list AppNam)))) -- Marc'Antonio Alessi http://xoomer.virgilio.it/alessi (strcat "NOT a " (substr (ver) 8 4) " guru.") --
Or if you just have one (or a few entities), a normal copy of the objet (not copyclip) should get rid of the xdata. D