I tend to use :
(vlax-invoke <obj> 'IntersectWith <obj> acExtend<something> )
As opposed to vla-intersectwith, as the above will return nil upon no intersection, whereas, when using vla-intersectwith, you either have to check for an error with the safearray->list, (as in CAB's Example):
(vl-catch-all-apply (function vlax-safearray->list)
(list (vlax-variant-value
(vla-IntersectWith obj1 obj2 acExtendNone))))
(As you can have an empty variant, but you cannot convert it to a list).
Or, you have to check the dimension of the safearray:
(if (< 0 (vlax-safearray-get-u-bound
(vlax-variant-value
(vla-Intersectwith obj1 obj2 acExtendNone)) 1))
...
As a negative upper bound indicates an empty variant.
As an example, this will get all intersections between objects in a SelSet:
(defun Get_Inters (ss / list->3D-point i j obj1 obj2 iLst)
;; Lee Mac ~ 19.01.10
(defun list->3D-point (lst)
(if lst
(cons (list (car lst) (cadr lst) (caddr lst))
(list->3D-point (cdddr lst)))))
(setq i (sslength ss))
(while (not (minusp (setq j (1- i) i (1- i))))
(setq obj1 (vlax-ename->vla-object (ssname ss i)))
(while (not (minusp (setq j (1- j))))
(setq obj2 (vlax-ename->vla-object (ssname ss j)))
(setq iLst (append iLst
(list->3D-point
(vlax-invoke obj1 'IntersectWith obj2 acExtendNone))))))
iLst)
(defun c:test (/ ss x)
(vl-load-com)
(if (setq ss (ssget))
(foreach x (get_Inters ss)
(command "_.point" "_non" x)))
(princ))
Hope this helps!
Lee