;;;获取两条直线的交点 (defun c:ff () (mycopyright) (vl-load-com) (setq ent1 (entsel "\n选择第一条曲线:")) (setq ent2 (entsel "\n选择第二条曲线:")) (setq ent_1 (car ent1) ent_2 (car ent2) ) (setq int_list nil) (setq ax_ent_1 (vlax-ename->vla-object ent_1) ax_ent_2 (vlax-ename->vla-object ent_2) ) (setq intpoints (vla-intersectwith ax_ent_1 ax_ent_2 acextendnone)) (setq intpoints (vlax-variant-value intpoints)) (if (> (vlax-safearray-get-u-bound intpoints 1) 0) (progn (setq i 0) (setq j 0) (setq disp "") (repeat (/ (+ 1 (- (vlax-safearray-get-u-bound intpoints 1) (vlax-safearray-get-l-bound intpoints 1) ) ) 3 ) (setq disp (list (vlax-safearray-get-element intpoints j) (vlax-safearray-get-element intpoints (+ 1 j)) (vlax-safearray-get-element intpoints (+ 2 j)) ) ) (setq i (+ 2 i) j (+ 3 j) ) (setq int_list (append int_list (list disp))) ) ) ) (setq int_list int_list) ) |