13816600495 发表于 2021-1-6 15:50:27

如何求得直线与弧线的交点

想编写一个自动打断线段的插件,但是弧线(ARC)与直线(LINE)的交点不会求,请大神指点。

yshf 发表于 2021-1-6 16:33:29

本帖最后由 yshf 于 2021-1-6 16:35 编辑

(setq intPoints (vla-IntersectWith lineObj arcObj acExtendNone))(setq I 0      j 0      k 0)
(if (/= (type intPoints) vlax-vbEmpty)
      (while (>= (vlax-safearray-get-u-bound (vlax-variant-value intPoints) 1) I)
            (setq tempPoint (vlax-safearray->list (vlax-variant-value intPoints)))
            (setq str (strcat "交点[" (itoa k) "] is: " (rtos (nth j tempPoint) 2) ","
                                                      (rtos (nth (1+ j) tempPoint) 2) ","
                                                      (rtos (nth (+ j 2) tempPoint) 2)))
            (alert str)
            (setq str ""
                  I (+ I 2)
                  j (+ j 3)
                  k (1+ k))
      )
)



bssurvey 发表于 2021-1-6 16:36:00

可以參閱http://bbs.mjtd.com/forum.php?mod=viewthread&tid=91750 6樓 byghbcx 大的

原地踏步 发表于 2021-1-7 08:40:49

若是想在交点处断开,用楼上的方法就可以了。如果想断开一定距离,建议用数学方法求交点。

13816600495 发表于 2021-1-7 14:19:56

yshf 发表于 2021-1-6 16:33
(setq intPoints (vla-IntersectWith lineObj arcObj acExtendNone))(setq I 0      j 0      k 0)
(if (/ ...

有效,问题解决,谢谢!:handshake

13816600495 发表于 2021-1-7 14:22:42

bssurvey 发表于 2021-1-6 16:36
可以參閱http://bbs.mjtd.com/forum.php?mod=viewthread&tid=91750 6樓 byghbcx 大的

谢谢,解决了!:handshake

13816600495 发表于 2021-1-7 14:23:00

原地踏步 发表于 2021-1-7 08:40
若是想在交点处断开,用楼上的方法就可以了。如果想断开一定距离,建议用数学方法求交点。

:handshake
页: [1]
查看完整版本: 如何求得直线与弧线的交点