AutoLISP查询椭圆的相关属性
2011-04-11 17:03 精诚所至 金石为开 阅读(369) 评论(0) 编辑 收藏 举报AutoLISP查询椭圆的相关属性,包括椭圆的中心、长轴、短轴、周长和面积,代码如下。
(defun c:elppt ()
(setq ss (car (entsel "\n请选择所要查询的椭圆:")))
(setq ssob (vlax-ename->vla-object ss))
(setq center (vlax-get ssob 'Center))
(setq maxr (vlax-get ssob 'MajorRadius))
(setq minr (vlax-get ssob 'MinorRadius))
(setq area (vlax-get ssob 'Area));;;显示信息
(print (strcat "中心:" (rtos (car center)) "," (rtos (cadr center))))
(print (strcat "长轴:" (rtos maxr)))
(print (strcat "短轴:" (rtos minr)))
(print (strcat "周长:" (rtos (+ (* 2 pi minr) (* 4 (- maxr minr))))))
(print (strcat "面积:" (rtos area)))
(princ)
)
代码完。