Can I add a truly hidden object to the document?

Is it possible to add an object to the document that is not visible even if you unhide all objects, but it has its own guid and can be invoked, truly unhidden?

Not selectable with _SellAll unless it is selected by guid.

@ivelin.peychev - sorry, no.

– Dale

1 Like

Thanks @dale.

Bummer, but fair enough.

@dale,

How are Grasshopper objects displayed in Rhino when they are not added to the document?

Can I use a similar method?

@DavidRutten?

I think you want to look at display conduits for that. But maybe this is a case of the X Y problem?

1 Like

What problem are you trying to solve using a truly hidden object?
What type of object do you want to add?

Any type. If I want to create a line I want the two points this line is created of to be truly hidden and invoked when I need to change them.

Thanks for suggesting this @S_L, I guess it’s about time to learn to use this.

I too would go with @S_L s suggestion.
Create a display conduit store it in the sticky and give it your own objectTable property.
Oh and good luck i did not have much success with display conduits in python, they tend to crash rhino if you make mistakes :frowning:

:smiley: I crash Rhino almost every time I try something new so…

Like @S_L said, use a display conduit if you want to draw geometry which is ‘invisible’ to Rhino. Cannot be selected, cannot be snapped to, will not be saved as part of the 3dm file. You can draw pretty much whatever you want and even make it viewport dependent.

If you are doing this from within a Grasshopper document or component, there’s some handy apis available that will do most of the heavy lifting. If you’re doing this in a custom plug-in, then you have to start from scratch.

1 Like

I would have to do this from scratch :woozy_face:

Even scratch isn’t that hard in RhinoCommon. You’ll have to handle the following events when your plug-in becomes active:

DisplayPipeline.CalculateBoundingBox
DisplayPipeline.PostDrawObjects

Within your bounding box event handler you must return a bounding box which is big enough to contain all the geometry you wish to draw, but ideally no bigger. If you don’t get this right your previews might get clipped.

PostDrawObjects is a good place to draw your own previews, this pipeline channel happens after Rhino draws all document objects.

1 Like

I saw this article:

But without the using declarations I do not fully understand it.

where is base. coming from?

Hopefully using python will not lead me to an impasse, like with docked panels.

Whoa that’s an ancient article. I don’t think it’s still even possible to do it that way. Just handle the static events on DisplayPipeline and you’re off.

Edit: I see Dale fixed it up in 2018, so it’s probably still correct. Back when I wrote that you had to create a conduit class and override some of the methods. These days RhinoCommon uses static events you can handle.

1 Like

It’s still the way to do it. Following this article will get you there.

If you don’t actually ever want to display it, why would you want to use a display conduit (the sole purpose of which is displaying geometry)? what are you actually doing with this “virtual object”? If you just pass around Rhino.Geometry types, they will not be added to the document, but you can still do things with them (transform them, query them, etc).

I want to store it for future reference/edition without adding it to the document.

I’ll take the example from above. I have a line created by two virtual points.
I want when this line is dragged/moved the values of the virtual points to be updated.

Also, invoking these virtual points so I can change their locations -> respectively triggering Line change.

I do not know if conduit is the proper way. There are still too many questions that need answers.

  • Can I turn a conduit on and off? Done!
  • Where do the objects in the conduit go?
  • Can I extract information (properties) from the object inside the conduit? Done!
  • Can I have more than one object in a conduit?
  • (Update) When GH displays objects Rhino is not locked. While when displaying a conduit directly in Rhino through Python. The cursor changes and I can’t do anything but rotate. How to avoid this?

If it is not a conduit:

  • What are other ways to store virtual objects inside the document that are not really objects inside the document? :crazy_face:
  • Do I use Document Dictionary? Does that even exist?
  • Do I store them by:
    – pickling?
    – xml?
    – json?

Well don’t know if it won’t lead to instant crashes or memory leaks but you always could try to emit instace of desired class with private constructor via reflection :shushing_face:

1 Like

Interesting :stuck_out_tongue_winking_eye:
Do I get your idea properly? Get the parent by extracting it from the existing object and then recreating it?
But how do I convince the existing object this is its parent?
UPDATE: perhaps storing the guid and then assigning it to the new object. :nerd_face:

I already crashed Rhino 20 times before I managed to create a point conduit. No worries there. :crazy_face: