Jump to content

Organize into groups with "Hide" and "display" code


liuhaixin88

Recommended Posts

HI,guys,I need some help! TKS

 

This code is hide object

(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)
)

 

This code is display object

(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)
)

 

Now ,I want use command "yca" hide some object to Group A, use command "ycb" to hide some object to Group B,use command "ycc"hide some object to Group C ,

 

Use command "hfxsa" to display GroupA ,use command "hfxsb" to display GroupB ,use command "hfxsc" to display GroupC

Link to comment
Share on other sites

For hiding the groups, the code is easy to build:

(defun c:YCA()
(command "_HIDEOBJECTS" "_G" "GroupA" "")
(princ)
)

For setting them back visible will require a more elaborate code since the group isn't an entity, but rather a dictionary entry so its items will need to be parsed.

Link to comment
Share on other sites

Msasu time to pick your brain a bit-

what do you mean by "parsed"? I know it's a coding terminology likely similar to "processed" but was hoping for your own explanation, in your own terms.

Thanks!

Link to comment
Share on other sites

Msasu time to pick your brain a bit-

what do you mean by "parsed"? I know it's a coding terminology likely similar to "processed" but was hoping for your own explanation, in your own terms.

Thanks!

Not being a native English speaker, I may miss sometime the full meaning of certain English words and, especially, expressions. But I'm quite sure that "to parse" is commonly used in programming environment and I'm not aware of it having an inappropriate sense along. That being said, I'm really not sure why my brain needs to "be picked"?!?

 

But to satisfy you:

To parse a collection = to navigate between its items in a given order; to iterate.

Link to comment
Share on other sites

Hah!

From a native English speaker, me, to you:

to "pick ones brain" is a common expression meaning "to learn from another , usually from a selection or series of questions"

I surely was not trying to be a smarty-pants, was just trying to learn a thing or two from you.

Parsed=iterate, that makes sense, and satisfies my query. I was under the thinking that it was different than iterate, hence my question, but your answer satisfies quite well.

Thank you!

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