Silly DisplayConduit Question

Hello,

In the snip I have a box (black edges) that is in the rhino scene and a brep that is in a custom display conduit and does not exist in the rhino scene.

I am using the Technical Display Mode and would like my conduit object to get the edges to match the brep that is in the scene/3d space.

-Do I specifically need to draw the brep wires and add those curves/edges to my conduit?

-Is it a display mode setting I need to change? Nothing worked when I tried this…

-Display attribute setting needed?

My attributes:

        @staticmethod
        def Geometry():
            attr = Display.PreviewAttributes()
            attr.CurveColor = System.Drawing.Color.Black  #Utils.ParseHexColor(UI.drawing_colors.get("new"), 255)
            attr.CurveThickness = 2
            attr.ObjectColor = System.Drawing.Color.White  #Utils.ParseHexColor(UI.drawing_colors.get("new"), 200)
            attr.ColorSource = Rhino.DocObjects.ObjectColorSource.ColorFromObject
            attr.TextColor = Color.White
            attr.CustomGroundPlaneShadowOnly = True
            # attr.ClippingEdgeColor = Color.Magenta
            # attr.ClippingEdgeThickness = 10

            attr.Material.Diffuse = Color.WhiteSmoke
            attr.Material.Transparency = 0.0

            # attr.CullBackfaces = True
            # attr.CastShadows = True
            # attr.AmbientLightingColor = System.Drawing.Color.Red
            # attr.IgnoreHighlights = True
            return attr

my PostDrawObjects:

        def PostDrawObjects(self, e):
            try:
                # print(f"Model DrawForeground: self._objects: {self._objects}")
                """Draw objects with either standard shading or custom shader."""
                # Ensure the event corresponds to the intended viewport
                if self._target_viewport_id and e.Viewport.Id != self._target_viewport_id:
                    return  # Skip drawing in other viewports

                utils = Utils()

                e.Display.DisplayPipelineAttributes.ShadowsOn = True
                e.Display.EnableDepthTesting(True)  # Disable Depth Testing so that the next elements that get drawn to through everything
                # e.Display.EnableClippingPlanes(True)  # This doesn't seem to do anything? Perhaps only works on init?
                # e.Display.AddClippingPlane(Rhino.Geometry.Point3d(0, 0, 4.5), -Rhino.Geometry.Vector3d.ZAxis)  # Add clipping plane to conduit

                self._exploded_geometries.clear()

                all_meshes = []  # Create a list to store all the render meshes in for this drawforeground method

                for obj, attr in self._objects.items():
                    # print(f"self._objects: obj: {obj}, attr: {attr}")
                    color = attr.CurveColor
                    material = attr.Material
                    mat_color = attr.ObjectColor
                    if attr.ColorSource == Rhino.DocObjects.ObjectColorSource.ColorFromLayer:
                        layer = scriptcontext.doc.Layers[attr.LayerIndex]
                        color = layer.Color

                    if isinstance(obj, Rhino.Geometry.Brep):
                        print("post draw brep")
                        e.Display.DrawBrepShaded(obj, material)
                        e.Display.DrawBrepWires(obj, attr.CurveColor, -1)

This successfully draws my objects with shadows or not depending on which display mode I have of course.. but I cannot seem to get the brep edge wires to show up…

Thanks for your help!

Alright, I got the surface edges to show up by editing the .ini file for the display mode and setting this boolean flag here:

[DisplayMode\5665a144-09fc-4fe8-99c9-9c6fcc606902\Objects\Surfaces]

ShowEdges=y

@scottd and @dale am I completely missing it or is this not available as a setting within the Technical Display Mode settings UI via Document Properties? I see it in other display modes like Rendered

Thanks for the help!

Hi @michaelvollrath,

Does DisplayPipelineAttributes.ShowSurfaceEdges work for you?

– Dale

1 Like

Hi @dale, it does work for other display modes such as a display mode I use that was duplicated from the Rendered display mode but for Technical that setting does not seem to show the edges with my conduit objects.

Here’s my updated attributes and none of these are having the effect of showing the Technical DM surface edges.

        @staticmethod
        def Geometry():
            attr = Display.PreviewAttributes()
            attr.CurveColor = System.Drawing.Color.FromArgb(105, 105, 105, 255)  # Medium Grey #System.Drawing.Color.Black  #Utils.ParseHexColor(UI.drawing_colors.get("new"), 255)
            attr.CurveThickness = 1
            attr.ObjectColor = System.Drawing.Color.White  #Utils.ParseHexColor(UI.drawing_colors.get("new"), 200)
            attr.ColorSource = Rhino.DocObjects.ObjectColorSource.ColorFromObject
            attr.TextColor = Color.White
            attr.CustomGroundPlaneShadowOnly = True
            
            """Properties for surface edges and section cut fills/colors"""
            attr.ShowClippingFills = True
            attr.ClippingPlaneFillColorUse = Rhino.Display.DisplayPipelineAttributes.ClippingPlaneFillColorUse.SolidColor
            attr.ClippingFillColor = Color.Blue
            attr.ClippingEdgeColor = Color.Magenta
            attr.ClippingEdgeThickness = 10

            attr.Material.Diffuse = Color.WhiteSmoke
            attr.Material.Transparency = 0.0

            attr.CullBackfaces = True

            attr.ShowSurfaceEdge = True
            attr.ShowSurfaceEdges = True

            attr.SurfaceEdgeThickness = 1
            attr.SurfaceEdgeThickness = 1.0
            attr.SurfaceEdgeColor = System.Drawing.Color.FromArgb(105, 105, 105, 255)  # Medium Grey

            # attr.CastShadows = True
            # attr.AmbientLightingColor = System.Drawing.Color.Red
            # attr.IgnoreHighlights = True
            return attr

Oddly, I see two methods for ShowSurfaceEdge singular and ShowSurfaceEdges plural in the API docs, is that intentional? I have both set to true in my attributes.

image

https://developer.rhino3d.com/api/rhinocommon/rhino.display.displaypipelineattributes/showsurfaceedge

Thanks for the help!