AutoLISP查询圆的相关属性,包括圆心坐标、半径、周长和面积四个信息,代码如下。
(defun c:ccleppt ()
(setq ss (car (entsel "\n请选择要查询的圆:")))
(setq ssob (vlax-ename->vla-object ss))
(setq center (vlax-get ssob 'center))
(setq radius (vlax-get ssob 'radius))
(setq area (vlax-get ssob 'area))
(print (cons (car center) (cadr center)))
(print (strcat "半径:" (rtos radius)))
(print (strcat "周长:" (rtos (* pi (* 2 radius)))))
(print (strcat "面积:" (rtos area)))
(princ)
)
代码完。