本帖最后由 作者 于 2004-5-29 20:14:23 编辑
- ;|利用 offset 方法判断点在曲线的内外关系. 测试版 -----------无痕。
- 返回T=在内. !!!***************支持不闭合曲线***********************!!!
- 对自相交曲线有bug.不支持!
- (defun c:test (/ e) (while (setq e (entsel "\n选曲线:"))(print (ptin e (getpoint "\n选点:")))))
- |;
- (defun ptin (ept pt / oecho oe obj e ll ur k)
- (vl-load-com)
- (setq oecho (getvar "cmdecho"))
- (vl-cmdf ".undo" "be")
- (setvar "cmdecho" 0)
- (setq obj (vlax-ename->vla-object (car ept))
- e (entlast))
- (vla-getboundingbox obj 'll 'UR)
- (setq d (apply 'distance (mapcar 'vlax-safearray->list (list LL UR))))
- (vl-cmdf "_.offset" d ept pt)(vl-cmdf);偏移
- (setq k (if (eq (entlast) e) T nil))
- (vl-cmdf ".undo" "e" "u")
- (setvar "cmdecho" oecho)
- k
- )
|