马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
以下函数是我从论坛中找到的, 用了多时,没有问题,可今天却出了点麻烦,
这里是函数
- (defun tt( / ent1 ent2 lst1 pt )
- (setq ent1 (car (entsel "选择曲线1:")))
- (setq ent2 (car (entsel "选择曲线2:")))
- (print (setq lst1 (GetInterPoint ent1 ent2)))
- (command "_pline")
- (while (setq pt (car lst1))
- (command pt)
- (setq lst1 (cdr lst1))
- )
- (command "C")
- (princ)
- )
- (defun GetInterPoint ( ent1 ent2 / ax_ent_1 ax_ent_2 intpoints j disp)
- (setq ax_ent_1 (vlax-ename->vla-object ent1)
- ax_ent_2 (vlax-ename->vla-object ent2)
- )
- (setq intpoints (vla-intersectwith ax_ent_1 ax_ent_2 acextendnone))
- (setq intpoints (vlax-variant-value intpoints))
- (setq disp nil)
- (if (> (vlax-safearray-get-u-bound intpoints 1) 0)
- (progn
- (setq j 0)
- (repeat
- (/ (+ 1
- (- (vlax-safearray-get-u-bound intpoints 1)
- (vlax-safearray-get-l-bound intpoints 1)
- )
- )
- 3
- )
- (setq disp (cons (list (vlax-safearray-get-element intpoints j)
- (vlax-safearray-get-element intpoints (+ 1 j))
- (vlax-safearray-get-element intpoints (+ 2 j)))
- disp);cons
- j (+ j 3)
- )
- );repeat
- ;(princ disp)
- );progn
- ;(princ "\n两曲线没有交点")
- );if
- disp
- )
下面是求出的交点
((59118.6 635315.0 0.0) (59198.6 635350.0 0.0) (59144.2 635351.0 0.0) (59144.2
635351.0 0.0) (59195.9 635351.0 0.0))
你再看看图形(图在附件中,解压后为一DWG图形)
(图中红线是用所求的交点画出来的,要注意的是,你把红色圆的圆心处放大、放大、再放大,就能看出问题了)
明明是四个义点,却求出五个来。
真搞不明白?。。。。 |