看到有人要部分显示物体,部分隐藏物体,全部显示的程序,现发一个,不知对大家有没有用。收集于明经一大侠,名字记不得了,取之于明,用之于民。- *************************************************************************
- ;;; 命令: VB, VQ
- ;;; 功能: VB 部分隐藏选中的物体,VQ 全部显示所有物休。
- ;;; 备注: 放样时用得较多
- *************************************************************************
- ;;快速隐藏物体
- (vl-load-com)
- ;对象显示与隐藏
- (defun obj_onf (ss mode)
- (if (= (type ss) 'PICKSET)
- (vlax-for OBJ (vla-get-activeselectionset
- (vla-get-activedocument (vlax-get-acad-object))
- )
- (if (/=(vla-get-visible OBJ) mode) (vla-put-visible OBJ mode))
- )
- )
- )
- ;图层显示与隐藏
- (defun lay_onf (LayName mode)
- (if (= (type LayName) 'STR)
- (vlax-for lay (vla-get-layers
- (vla-get-activedocument (vlax-get-acad-object))
- )
- (if (eq (strcase (vla-get-name lay)) (strcase LayName))
- (if(/=(vla-get-layeron lay) mode)
- (vla-put-layeron lay mode)
- )
- )
- )
- )
- )
- ;;;把选择集的物体转化为Lisp 图元表
- (defun S2L:ENT (ss / i l objs)
- (setq i -1 l (sslength ss) objs nil)
- (repeat l
- (setq objs (cons (ssname ss (setq i (1+ i))) objs))
- )
- )
- ;;;把选择集的物体转化为VLisp 图元表
- (defun S2V:ENT (ss / i l objs)
- (setq i -1 l (sslength ss) objs nil)
- (repeat l
- (setq objs (cons (vlax-ename->vla-object (ssname ss (setq i (1+ i)))) objs))
- )
- )
- ;__
- ;;全部显示
- (defun C:VQ (/ OBJ lay)
- (princ "【全部显示】")
- (obj_onf (ssget "x") :vlax-true)
- (vlax-for lay (vla-get-layers
- (vla-get-activedocument (vlax-get-acad-object))
- )
- (if (/= (vla-get-layeron lay) :vlax-true)
- (vla-put-layeron lay :vlax-true)
- )
- )
- (princ)
- )
- ;;部分隐藏
- (defun C:VB (/ OBJ)
- (princ "【部分隐藏】")
- (obj_onf (ssget) :vlax-false)
- (princ)
- )
- ;;部分显示
- (defun C:vw (/ S2L:ENT ss ssent )
- (princ "【部分显示】")
- (setq ss (ssget "x")
- ssent (ssget)
- ssent (S2L:ENT ssent)
- )
- (foreach s ssent (setq ss (ssdel s ss)))
- (setq ss (mapcar 'vlax-ename->vla-object (S2L:ENT ss)))
- (foreach s ss (vla-put-visible s :vlax-false))
- (princ)
- )
|