Xrecord Objects

AutoCAD AutoLISP & Visual LISP

 
Xrecord Objects
 
 
 

Xrecord objects are used to store and manage arbitrary data. They are composed of DXF group codes with normal object groups (that is, non-xdata group codes), ranging from 1 through 369 for supported ranges. These objects are similar in concept to xdata but is not limited by size or order.

The following examples provide methods for creating and listing xrecord data.

(defun C:MAKEXRECORD( / xrec xname )
  ; create the xrecord's data list.
  (setq xrec '((0 . "XRECORD")(100 . "AcDbXrecord") 
    (1 . "This is a test xrecord list")
    (10 1.0 2.0 0.0) (40 . 3.14159) (50 . 3.14159) 
    (62 . 1) (70 . 180))
  )
    
  ; use entmakex to create the xrecord with no owner.
  (setq xname (entmakex xrec))
    
  ; add the new xrecord to the named object dictionary.
  (dictadd (namedobjdict) "XRECLIST" xname)
    
  (princ)
)
    
    
(defun C:LISTXRECORD ( / xlist )
  ; find the xrecord in the named object dictionary.
  (setq xlist (dictsearch (namedobjdict) "XRECLIST"))
    
  ; print out the xrecord's data list.
  (princ xlist)
    
  (princ)
)