这是论坛上一个绘制垂线的代码,可以选择垂足和垂线长度,但是只能往垂足的一边绘制,是否可以选择垂足后往两边绘制指定长度的垂线呀
- ;http://bbs.mjtd.com/forum.php?mod=viewthread&tid=169824&extra=&highlight=%B4%B9%CF%DF&page=2
- (defun c:CCX(/ e p d)
- (setq d(getreal"垂线长度[500]"))
- (setq d(if d d 500));;改长度
- (while(setq e(car(entsel"\n拾取基准线")))
- (while(setq p(getpoint"\n垂足位置"))
- (entmakex(list'(0 . "line")(cons 10(setq p(vlax-curve-getclosestpointto e p)))
- (cons 11(polar p(+(angle p(mapcar'+(vlax-curve-getfirstDeriv e(vlax-curve-getParamAtPoint e p))p))(* pi 0.5))d))))
- )
-
- )
- (princ)
- )
|