How do I color brep edges?

I’m trying to create functionality similar to the “Show Edges” command, but I cant figure out how color brep edges. Brep faces are simple enough to color, but brep edges dont seem to have the same interface. Can someone please point me in the correct direction?

Hi @Nick_Drian,

Create a DisplayConduit inherited class. And it the PostDrawObjects override draw the (edge) curves in whatever color you want.

– Dale

1 Like

You’re the man Dale!

@dale I did as you said, and overwrote calculate bounding box, and disabled depth testing, but Im still not seeing anything. Am I missing something?

    internal class DisplayEdge : DisplayConduit {
        public Guid m_BrepId { get; }
        public BrepEdge m_Edge { get; set; }
        public System.Drawing.Color m_Color { get; set; }

        public DisplayEdge(BrepEdge edge, Guid id, System.Drawing.Color color)
        {
            m_Edge = edge;
            m_BrepId = id;
            m_Color = color;
        }

        protected override void PostDrawObjects(DrawEventArgs e) {
            e.Display.PushDepthTesting(false);
            e.Display.DrawCurve(m_Edge, m_Color);
            e.Display.PopDepthTesting();
        }

        protected override void CalculateBoundingBox(CalculateBoundingBoxEventArgs e)
        {
            base.CalculateBoundingBox(e);
            e.IncludeBoundingBox(m_Edge.GetBoundingBox(true));
        }
    }

I figured it out, I just had to put Enabled = true in the constructor. Thanks for the help Dale.