I can't write this on VBA for this moment, maybe with
lisp this will helps you too...
Copy code to Notepad, then save this code as ilf.lsp
Draw 3dfaces, draw lines by coordinates of 3d polyline, then
run this lisp. Just type ilf in command line
~~~~~~~~~~~~~~code begin
;; written by Fatty T.O.H.()2006
;; all rights removed
;; intersection line with 3dface
(defun group-by-num (lst num / ls ret)
(if (= (rem (length lst) num ) 0)
(progn
(setq ls nil)
(repeat (/ (length lst) num)
(repeat num (setq ls
(cons (car lst) ls)
lst (cdr lst)))
(setq ret (append ret (list (reverse ls)))
ls nil)))
)
ret
)
(defun c:ilf (/ a b c1 ipt p1 p2 p3 p4 p5)
(vl-load-com)
(if (not cal)
(arxload "geomcal.arx"))
(setq a (vlax-ename->vla-object
(car (entsel "\nSelect line :\n")))
b (vlax-ename->vla-object
(car (entsel "\nSelect 3dface:\n")))
ipt (vla-Intersectwith a b acextendnone))
(setq c1 (group-by-num(vlax-get b 'coordinates) 3 )
p1 (vlax-get a 'Startpoint)
p2 (vlax-get a 'Endpoint)
p3 (car c1)
p4 (cadr c1)
p5 (caddr c1))
(setq ipt (cal "ilp(p1,p2,p3,p4,p5)"))
(alert (strcat "Intersection point coordinates:\n\n"
"X= " (vl-princ-to-string (rtos (car ipt) 2 12)) "\n"
"Y= " (vl-princ-to-string (rtos (cadr ipt) 2 12)) "\n"
"Z= " (vl-princ-to-string (rtos (caddr ipt) 2 12))))
(princ)
)
(prompt "\n\t\t*** Type ILF to execute ***")
(princ)
code end~~~~~~~~~~~~~~~~~
Fatty
~'J'~