;;另类图元隐藏/显示，通过建立组隐藏实体
(defun ea:SSonoff (tf s mode / groups gl gr)
  (setvar "cmdecho" 0)
  ;;检测是否有特定组
  (if (vl-catch-all-error-p
	(vl-catch-all-apply
	  'vla-item
	  (list
	    (setq groups (vla-get-groups *doc*))
	    "ea_hide_object"
	  )
	)
      )
    (progn
      (setq gr (vla-add groups "ea_hide_object")) ;添加组
      (setq gl (entget (vlax-vla-object->ename gr)))
      (entmod (subst '(71 . 0) (assoc 71 gl) gl)) ;不可选择
    )					;end progn
  )					;end if
  (if (not tf)
    (progn
      (command ".select" "all" "r" s "")
      (command ".group" "a" "ea_hide_object" "p" "")
    )					;隔离隐藏用
    (command ".group" "a" "ea_hide_object" s "")
  )
  (vla-put-visible
    (vla-item groups "ea_hide_object")
    mode
  )					;隐藏组，实体将不拥有 62 组码
  (princ)
)
;;隐藏选择实体
(defun c:Hideobj (/ ss)
  (if (progn (princ "\n选择要隐藏的实体...")
	     (setq ss (ssget))
      )
    (ea:SSonoff t ss :vlax-false)
  )
  (princ)
)
;;显示全部实体
(defun c:Showall (/ ss GROUPS)
  (setvar "pickstyle" 0)
  (or (vl-catch-all-error-p
	(vl-catch-all-apply
	  'vla-item
	  (list
	    (setq groups (vla-get-groups *doc*))
	    "ea_hide_object"
	  )
	)
      )
      (progn
	(vla-put-visible
	  (vla-item groups "ea_hide_object")
	  :vlax-true
	)
	(command ".group" "e" "ea_hide_object") ;清除组
      )
  )
  (princ)
)
;;隐藏非选择实体
(defun c:ISOobj	(/ ss)
  (if (progn (princ "\n选择隔离实体....")
	     (setq ss (ssget))
      )
    (ea:ssonoff nil ss :vlax-false)
  )
  (princ)
)
(princ "\n\t命令: HideObj ShowAll IsoObj.")