判断点在曲线内上外
(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)
)
)
(defun PtInPtn (p pt / aa)
"PtInPtn 点在点集内 (PtInPtn pt点 ptn点集)"
(setq aa (mapcar '(lambda (x y) (rem (- (angle x p) (angle y p)) pi)) pt (cons (last pt) pt))
aa (abs (apply '+ aa))
)
(equal aa pi 1e-8)
) 楼主都这么厉害了?? 我记得一年前你没这么厉害啊 .....扯...... .....扯......局限性太大 用ssget选择后获取图元名,在传给这个函数,会出现:错误: 参数类型错误: 二维/三维点: nil@434939575
页:
[1]