;;另类图元隐藏/显示，通过建立组隐藏实体
;|
visible

object.Visible 

object
      All Drawing objects, Application, AttributeReference, Group, Toolbar
      The object or objects this property applies to. 

Boolean; read-write (write-only for the Group object) 
TRUE:    The object or application is visible. 
FALSE:   The object or application is not visible.

Remarks 
If you specify an object to be invisible, it will be invisible regardless of
the application visible setting. Other factors can also cause an object to be
invisible; for example, an objectwill not be displayed if its layer is off or
frozen. 
Specifying the application to be invisible allows you to run tasks in the
background without having to see the component. 
Specifies the visibility of an object or the application.
All Drawing objects, Application, AttributeReference, Group, Toolbar
|;
(defun ea:SSonoff (tf s mode / groups gl)
  (setvar "cmdecho" 0)
  ;;检测是否有特定组
  (if (vl-catch-all-error-p
	(vl-catch-all-apply
	  'vla-item
	  (list
	    (setq
	      groups
	       (vla-get-groups
		 (vla-get-activedocument (vlax-get-acad-object))
	       )
	    )
	    "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)
  (setvar "pickstyle" 0)
  (if (not (vl-catch-all-error-p
	     (vl-catch-all-apply
	       'vla-item
	       (list
		 (setq
		   groups
		    (vla-get-groups
		      (vla-get-activedocument (vlax-get-acad-object))
		    )
		 )
		 "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.")