liuhaixin88 Posted March 24, 2014 Share Posted March 24, 2014 Thanks to everyone. I want use a command to hide namesake block ,and use a command to show it. Thank for help me! Quote Link to comment Share on other sites More sharing options...
liuhaixin88 Posted March 25, 2014 Author Share Posted March 25, 2014 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? Quote Link to comment Share on other sites More sharing options...
steven-g Posted March 25, 2014 Share Posted March 25, 2014 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. Quote Link to comment Share on other sites More sharing options...
liuhaixin88 Posted March 25, 2014 Author Share Posted March 25, 2014 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. Quote Link to comment Share on other sites More sharing options...
Tharwat Posted March 25, 2014 Share Posted March 25, 2014 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 ? Quote Link to comment Share on other sites More sharing options...
steven-g Posted March 25, 2014 Share Posted March 25, 2014 Maybe something based on 'selectsimilar' Quote Link to comment Share on other sites More sharing options...
liuhaixin88 Posted March 26, 2014 Author Share Posted March 26, 2014 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 Quote Link to comment Share on other sites More sharing options...
Tharwat Posted March 26, 2014 Share Posted March 26, 2014 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) Quote Link to comment Share on other sites More sharing options...
liuhaixin88 Posted March 26, 2014 Author Share Posted March 26, 2014 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! but how to display it? Quote Link to comment Share on other sites More sharing options...
Tharwat Posted March 26, 2014 Share Posted March 26, 2014 ha!ha! I like the previous. This code very nice! perfect Excellent , happy to hear but how to display it? Huh ? Quote Link to comment Share on other sites More sharing options...
liuhaixin88 Posted March 26, 2014 Author Share Posted March 26, 2014 Excellent , happy to hear Huh ? After the hidden, how to display? Quote Link to comment Share on other sites More sharing options...
Tharwat Posted March 26, 2014 Share Posted March 26, 2014 You already have one in your previous code . Quote Link to comment Share on other sites More sharing options...
liuhaixin88 Posted March 26, 2014 Author Share Posted March 26, 2014 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. Quote Link to comment Share on other sites More sharing options...
Tharwat Posted March 26, 2014 Share Posted March 26, 2014 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 ? Quote Link to comment Share on other sites More sharing options...
liuhaixin88 Posted March 26, 2014 Author Share Posted March 26, 2014 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 ? Quote Link to comment Share on other sites More sharing options...
Tharwat Posted March 27, 2014 Share Posted March 27, 2014 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 . Quote Link to comment Share on other sites More sharing options...
liuhaixin88 Posted March 27, 2014 Author Share Posted March 27, 2014 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. Quote Link to comment Share on other sites More sharing options...
Tharwat Posted March 27, 2014 Share Posted March 27, 2014 (edited) I mean: Show all hide block. So add the dxf code in your routine as the following . (0 . "INSERT")(60 . 1) Edited March 27, 2014 by Tharwat Quote Link to comment Share on other sites More sharing options...
liuhaixin88 Posted March 27, 2014 Author Share Posted March 27, 2014 (edited) So add the dxf code in your routine as the following . OK! nice! Thank you! Edited March 27, 2014 by liuhaixin88 Quote Link to comment Share on other sites More sharing options...
Tharwat Posted March 27, 2014 Share Posted March 27, 2014 OK! nice! Thank you! You're welcome any time . Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.