TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: mkweaver on September 19, 2015, 12:49:08 PM
-
I'm working on a couple of subroutines to add xdata to an entity. Everything works fine until I do the ENTMOD, which fails. Here is the entity data for the line to which I'm trying to add the xdata.
((-1 . <Entity name: 7ff785c04e60>)
(0 . "LINE")
(330 . <Entity name: 7ff785c039f0>)
(5 . "1E6")
(100 . "AcDbEntity")
(67 . 0)
(410 . "Model")
(8 . "0")
(100 . "AcDbLine")
(10 14.5179 15.4665 0.0)
(11 25.7092 14.1183 0.0)
(210 0.0 0.0 1.0)
)
And the list I'm sending to ENTMOD:
((-1 . <Entity name: 7ff785c04e60>)
(0 . "LINE")
(330 . <Entity name: 7ff785c039f0>)
(5 . "1E6")
(100 . "AcDbEntity")
(67 . 0)
(410 . "Model")
(8 . "0")
(100 . "AcDbLine")
(10 14.5179 15.4665 0.0)
(11 25.7092 14.1183 0.0)
(210 0.0 0.0 1.0)
(-3 ("MyApp"
(1002 . "{")
(1000 . "KEY1")
(1000 . "Value1")
(1002 . "}")
(1002 . "{")
(1000 . "KEY2")
(1000 . "Value2")
(1002 . "}")
)
)
)
ENTMOD returns NIL. There must be something wrong with the xdata, but I'm not seeing it.
Suggestions?
Thanks,
Mike
-
Is "MyApp" registered? (regapp "MyApp")
-
Mike,
Your data is ok, so has to be what Lee suggested
that is you must issue (regapp "MyApp") before
attempting the entmod.
(defun c:test ()
(regapp "MyApp")
(setq entl (entget (car (entsel)))
xdta '((-3 ("MyApp"
(1002 . "{")
(1000 . "KEY1")
(1000 . "Value1")
(1002 . "}")
(1002 . "{")
(1000 . "KEY2")
(1000 . "Value2")
(1002 . "}")
)
))
newl (append entl xdta)
)
(entmod newl)
)
$ (c:test)
((-1 . <Entity name: 7ffff43db90>) (0 . "LINE") (330 . <Entity name: 7ffff43f9f0>) (5 . "1D1") (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 . "0") (100 . "AcDbLine") (10 14.4366 5.4871 0.0) (11 27.3359 13.0912 0.0) (210 0.0 0.0 1.0) (-3 ("MyApp" (1002 . "{") (1000 . "KEY1") (1000 . "Value1") (1002 . "}") (1002 . "{") (1000 . "KEY2") (1000 . "Value2") (1002 . "}"))))
_$
-
That was it - I hadn't registered the app name.
Thanks!