Jump to content

Hide namesake block,and Cancel the hidden


liuhaixin88

Recommended Posts

OK! nice! Thank you!

 

Sorry , to avoid running the routine on all Blocks in a drawing , I updated my reply before ( post # 18) , please change it as new and modify your quote with my reply .

 

Thanks

Link to comment
Share on other sites

  • Replies 25
  • Created
  • Last Reply

Top Posters In This Topic

  • liuhaixin88

    12

  • Tharwat

    10

  • steven-g

    2

  • flyfox1047

    1

(defun c:tes1 ( / &doc &ss &cs #si #sn &s2 #i2 #n2 &c2 ) ;;;hide block
 (vl-load-com) (princ "\nSelect Blocks to hide all with the same name")
 (or &doc (setq &doc (vla-get-activedocument (vlax-get-acad-object))))
 (if (setq &ss (ssget "_:L" '((0 . "INSERT"))))
  (repeat (setq #si -1 #sn (sslength &ss))
   (setq &cs (vlax-ename->vla-object (ssname &ss (setq #si (1+ #si)))))
   (setq &s2 (ssget "_X" (list '(0 . "INSERT") (cons 2 (vla-get-name &cs)))))
   (repeat (setq #i2 -1 #n2 (sslength &s2))
    (setq &c2 (vlax-ename->vla-object (ssname &s2 (setq #i2 (1+ #i2)))))
    (vl-catch-all-apply 'vla-put-visible (list &c2 :vlax-false))
   )
  )
 )
 (princ)
)

(defun c:tes2 ( / &doc &ss &cs #si #sn &s2 #i2 #n2 &c2 ) ;;;display block
 (vl-load-com)
 (or &doc (setq &doc (vla-get-activedocument (vlax-get-acad-object))))
 (vlax-for &bl (vla-get-blocks &doc)
  (if (setq &ss (ssget "_X" (list '(0 . "INSERT") (cons 2 (vla-get-name &bl)))))
   (repeat (setq #si -1 #sn (sslength &ss))
    (setq &cs (vlax-ename->vla-object (ssname &ss (setq #si (1+ #si)))))
    (if (= (vla-get-visible &cs) :vlax-false)
     (vl-catch-all-apply 'vla-put-visible (list &cs :vlax-true))
    )
   )
  )
 )
 (princ)
)

Link to comment
Share on other sites

Sorry , to avoid running the routine on all Blocks in a drawing , I updated my reply before ( post # 18) , please change it as new and modify your quote with my reply .

 

Thanks

 

This?

(defun c:hfxs (/ ss)
 (if (setq ss (ssget "x" '((0 . "INSERT")(60 . 1))))
   (vlax-for obj
                 (vla-get-activeselectionset
                   (vla-get-activedocument (vlax-get-acad-object))
                 )
     (vla-put-Visible obj :vlax-true)
   )
 )
 (princ)
)

Link to comment
Share on other sites

(defun c:tes1 ( / &doc &ss &cs #si #sn &s2 #i2 #n2 &c2 ) ;;;hide block
 (vl-load-com) (princ "\nSelect Blocks to hide all with the same name")
 (or &doc (setq &doc (vla-get-activedocument (vlax-get-acad-object))))
 (if (setq &ss (ssget "_:L" '((0 . "INSERT"))))
  (repeat (setq #si -1 #sn (sslength &ss))
   (setq &cs (vlax-ename->vla-object (ssname &ss (setq #si (1+ #si)))))
   (setq &s2 (ssget "_X" (list '(0 . "INSERT") (cons 2 (vla-get-name &cs)))))
   (repeat (setq #i2 -1 #n2 (sslength &s2))
    (setq &c2 (vlax-ename->vla-object (ssname &s2 (setq #i2 (1+ #i2)))))
    (vl-catch-all-apply 'vla-put-visible (list &c2 :vlax-false))
   )
  )
 )
 (princ)
)

(defun c:tes2 ( / &doc &ss &cs #si #sn &s2 #i2 #n2 &c2 ) ;;;display block
 (vl-load-com)
 (or &doc (setq &doc (vla-get-activedocument (vlax-get-acad-object))))
 (vlax-for &bl (vla-get-blocks &doc)
  (if (setq &ss (ssget "_X" (list '(0 . "INSERT") (cons 2 (vla-get-name &bl)))))
   (repeat (setq #si -1 #sn (sslength &ss))
    (setq &cs (vlax-ename->vla-object (ssname &ss (setq #si (1+ #si)))))
    (if (= (vla-get-visible &cs) :vlax-false)
     (vl-catch-all-apply 'vla-put-visible (list &cs :vlax-true))
    )
   )
  )
 )
 (princ)
)

 

Good! so nice! thank you! flyfox1047:D

Link to comment
Share on other sites

  • 3 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...