UV editor, object visibility & ON::active_space


Is there a way to replicate the functionality of the UV editor? (I need to add custom objects to the ‘UV space’.)

Long version:

I have a recurring problem and after digging through the documentation I haven’t found a good solution… yet I know this is possible somehow. Here’s the simplified problem: I have two objects, let’s say a red sphere and a blue sphere. They live in different worlds, so I want to show them in different views. I do not want to show the blue sphere in the red sphere’s view, and vice-versa.

Here’s a screenshot of what I need:

I have seen several posts on this forum with similar problems. The recommended approach always seems to be to use Display Conduits. This is what I used to generate that screenshot. However, this is not good enough. As already pointed out in this post , you can still interact with objects that are not visible in a view. Like so:

I really need to avoid such interactions. I’ve searched OpenNURBS and Rhino’s documentation thoroughly, and here are a few of the promising things I tried, but didn’t work:

  • I tried putting the objects on different layers, and toggling their visibility with ON_Layer::SetPerViewportVisible. Sounds promising, but it is not working at all. Is it true that this only works for CRhinoPageViews?
  • Subclassing the Rhino view - CRhinoView. I could not make it work, but I think this is probably the least safe option. Also CRhinoDoc::CreateRhinoView does not seem to work correctly on Rhino 8, whereas it worked ok on Rhino 7.
  • ON_3dmObjectAttributes::m_space seems to be exactly what I need (different objects in different spaces). I tried setting this attribute for an object, and creating a view with the corresponding ON_3dmView::m_view_type. But this attribute is somehow overwritten and all objects get displayed on all views.

What I ultimately need is to replicate the functionality of the UV editor (which feels like it’s using ON::active_space::uveditor_space, correct?), but I need to add different objects to the ‘UV space’.

I would really appreciate any help to get this to work! Is this in the public API? And if not, could it be made part of it? I’m mainly working on C++, but a RhinoCommon solution would also work, if that’s something it can do. Thanks!

Hi @victorceballos,

Try setting the layer’s model visibility to false.


Does this help?

– Dale

Hi @dale ,
Thank you for your reply.

Indeed, ON_Layer::SetModelVisible followed by CRhinoLayerTable::ModifyLayer can hide a layer from all model views (which is all views atm).

Now I need to create a non-model view. How can I do this? I’m creating new views with
context.m_doc.NewView(ON_3dmView(), true); I have tried:

  • Subclassing ON_3dmView and setting m_view_type = ON::uveditor_view_type;
  • view->ActiveViewport().SetView(My_3dmView());
  • const_cast<ON_3dmView&>(view->ActiveViewport().View()).m_view_type = ON::uveditor_view_type;

None of them work. Any pointers?