Disable Rhino Display Conduit In Specific Viewport?

Hello :waving_hand:,

I have a custom display conduit I use for previewing objects in special ways where I have more stylistic control over how to display each Rhino Object type.

This is all working great but because there is already the default Rhino display conduit active in the viewport scene, I do get some overlap particularly on selection events where Rhino shows the default “yellow selection” and my conduit, for simplicity of this question, wants to show “purple”.

Obviously I could change the selection color in the Rhino Document Properties but again, I’m doing more nuanced graphics to my conduit then just changing the color.

So, my question is, since I know I’m in a different viewport, how can I disable or completely override the “default” Rhino display conduit?

Here you can see the “Violet” color applied to an object on selection but the default Rhino yellow selection is ALSO showing at the same time. I want to only show the Violet and handle all the conduit attributes myself.

Here’s an example of my PreviewAttributes for my conduit:

class Display():

    conduit = None  # Instantiate the conduit variable
    conduits = {}

    class PreviewAttributes:
        def __init__(self):
            self.ObjectColor = Color.Black
            self.ColorSource = Rhino.DocObjects.ObjectColorSource.ColorFromObject
            self.WireDensity = 1
            self.LayerIndex = -1
            self.CurveThickness = 10
            self.PointStyle = Rhino.Display.PointStyle.ControlPoint
            self.PointPixels = 3
            self.TextColor = Color.White

        @staticmethod
        def Selected():
            attr = Display.PreviewAttributes()
            attr.CurveColor = Color.Violet  # Default is Color.Yellow and I want to only see this version of selected and not the default Rhino selected yellow in addition
            attr.ObjectColor = Color.Violet
            attr.ColorSource = Rhino.DocObjects.ObjectColorSource.ColorFromObject
            attr.TextColor = Color.Black
            return attr

Thank you for your help!!

Hi @michaelvollrath,

to prevent that Rhino draws something in the viewport where you already draw with your own conduit you can use ObjectCulling which is called for all objects in all viewports. So in your drawing event, you check that you’re in the desired viewport and draw your object, the same you can do in the ObjectCulling event to prevent that Rhino draws something:

def ObjectCulling(self, e):
    if self.MyObjectIdToHide is not None:
        if e.RhinoObject.Id == self.MyObjectIdToHide:
            e.CullObject = True

Above will hide an object in all viewports so you can draw it in your own conduit. You might do additional filtering based on the viewport id or name. Does this help ?

_
c.

3 Likes

You’re the best, thank you as always @clement,

I’m doing exactly what you suggested where I only draw my special conduit in my viewport only but wasn’t sure how to block rhino’s conduit from drawing in the viewport as well so this makes total sense.

Much appreciated!

1 Like