Show Edges of clipped Objects in custom Display


I am using custom display pipeline and would like to draw edges for clipping plane objects under DrawViewportWires. What is the way to do it?


private void RunScript(Guid id, ref object A)
  var cp = new Rhino.DocObjects.ObjRef(id);
  var brep = cp.ClippingPlaneSurface().ToBrep();
  _bbox = brep.GetBoundingBox(false);
  _edges = new List<Line>();
  foreach(var edge in brep.Edges)
    Line line = new Line();
    GH_Convert.ToLine(edge, ref line, GH_Conversion.Both).ToString();
// <Custom additional code> 
List<Line> _edges;
BoundingBox _bbox;
public override BoundingBox ClippingBox { get {return _bbox; } }
public override void DrawViewportWires(IGH_PreviewArgs args)
  args.Display.DrawLines(_edges, Color.Blue, 5);
// <Custom additional code> (3.6 KB)

Thank you @Mahdiyar

I have probably formulated my question wrongly.
I meant draw edges of the objects clipped with the Clipping Plane, not edges of the clipping plane itself. See below:

For existing objects in Rhino, similar edges could be shown by activating Checkbox in properties.

Any suggestion, guys? Maybe @stevebaer
One possible solution will be to create intersections with clipping plane and draw them but maybe there is already a way to do it?


Hey Dmitriy,
You would need to compute the intersections and draw them yourself. This is essentially what we do in the core display code along with some smart caching to figure out when new intersections need to be computed. That functionality isn’t provided in our SDK at the moment and it would be a pretty big project to add this.

Got it. Thx.