LISP语言中求点到直线的距离
来源:学生作业帮 编辑:大师作文网作业帮 分类:综合作业 时间:2024/11/21 01:24:30
LISP语言中求点到直线的距离
(vl-load-com)
(setq p(getpoint"选择点位"))
(while(/=(setq s(car(entsel"选取直线"))e(cdr(assoc 0(entget s))))"LINE"))
(distance(vlax-curve-getClosestPointTo(vlax-ename->vla-object s)p t)p)
再问: 麻烦你调一下格式,我有点看不懂
再答: (vl-load-com) (setq p(getpoint"选择点位")) (while(/=(setq s(car(entsel"选取直线")) e(cdr(assoc 0(entget s))))"LINE"));如果不是直线会要求重新选择 (distance (vlax-curve-getClosestPointTo (vlax-ename->vla-object s)p t)p) ;(vlax-ename->vla-object s)把图元名转成VLA对象 ; (vlax-curve-getClosestPointTo OBJ p t)可延伸OBJ求P点到它的最近点,也可以理解为是垂足 ;(distance p1 p2)求P1点P2点的距离
(setq p(getpoint"选择点位"))
(while(/=(setq s(car(entsel"选取直线"))e(cdr(assoc 0(entget s))))"LINE"))
(distance(vlax-curve-getClosestPointTo(vlax-ename->vla-object s)p t)p)
再问: 麻烦你调一下格式,我有点看不懂
再答: (vl-load-com) (setq p(getpoint"选择点位")) (while(/=(setq s(car(entsel"选取直线")) e(cdr(assoc 0(entget s))))"LINE"));如果不是直线会要求重新选择 (distance (vlax-curve-getClosestPointTo (vlax-ename->vla-object s)p t)p) ;(vlax-ename->vla-object s)把图元名转成VLA对象 ; (vlax-curve-getClosestPointTo OBJ p t)可延伸OBJ求P点到它的最近点,也可以理解为是垂足 ;(distance p1 p2)求P1点P2点的距离