Why is my xdata not updating?

Why is my xdata not updating?

saitoib
Advocate Advocate
650 Views
3 Replies
Message 1 of 4

Why is my xdata not updating?

saitoib
Advocate
Advocate

Hello all.

 

 

I'm trying to add xdata, but I can't seem to get it to work.
With the following code, I think the data below -3 is created, but it is not updated.
Is there something wrong with the code?

Thank you very much for your help.

(defun c:test1 (/ var ent app field lst new_xdata)
	(setq var (entsel "\nSelect Object"))
	(setq ent (entget (car var)))
	(setq app "acad" field "test" lst (cons 1040 90.0))
	(setq new_xdata (list (cons 1000 field)	(cons 1002 "{")	lst (cons 1002 "}")))
	(setq new_xdata (cons -3 (list (cons app new_xdata))))
	(setq ent (reverse (cons new_xdata (reverse ent))))
	
	(entmod ent)
)
Saitoib
0 Likes
Accepted solutions (1)
651 Views
3 Replies
Replies (3)
Message 2 of 4

dbroad
Mentor
Mentor
Accepted solution

At the very least, you can't use ACAD as the app name. You should name your application first and then register it with regapp before using it. Your code is likely to crash AutoCAD.

Architect, Registered NC, VA, SC, & GA.
0 Likes
Message 3 of 4

john.uhden
Mentor
Mentor

Oops.  My mistake.

John F. Uhden

0 Likes
Message 4 of 4

saitoib
Advocate
Advocate

Thank you for your guidance.
Also, I see that I need a program to get xdata.
I think I can solve this problem somehow.

Saitoib
0 Likes