;;另类图元隐藏/显示，通过建立组隐藏实体
(defun ea:SSonoff (tf s / gr groups)
  (setvar "cmdecho" 0)
  ;;检测是否有特定组
  (setq	groups (vla-get-groups *doc*)
	gr     (vl-catch-all-apply
		 'vla-item
		 (list groups "ea_hide_object")
	       )
  )
  (if (vl-catch-all-error-p gr)
    (progn
      (setq gr (vla-add groups "ea_hide_object")) ;添加组
      (fsxm-setendxf (vlax-vla-object->ename gr) 71 0) ;不可选择
    )
  )
  (cond	((= tf "HIDEOTHER")		;隔离隐藏用
	 (command ".select" "all" "r" s "")
	 (command ".group" "a" "ea_hide_object" "p" "")
	)
	((= tf "HIDEOBJ")		;隐藏所选
	 (if (> (sslength s) 0)
	   (command ".group" "a" "ea_hide_object" s "")
	 )
	)
  )
  (vla-put-visible gr :vlax-false)	;隐藏组，实体将不拥有 62 组码
  (princ)
)
;;隐藏选择实体
(defun c:Hideobj (/ ss)
  (if (progn (princ "\n选择要隐藏的实体...")
	     (setq ss (ssget))
      )
    (ea:SSonoff "HIDEOBJ" ss)
  )
  (princ)
)
;;隐藏非选择实体
(defun c:ISOobj	(/ ss)
  (if (progn (princ "\n选择隔离实体....")
	     (setq ss (ssget))
      )
    (ea:ssonoff "HIDEOTHER" ss)
  )
  (princ)
)
;;显示全部实体
(defun c:Showall (/ grp *error*)
  (setq *error* list)
  (setq grp (vla-item (vla-get-groups *doc*) "ea_hide_object"))
  (vla-put-visible grp :vlax-true)
  (vla-delete grp)
  (princ)
)
;;飞诗续加：反转隐藏
(defun c:HideSwap (/ all gr groups)
  (setq	groups (vla-get-groups *doc*)
	gr     (vl-catch-all-apply
		 'vla-item
		 (list groups "ea_hide_object")
	       )
  )
  (cond	((vl-catch-all-error-p gr)	;没有组就全隐
	 (if (setq all (ssget "x"))
	   (ea:SSonoff "HIDEOBJ" all)
	 )
	)
	((setq all (ssget "x"))
	 (vlax-for obj gr
	   (ssdel (vlax-vla-object->ename obj) all)
	 )
	 (vl-catch-all-apply 'c:Showall) ;显示全部	 
	 (ea:SSonoff "HIDEOBJ" all)	;显示的全隐
	)
  )
  (princ)
)