Here is one using ActiveX controls. [just a start also, but works]
(defun MySetXRec (Obj CodeList DataList / )
; Sets XRecordData. Dxf numbers between 1-369, except 5, 100, 105.
; See help for types and numbers to use.
(vla-SetXRecordData Obj
(vlax-make-variant
(vlax-safearray-fill
(vlax-make-safearray
vlax-vbInteger
(cons 0 (1- (length CodeList)))
)
CodeList
)
)
(vlax-make-variant
(vlax-safearray-fill
(vlax-make-safearray
vlax-vbVariant
(cons 0 (1- (length Datalist)))
)
DataList
)
)
)
)
(setq LayDict (vla-GetExtensionDictionary (vla-get-Layers (vla-get-ActiveDocument (vlax-get-Acad-Object)))))
(if (vl-catch-all-error-p (setq LayFltDict (vl-catch-all-apply 'vla-Item (list LayDict "AcLyDictionary"))))
(setq LayFltDict (vla-AddObject LayDict "AcLyDictionary" "AcDbDictionary"))
)
(setq xRec (vla-AddXRecord LayFltDict "Non-XrefLayers"))
(MySetXRec xRec'(1 90 300 301) '("AcLyLayerFilter" 1 "MyNon-Xrefs" "NAME==\"~*|*\""))
The two list represent what has to be there
1 = What the xrecord is, here it's an "AcLyLayerFilter"
90 = Not sure, but has to be there to use it
300 = Name
301 = What to filter