How often have you taken the lower left coordinates and upper right coordinates that you get from autocad and you want to use them to get the other corners. In a list you'd do it something similar to this:
(setq ll (list 0.0 0.0 0.0)
ur (list 9.0 9.0 0.0)
ul (list (car ll) (cadr ur) (caddr ll))
)
Not bad, but if you have a safearray of these same coordinates, you might think to do something like convert the safearray's to lists, hack them up and re-convert them back to safearray's. Well, instead of doing this, you could use vlax-safearray-get-element and safearray-put-element. Here is a function I just wrote to do this.
;;;-------------------------------------------------------------;
;;;-change elements in a safearray ;
;;; needed: (vla-getBoundingBox ;
;;; (vlax-ename->vla-object ;
;;; (car ;
;;; (entsel) ;
;;; ) ;
;;; ) ;
;;; 'll ;
;;; 'ur ;
;;; ) ;returns two safearrays of doubles. ;
;;; usage: (setq upperleft (changeElement ll 1 ur 1)) ;
;;; Returns: A variant 8197, safearray of doubles ;
;;; var and gvar = either ll or ur. Index and gindex = the index;
;;; of the safearray. Similar to car cadr. i.e. 0 = x, 1 = y ;
;;; Of course, a safearray can contain 16 indexes per boundary ;
;;;-------------------------------------------------------------;
;;; Written by: Daron Rogers ;
;;;-------------------------------------------------------------;
(defun changeElement (var index gvar gindex)
(vlax-safearray-put-element
var
index
(vlax-safearray-get-element gvar gindex)
)
(vlax-make-variant var)
)