- (defun c:ttt () ;2016-7-21 冯蔡路口 判断点在曲线的位置,曲线可以相交
- (setq na (car (entsel "pick")))
- (setq pt (getpoint "point"))
- (setq p (vlax-curve-getClosestPointTo na pt))
- (setq p5 (mid na))
- (setq cur_p5 (distance p5 p))
- (setq pt_p5 (distance p5 pt))
- (if (equal cur_p5 pt_p5 0.00001)
- (progn (setq pt_site 0) (princ "在曲线上"))
- (progn (if (> cur_p5 pt_p5)
- (progn (princ "在曲线内部") (setq pt_site -1))
- (progn (princ "在曲线外部") (setq pt_site 1))
- )
- )
- ) ;if
-
- )
- (defun mid (ss0 / ptmi ptma)
- (vla-getboundingbox
- (vlax-ename->vla-object ss0)
- 'ptmi
- 'ptma
- )
- (setq 2pts (mapcar 'vlax-safearray->list (list ptmi ptma)))
- (mapcar '(lambda (X Y) (/ (+ X Y) 2.0))
- (car 2pts)
- (cadr 2pts)
- )
- )
|