Jump to content

Hide namesake block,and Cancel the hidden


liuhaixin88

Recommended Posts

Thanks to everyone.

I want use a command to hide namesake block ,and use a command to show it.

Thank for help me!

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

Thanks to everyone.

I want use a command to hide namesake block ,and use a command to show it.

Thank for help me!

 

:cry:Give a reply, ok?

Link to comment
Share on other sites

What do you mean by hide with a command, I should say how do you see it working, the command 'hideobjects' will let you pick one or several objects to be hidden (unhide brings them all back), another method would be put objects on their own layer, and turn the layer on/off possibly with the use of a macro. It all depends on what you are doing.

Link to comment
Share on other sites

What do you mean by hide with a command, I should say how do you see it working, the command 'hideobjects' will let you pick one or several objects to be hidden (unhide brings them all back), another method would be put objects on their own layer, and turn the layer on/off possibly with the use of a macro. It all depends on what you are doing.

 

steven,thanks for your reply!

hideobjects I know:

;;hideobjects
(defun c:yc ()
 (if (ssget)
   (progn
     (vlax-for        obj
                   (vla-get-activeselectionset
                     (vla-get-activedocument (vlax-get-acad-object))
                   )
       (vla-put-Visible obj :vlax-false)
     )
   )
 )
 (princ)
)

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

 

but I want hide a block, the same name of the block all hide.

Link to comment
Share on other sites

What is the name of the block(s) that you want to include within that routine ?

Are they Dynamic blocks or Normal ?

Are they Attributed ?

 

Hi, Tharwat,Glad to meet you! Why do you change the Profile Picture ?

 

1. The name of the block is uncertain, You must select a block by mouse.

2. Both

3. Both

Link to comment
Share on other sites

Hi, Tharwat,Glad to meet you!

 

Thanks me too :)

 

Why do you change the Profile Picture ?

 

Did not you like it ? I could change it if so .

 

Try the following routine and let me know about the result .

 

(defun c:test (/ s sel nm lst ss)
 ;;    Tharwat 26.Mar.2014        ;;
 ;; Hide Block name by Selection    ;;
 (or doc (setq doc (vla-get-activedocument (vlax-get-acad-object))))
 (princ "\n Select Blocks to hide all with the same name ...")
 (if (setq s (ssget "_:L" '((0 . "INSERT"))))
   (progn (vlax-for x (setq sel (vla-get-activeselectionset doc))
            (if (not (member (setq nm (vla-get-effectivename x)) lst))
              (setq lst (cons nm lst))
            )
          )
          (vla-delete sel)
          (if (setq ss (ssget "_X"
                              (list '(0 . "INSERT")
                                    (cons 410 (getvar 'CTAB))
                                    (cons 2 (strcat "`*U*," (apply 'strcat (mapcar '(lambda (u) (strcat u ",")) lst))))
                              )
                       )
              )
            (progn (vlax-for x (setq sel (vla-get-activeselectionset doc))
                     (if (member (setq nm (vla-get-effectivename x)) lst)
                       (vl-catch-all-apply 'vla-put-visible (list x :vlax-false))
                     )
                   )
            )
            (vla-delete sel)
          )
   )
 )
 (princ)
)
(vl-load-com)

Link to comment
Share on other sites

Thanks me too :)

Did not you like it ? I could change it if so .

 

Try the following routine and let me know about the result .

 

 

ha!ha! I like the previous.

 

This code very nice! perfect!:beer: but how to display it?

Link to comment
Share on other sites

You already have one in your previous code .

 

This?

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

 

It's not that, this will display all the objects. I just want display the block.

Link to comment
Share on other sites

It's not that, this will display all the objects. I just want display the block.

 

So how would the routine know what are the blocks or objects that you have used before to redisplay them back unless you have them in a list to put on and off ?

Link to comment
Share on other sites

So how would the routine know what are the blocks or objects that you have used before to redisplay them back unless you have them in a list to put on and off ?

 

Dear Tharwat,

Mean there is no way ?

Link to comment
Share on other sites

Dear Tharwat,

Mean there is no way ?

 

I did not mean that , let me make easy to read .

 

Suppose that you run my routine and selected a few specific blocks , let 's say "a" "b" "c" and you closed the drawing .

 

Then you opened the drawing and wanted to reshow these specific blocks back , how would the code know what are the name of blocks that you have hide them before you close the drawing ?

 

But if you have a specific name of block to hide and show , you can write these names in a list inside the routine and that would give the chance to notify the block names to show and hide all along .

Link to comment
Share on other sites

 

Then you opened the drawing and wanted to reshow these specific blocks back , how would the code know what are the name of blocks that you have hide them before you close the drawing ?

 

 

I mean: Show all hide block.

Link to comment
Share on other sites

I mean: Show all hide block.

 

So add the dxf code in your routine as the following .

 

(0 . "INSERT")(60 . 1)

Edited by Tharwat
Link to comment
Share on other sites

So add the dxf code in your routine as the following .

 

 

OK! nice! Thank you!

Edited by liuhaixin88
Link to comment
Share on other sites

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...