LISP: problem with xrecords and group code 290

I am hitting the wall on this one:

This works:

(setq dataLst '((60 . 0) (1 . "some text")))
(dictadd (namedobjdict) "test" (entmakex (append '((0 . "XRECORD") (100 . "AcDbXrecord")) dataLst)))
(entget (cdr (assoc -1 (dictsearch (namedobjdict) "test"))))

But this doesn't:

(setq dataLst2 '((60 . 0) (290 . 0)))
(dictadd (namedobjdict) "test2" (entmakex (append '((0 . "XRECORD") (100 . "AcDbXrecord")) dataLst2))) ; => error : bad argument type <NIL> ; expected ENTITYNAME at [DICTADD]
(entget (cdr (assoc -1 (dictsearch (namedobjdict) "test2"))))

Can anyone explain this?

Comments

  • Hmmm... I am not much help but my guess is entmakex is just returning NIL for any DXF group code it does not know what to do with, whether unsupported or unknown. You should probably send in a support request to get it addressed.

  • Dear Roy, Dear Greg,
    I will check what happens if the XRecord definition list has groupcode 290 ...
    With a little luck, easy to solve ...

    Ad Greg mentioned, it is likely that (entmakex) returns NIL then - you might try ?
    Greetings, Torsten

  • Torsten and Greg, you are both right: (entmakex) returns nil. But that is strange because xrecords can contain groupcode 290. I am using (vla-setxrecorddata) instead now. (vla-setxrecorddata) does handle groupcode 290, but is a somewhat cumbersome function. One problem being that I couldn't find a way for that function to directly handle enames. I had to write a pretty weird EnameToVariant function as a workaround. Avoiding groupcode 290 would of course "solve" the problem, but that is not an option since I am writing functions to handle layerstates, and layerstates use this groupcode.

  • Dear Roy, Dear Greg,
    I have fixed support for boolean groupcodes (like 290-299) ... now your sample
    works as expected;
    I assume, the fix should get included in (one of) next Bricscad version(s).

    Many thanks for your hints !

  • Great! Thank you Torsten.

This discussion has been closed.