- (defun c:tes ( / ent pt1 pt2)
- (vl-load-com)
- (if (and
- (setq pt1 (getpoint "\n请指定点位置"))
- (setq ent (entsel "\n请选择曲线"))
- (setq ent (car ent))
- (numberp (vl-catch-all-apply 'vlax-curve-getEndParam (list ent)));对象为曲线
- )
- (progn
- (setq pt2 (vlax-curve-getclosestpointto ent pt1 t))
- (princ (distance pt1 pt2));显示最短距离
- (entmake (list '(0 . "LINE") (cons 10 pt1) (cons 11 pt2)));绘制垂直线
- )
- (princ "\n对象不是曲线")
- )
- (princ)
- )
|