快要绝望了,请大师帮指点。
本帖最后由 wensg2006 于 2016-7-23 22:33 编辑自己在网上找些相关代码写的。画图形只能画部分,其余的画不出来,但是重新使用该命令,选择画不出来的部分,又可以画出来了。为什么不能一次性都画出来呢,求大师指点。
;;;找交点
(defun C:ZJD (/ e1 e2 e3 e4 SS1 SS2 I p1 p2 p3 p4 lst1);
(setq e1 (vlax-ename->vla-object(car(entsel))));画圆心位置的线条
(setq e2 (vlax-ename->vla-object(car(entsel))));求圆半径的圆心所在直线
(setq e3 (vlax-ename->vla-object(car(entsel))));求圆半径所在直线
(setq SS1 (ssget '((0 . "line"))));相交的直线
(setq I 0)
(repeat (sslength SS1)
(setq e4 (vlax-ename->vla-object (ssname SS1 I)))
(setq p1 (vlax-invoke e1 'intersectwith e4 0))
(setq p2 (vlax-invoke e2 'intersectwith e4 0))
(setq p3 (vlax-invoke e3 'intersectwith e4 0))
(if (= (length p3) 3)
(progn
(setq d (distance p2 p3))
(setq p4 (polar p1 (* 0.5 pi) d))
(command "point" p1)
(command "point" p2)
(command "circle" p1 d)
(command "point" p4)
(setq I (1+ I))
)
)
)
(princ)
)
注意关闭捕捉,正交 真的是这个问题,现在可以了,谢谢大师指点。 (defun C:ZJD (/ e1 e2 e3 e4 SS1 SS2 I p1 p2 p3 p4 lst1);
(setq e1 (vlax-ename->vla-object(car(entsel))));画圆心位置的线条
(setq e2 (vlax-ename->vla-object(car(entsel))));求圆半径的圆心所在直线
(setq e3 (vlax-ename->vla-object(car(entsel))));求圆半径所在直线
(setq SS1 (ssget '((0 . "line"))));相交的直线
(setq I 0)
(repeat (sslength SS1)
(setq e4 (vlax-ename->vla-object (ssname SS1 I)))
(setq p1 (vlax-invoke e1 'intersectwith e4 0))
(setq p2 (vlax-invoke e2 'intersectwith e4 0))
(setq p3 (vlax-invoke e3 'intersectwith e4 0))
(if (= (length p3) 3)
(progn
(setq d (distance p2 p3))
(setq p4 (polar p1 (* 0.5 pi) d))
(command "point" "non"p1)
(command "point" "non"p2)
(command "circle" "non"p1 d)
(command "point" "non"p4)
(setq I (1+ I))
)
)
)
(princ)
)
页:
[1]