应该没这么简单吧 我在别人那儿捡了一段代码:
;;164.47.3 [功能] pt到曲线的垂点不在延长线上,返回T
;;(HH:perPtIn (getpoint) (car(entsel)))
(defun HH:perPtIn (p curve / P1 P2 PA)
(setq p1 (vlax-curve-getClosestPointTo curve p))
(setq pa (vlax-curve-getParamAtPoint curve P1)) ;参数
(setq p2 (mapcar '+ (vlax-curve-getFirstDeriv curve pa) p1)) ;切线上一点
(equal (caddr (trans (mapcar '- p p1) 0 (mapcar '- p2 p1))) 0 1e-5)
) lijiao 发表于 2022-2-17 11:33
我这无效呢全是线外
(defun c:tt()
(setq e(car(entsel))
p(getpoint))
(setq on1 (equal pt (vlax-curve-getClosestPointTo e p) 0.000001))
(setq on2 (equal pt (vlax-curve-getClosestPointTo e p t) 0.000001))
(cond
((and on1 on2) (princ "在线上"))
((and (not on1) on2) (princ "在延长线上"))
(t (princ "在线外"))
)
(prin1)
)
下载试用一下,感谢分享
页:
1
[2]