There is a strange misbehaviour in (vla-GetXRecordData) and (vla-SetXRecordData) in AutoCAD AutoLISP, when it comes to ObjectId/Ename values :
in
(vla-SetXRecordData), the ObjectId/Ename value must be specified as VLA-OBJECT (IDispatch), i.e. for 340 group code;
but in
(vla-GetXRecordData) those ObjectId/Ename objects are returned as list of 2 integers, as Lee also found;
AutoCAD provides 2 strange values,
BricsCAD provides the 1. integer as true ObjectId integer value (even in 64 bit), and the second is 0 ...
So there is no need to create such identical array of integer ObjectId/Ename values, but it must be of VLA-OBJECT (IDispatch) type.
The most natural way to return ObjectId/Ename for COM would be to use IDispatch objects, seems to be a bug in AutoCAD AutoLISP, such integers makes no sense at all in COM, and are unusable especially for external apps.
But if we would change BricsCAD LISP here, application code would get unexpected values, and it would be incompatible
types array : Variant, containing a SafeArray of VT_I2 (vlax-vbInteger) type
value array : Variant, containing a SafeArray of VT_VARIANT (vlax-vbVariant) type, each item is a Variant itself, because the values can be of different types (int, string, double, ....), due to corresponding type item
here is some test code as I used to verify the behaviour :
(vl-load-com)
(setq vlaen (vlax-ename->vla-object (entlast)))
(setq dict (vla-GetExtensionDictionary vlaen))
(setq objId (vla-get-objectid vlaen))
(setq saTypes (vlax-make-safearray vlax-vbInteger '(0 . 0)))
(vlax-safearray-fill saTypes (list 340))
(setq vtTypes (vlax-make-variant saTypes))
(setq saValues (vlax-make-safearray vlax-vbVariant '(0 . 0)))
(setq vtObject (vlax-make-variant vlaen))
(vlax-safearray-fill saValues (list vtObject))
(setq vtValues (vlax-make-variant saValues))
(setq xrcd (vla-AddXRecord dict "xxx"))
(vla-SetXRecordData xrcd vtTypes vtValues)
(setq types nil values nil)
(vla-getxrecorddata xrcd 'types 'values)
(print types)
(print values)
(setq types (vlax-safearray->list types))
(setq values (vlax-safearray->list values))
(setq val (car values))
(setq res (vlax-variant-value val))
(vlax-safearray->list res)
Nevertheless, I improved (vlax-make-variant/safearray) functions to accept the type "20" (vla-vbInt64) just for some special cases ... will be in upcoming BricsCAD.
I hope this clarifies the situation ?
many greetings to all !