(defun c:mini_MinEncCircle ( / old_cmd ss x)
  (mai_start nil)
  (mai_last_com "mini_MinEncCircle")
  (setq ss (mai_select_first '((0 . "spline,ellipse,circle,arc,*polyline,line,point")) "选择要生成最小外接圆的线:<退出>" "没有选到线."))
  (initget "Y") 
  (setq ss
       (if (= "Y" (getkword "是否为每一个实体生成一个独立外接圆[是(Y)]:<回车全部实体生成一个外接圆>"))
           (mai_ssget_2_list ss)
           (list ss)
       )
  )
  (foreach x ss
    (setq x (apply 'append (mapcar 'cdr (mai_ssget_points x (list 2.5 (mai_chgunits 100)) (list nil nil nil))))
          x (mai_points_mincircle x)
    )
    (and x (mai_entmake "circle" (list (car x) (cadr x))))
  )
  (mai_end)
)
