Hello everyone,
are months that I use the following function to remove xdata, from an object:
(defun DeleteXdata (appname ent /)
(entmod (list (cons -1 ent)(list -3 (list appname))))
(princ)
)
Today I noticed that when I use this function to an object of type "ARC_DIMENSION" is issued the following error:
error: detected an exception: 0xC0000005 (Violation
access)
; Warning: unwind omitted except unknownwhich often causes the crash of AutoCAD.
Do you have any explanation?
Here below the code I use to test the problem:
(defun c:test (/ ogg)
(setq ogg (car (entsel)))
(addXdata ogg "TESTAPP" "IDCODE" "1")
(DeleteXdata "TESTAPP" ogg)
)
(defun DeleteXdata (appname ent /)
(entmod (list (cons -1 ent)(list -3 (list appname))))
(princ)
)
(defun addXdata (ogg nomeapp labeldato valdato / lastent exdata newent datoesistente)
(if (= (tblsearch "appid" nomeapp) nil)
(if (= (regapp nomeapp) nil)
(princ (strcat "\nSi è verificato un errore nell'applicazione " nomeapp "."))
)
)
(setq lastent (entget ogg (list nomeapp)))
(setq exlist (assoc -3 lastent))
(if exlist
(progn
(setq thexdata (cdr (car (cdr exlist))))
(setq dati (list (car thexdata)))
(foreach datix thexdata (setq dati (append dati (list datix))))
(setq thexdata (append (cdr dati) (list (cons ' 1000 (strcat labeldato "=" valdato)))))
(setq exdata (list (cons ' -3 (list (cons nomeapp thexdata )))))
)
(setq exdata (list (cons ' -3 (list (cons nomeapp (list (cons ' 1000 (strcat labeldato "=" valdato))))))))
)
(setq lastent (entget ogg))
(setq newent (append lastent exdata))
(entmod newent)
)
I hope you can help me.