;;缩放到窗选物件
(defun c:zoom_w_ss_box (/ abc ss)
  (if (setq ss (ssget))
    (progn
      (setq abc (fsxm-ss-box ss))
      (vlax-invoke
	(vlax-get-acad-object)
	'zoomwindow
	(trans (car abc) 0 1)
	(trans (cadr abc) 0 1)
      )
      (grdraw (car abc)
	      (list (caar abc) (cadadr abc))
	      2
	      1
      )
      (grdraw (list (caar abc) (cadadr abc))
	      (cadr abc)
	      2
	      1
      )
      (grdraw (cadr abc)
	      (list (caadr abc) (cadar abc))
	      2
	      1
      )
      (grdraw (list (caadr abc) (cadar abc))
	      (car abc)
	      2
	      1
      )
      abc
    )
    (princ)
  )
)
;;画包容盒
(defun c:draw_ss_box (/ rect SS)
  (fsxm-maklayer "Divide" 6 "DASHDOT" nil)
  (if (setq ss (ssget))
    (progn
      (setq rect (fsxm-ss-box ss))
      (entmake
	(list
	  '(0 . "LWPOLYLINE")
	  '(100 . "AcDbEntity")
	  '(67 . 0)
	  '(8 . "DIVIDE")
	  '(100 . "AcDbPolyline")
	  '(90 . 4)
	  '(70 . 1)
	  (cons 10 (car rect))
	  (cons 10 (list (caadr rect) (cadar rect)))
	  (cons 10 (cadr rect))
	  (cons 10 (list (caar rect) (cadadr rect)))
	)
      )
      rect
    )
    (princ)
  )
)