limfx Posted June 18 Posted June 18 I have a function to delete Xdata as follows: (defun DeleteXData (ename app / edata newdata) (setq edata (entget ename '("*"))) (setq newdata (vl-remove-if (function (lambda (x) (and (eq (car x) -3) ; là XDATA (eq (car (car (cdr x))) app))) ) edata ) ) (entmod newdata) (entupd ename) ) Pline Xdata : ((-1 . <Entity name: 2ae44387aa0>) (0 . "LWPOLYLINE") (330 . <Entity name: 2ae1c3961f0>) (5 . "ECEA") (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 . "0") (100 . "AcDbPolyline") (90 . 4) (70 . 0) (43 . 0.0) (38 . 0.000508626) (39 . 0.0) (10 588879.0 1.53624e+06) (40 . 0.0) (41 . 0.0) (42 . 0.0) (91 . 0) (10 588886.0 1.53623e+06) (40 . 0.0) (41 . 0.0) (42 . 0.0) (91 . 0) (10 588869.0 1.53616e+06) (40 . 0.0) (41 . 0.0) (42 . 0.0) (91 . 0) (10 588851.0 1.53617e+06) (40 . 0.0) (41 . 0.0) (42 . 0.0) (91 . 0) (210 0.0 0.0 1.0) (-3 ("ED0ATenTD" (1000 . "(\"ED0A\")")) ("F778TenTD" (1000 . "(\"F778\")")) ("FDAETenTD" (1000 . "(\"FDAE\")")) )) Can I ask why the function is not working ? Quote
GLAVCVS Posted June 18 Posted June 18 Hello Have you ever used this code and did it work for you? 1 Quote
Saxlle Posted June 18 Posted June 18 Maybe something like this will help you: .................... (setq ename (car (entsel)) edata (entget ename '("*")) data (cdr (assoc -3 edata)) ) (foreach memb data (setq nlst (cons -3 (list (cons (car memb) nil)))) (setq ndata (subst nlst (assoc -3 edata) edata)) (entmod ndata) ) .................... 2 Quote
limfx Posted June 18 Author Posted June 18 13 minutes ago, GLAVCVS said: Hello Have you ever used this code and did it work for you? I have created save and read xdata but am struggling to find a way to delete it, the code is not executed yet! Quote
Saxlle Posted June 18 Posted June 18 After the XDATA deleted, you can check with command XDLIST, select that entity and you will get like this: "No Xdata associated with Application Name(s). Object has 16383 bytes of Xdata space available." 1 Quote
limfx Posted June 18 Author Posted June 18 13 minutes ago, Saxlle said: Maybe something like this will help you: .................... (setq ename (car (entsel)) edata (entget ename '("*")) data (cdr (assoc -3 edata)) ) (foreach memb data (setq nlst (cons -3 (list (cons (car memb) nil)))) (setq ndata (subst nlst (assoc -3 edata) edata)) (entmod ndata) ) .................... Thanks a lot Saxlle! The code works great. I don’t fully understand how it works yet (it will take some time) but it’s very useful! Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.