DisplayConduit - Capped Breps Appear "Collapsed"

If I loft 3 curves and then cap the loft, I get this strange shading issue where part of the brep appears to collapse in on itself. Not all shapes have this problem. It goes away if I scale the middle curve a bit. And it doesn’t happen if I don’t cap the object.

Below are a rhino file and a sample python script. The script will need the rhino file as it contains a shape (curve) that demonstrates the issue.

chamfered_rectangle.3dm (48.0 KB)
shading problem.py (2.1 KB)

When the process of lofting and capping this shape in grasshopper, no such issue occurs.
lofted brep.gh (9.7 KB)

Any help in solving this “collapse” issue would be greatly appreciated.

Okay, it seems one solution is to draw the faces individually (you actually have to use DuplicateFace or you get untrimmed faces).

    # override PostDrawObjects
    def PostDrawObjects(self, e):
        e.Display.DrawCurve(self.obj[0], self.CurveColor, 3)
        e.Display.DrawCurve(self.obj[1], self.CurveColor, 3)
        e.Display.DrawCurve(self.obj[2], self.CurveColor, 3)
        # DON'T DO THIS: e.Display.DrawBrepShaded(self.obj[3], self.ShinyMaterial) 
        # DO THIS INSTEAD...
        for face in self.obj[3].Faces:
            face_dup = face.DuplicateFace(False)
            e.Display.DrawBrepShaded(face_dup, self.ShinyMaterial) 

Is there a better way?

In Rhino you would run DivideAlongCreases>SplitAtTangents to fix the meshing problem. In RhinoCommon I think you should run BrepFaceList.SplitFacesAtTangents() on your Brep.

https://developer.rhino3d.com/api/rhinocommon/rhino.geometry.collections.brepfacelist/splitfacesattangents

or actuallyBrepFaceList.SplitKinkyFaces () - I see the original corners are chamfers, not radii.

https://developer.rhino3d.com/api/rhinocommon/rhino.geometry.collections.brepfacelist/splitkinkyfaces

Thanks @Helvetosaur.

Not only did that fix it, it also solved a shading problem introduced by my first solution.

You can see the final result here.

The corrected script:
shading problem fixed.py (2.0 KB)