Showing/Hiding Objects

Hi all,

It seems that one can show/hide objects only by calling the ObjectTable class from where they belong. Is there an alternative to that?

If not: what should I do if I want to show/hide an object that does not belong to the Rhino.RhinoDoc.ActiveDoc.Objects class?
I considered adding the object to a new ObjectTable but it seems that this class does not have any constructor. Is there no way to instantiate a new ObjectTable? I am kind of stuck here…

Any hint?


rs.HideObject() or rs.ShowObject() ?

Hmmm I am coding in C#. Just realized that this thread is for Python-only. I will move it somewhere else.
Edit: moved to Grasshopper Developer

I’m confused; the document only knows about objects in the object table and therefore will only attempt to draw those objects. Are you creating custom objects?

No I don’t create any custom objects.

From C# Grasshopper, Rhino.RhinoDoc.ActiveDoc.Objects retrieves only the objects which are displayed within the RhinoViewport, dismissing all hidden objects.
So I had to run the ObjectEnumeratorSettings, with the VisibleFilter to false, so I could retrieve all hidden objects. From ObjectEnumeratorSettings, I was only able to retrieve objects as an Array, and not as an ObjectTable.

So far I thought that I had to pass by the ObjectTable class to show/hide any objects.

But I just realized that I can just simply set the object’s Visible property to true, even though the SDK only indicates “get”.

So it’s basically solved. Sorry for the confusion.

Visible is only a “get” property. You change object attributes like visibility by working with the Attributes property on a RhinoObject

obj = ...rhino object from somewhere...;
obj.Attributes.Visible = true;

That’s exactly what I did!
But isn’t that “setting” the attribute?

I thought you were referring to the Visible property that is available directly on the RhinoObject class, not the one on the attributes.

Aaah, I see. I got confused because both are on the same level in the SDK.
Maybe I just don’t know how to read this properly :slight_smile:
Thanks for the explanation.

Look at the Attributes property. This is a separate class which contains a bunch of additional attributes that a RhinoObject could have. The Visible property on RhinoObject is really just a convenience property so you don’t have to type in the extra word Attributes just to see the visibility state. It was probably a mistake on my part to add this since it causes as much confusion as convenience.

1 Like

Ok, everything becomes much clearer now. thanks again!