Author Topic: What is wrong with this xdata?  (Read 2237 times)

0 Members and 1 Guest are viewing this topic.

mkweaver

  • Bull Frog
  • Posts: 352
What is wrong with this xdata?
« 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.
Code: [Select]
((-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:
Code: [Select]
((-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

Lee Mac

  • Seagull
  • Posts: 12892
  • London, England
Re: What is wrong with this xdata?
« Reply #1 on: September 19, 2015, 02:55:30 PM »
Is "MyApp" registered? (regapp "MyApp")

ymg

  • Guest
Re: What is wrong with this xdata?
« Reply #2 on: September 19, 2015, 03:21:13 PM »
Mike,

Your data is ok, so has to be what Lee suggested
that is you must issue (regapp "MyApp") before
attempting the entmod.

Code: [Select]
(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)
)

Quote
$ (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 . "}"))))
_$

mkweaver

  • Bull Frog
  • Posts: 352
Re: What is wrong with this xdata?
« Reply #3 on: September 22, 2015, 11:06:15 PM »
That was it - I hadn't registered the app name.

Thanks!