Zebra Stripes in Grasshopper with C#


I’m trying to make a quick C# component that does a Zebra Stripes preview of a brep. Nothing I do with DisplayPipeline or DrawZebraPreview works at all. Surely it should be something like:

Rhino.Display.DisplayPipeline.DrawZebraPreview(brep, Color.White);

Any help gratefully received!

you can do it with a display conduit.
the following should get you started.
but only started - no clean up - and you might end up with multiple conduits running …
really - just a fast and dirty starting point:

// Grasshopper Script Instance
#region Usings
using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Drawing;

using Rhino;
using Rhino.Geometry;
using Rhino.Display;

using Grasshopper;
using Grasshopper.Kernel;
using Grasshopper.Kernel.Data;
using Grasshopper.Kernel.Types;

public class Script_Instance : GH_ScriptInstance
    #region Notes
        RhinoDoc RhinoDocument
        GH_Document GrasshopperDocument
        IGH_Component Component
        int Iteration

      Methods (Virtual & overridable):
        Print(string text)
        Print(string format, params object[] args)
        Reflect(object obj)
        Reflect(object obj, string method_name)
    private ZebraConduit myZebra;
    private void RunScript(Brep brep, bool enable, ref object a)
        if (myZebra == null)
            myZebra = new ZebraConduit();
        myZebra.Brep = brep;
        myZebra.Enabled = enable;
        // Write your logic here
        a = null;

public class ZebraConduit : Rhino.Display.DisplayConduit
    private Brep _brep;
    private BoundingBox _bbox;

    public Brep Brep 
        set {
            _brep = value;
            _bbox = _brep.GetBoundingBox(true);
  protected override void CalculateBoundingBox(CalculateBoundingBoxEventArgs e)
  protected override void PreDrawObjects(DrawEventArgs e)
    e.Display.DrawZebraPreview(_brep, Color.White);;

@Ashley_Cichocki here is the file
ZebraConduit_00.gh (10.3 KB)

more infos here:


Wow Tom, that’s great! Thanks for the link too, this opens a whole new avenue of Rhino I had no idea we could access.

How would I know if I had multiple conduits running? I’m guess when you disable the component, it no longer effects the conduit… or is that another naive thing to say?

(Edit) Sometimes it doesn’t turn off, I guess that’s how I’d know.