If you run this command, you will notice that the xref actually attaches to the current drawing's model space instead of the ObjectDBX's model space. With this new finding I guess the code I have been working on to switch xref styles doesn't really mean much, since I was hoping it could be used in a batch type program with ODBX. Maybe it will have to be done in C# then.
Or is this a bug that should be reported?
(defun c:OdbXrefTest (/ DwgFile dbxApp oVer dbxMspace)
(and
(setq DwgFile (getfiled "Select drawing to xref in." "" "dwg" 4))
(setq dbxApp
(if (< (atoi (setq oVer (substr (getvar "acadver") 1 2))) 16)
(vla-GetInterfaceObject (vlax-get-acad-object) "ObjectDBX.AxDbDocument")
(vla-GetInterfaceObject (vlax-get-acad-object) (strcat "ObjectDBX.AxDbDocument." oVer))
)
)
(setq dbxMspace (vla-get-ModelSpace dbxApp))
(vlax-invoke
dbxMspace
'AttachExternalReference
DwgFile
"Testing"
'(0. 0. 0.)
1.
1.
1.
0.
1
)
(vlax-release-object dbxApp)
(setq dbxApp nil)
)
(princ)
)