Draw something over all the layers


I need to draw in the Rhino document three arrows in order to let the user to see a custom reference system, beyond the Rhino default one.

How can I draw something, always visible and not clickable neither modifiable?

I though to draw the three arrows in a layer, and then lock it. But I don’t want to see such layer into the layers manager tool. I need to hide the existence of this layer but, at the same time, let the user to see the layer content, always.

I also look for a method to draw something outside any layer, as for the Rhino reference system or the Rhino grid but I did not find any solution.

Do you have any suggestion? I am open to each solution let me to draw something always visible and then keep it out from the user control.

Thank you!

Hi @margari,

You can use a CRhinoDisplayConduit to draw geometry and text that does not exist in the Rhino document. The Rhino SDK samples have a number of conduit samples that you can review.

Let me know if you can’t find what you need.


– Dale

Hi @dale,

thank you, CRhinoDisplayConduit seems to be perfect for my purpose.
I tried to implement an example, following some samples you linked me but I have two main problems now.

  1. I can’t see my geometry when I am in the ray-tracing mode.
    I suppose that CrhinoDisplayPipeline::DrawShadedBreps function it not enought for that but I don’t know what to do.

  2. I can’t see the whole geometry in wireframe, shaded, ghosted and x-ray mode. The portion nearest to the view point is clipped.
    It could be a CsupportChannels::SC_CALCBOUNDINGBOX problem but I don’t know exactly what I’m doing wrong.

The following is my CrhinoDisplayConduit extension…

class CSampleDrawReferenceSystemConduit : public CRhinoDisplayConduit
    : CRhinoDisplayConduit(CSupportChannels::SC_CALCBOUNDINGBOX | CSupportChannels::SC_POSTDRAWOBJECTS)

  bool ExecConduit(CRhinoDisplayPipeline& dp, UINT nActiveChannel, bool& bTerminateChannel)
    switch (nActiveChannel)
      case CSupportChannels::SC_CALCBOUNDINGBOX:
        for (int brepIdx = 0; brepIdx < m_breps.Count(); ++brepIdx)
          ON_Brep* brep = m_breps[brepIdx];

          if (brep)

      case CSupportChannels::SC_POSTDRAWOBJECTS:
          ON_Material material;
          material.SetDiffuse(ON_Color(255, 0, 255));
          CDisplayPipelineMaterial* pipMat = new CDisplayPipelineMaterial(material);
          dp.DrawShadedBreps(m_breps, pipMat);

    return true;

  void SetBreps(const ON_SimpleArray<ON_Brep*>& i_breps)
    m_breps = i_breps;

  ON_SimpleArray<ON_Brep*> m_breps;

void Main ()
   CSampleDrawReferenceSystemConduit conduit;
   ON_Surface* surfaceSample;

   ON_PolyCurve squareSample;
   squareSample.AppendAndMatch(new ON_LineCurve(ON_3dPoint(0, 0, 0), ON_3dPoint(10, 0, 0)));
   squareSample.AppendAndMatch(new ON_LineCurve(ON_3dPoint(10, 0, 0), ON_3dPoint(10, 5, 0)));
   squareSample.AppendAndMatch(new ON_LineCurve(ON_3dPoint(10, 5, 0), ON_3dPoint(0, 5, 0)));
   squareSample.AppendAndMatch(new ON_LineCurve(ON_3dPoint(0, 5, 0), ON_3dPoint(0, 0, 0)));
   surfaceSample = RhinoExtrudeCurveStraight(&squareSample, ON_3dVector(0, 0, 30));   


Thank you in advance!

Hi @margari,

See if the attached sample provides you with any assistance.

cmdTestMargari.cpp (4.1 KB)

– Dale

Hello @dale,

Thank you for your support but unfortunately your code doesn’t work.
I noticed that the problem occurs when into the document is placed an object smaller then the conduit one.
You can reproduce the problem running the TestMargari command after to have opened the linked file.

docTestMargari.3dm (30.5 KB)

I forgot to tell you that the clipping issue is only in the perspective view.
I’d also like to draw the brep in the ray-tracing rendering but I don’t know how.


HI @margari,

Sorry, but I cannot repeat the issues you are reporting. Here is a view capture of the perspective view in raytraced display mode.


Can you run the SystemInfo command and upload the results to a reply?


– Dale

Hello @dale,

Here is my SystemInfo command output. My work mate and I have the same issue with two different PCs:

Rhino 6 SR20 2019-11-18 (Rhino 6, 6.20.19322.20361, Git hash:master @ f60ce76e397bba419469ae5277fc1578641caa3a)

License type: Not For Resale Lab, build 2019-11-18
License details: Stand-Alone

Windows 10.0 SR0.0 or greater (Physical RAM: 16Gb)
Machine name: PC-MARGARI

Non-hybrid graphics.
Primary display and OpenGL: NVIDIA GeForce GTX 1050 (NVidia) Memory: 2GB, Driver date: 10-27-2017 (M-D-Y). OpenGL Ver: 4.6.0 NVIDIA 388.13

Secondary graphics devices.
  Intel(R) HD Graphics 4600 (Intel) Memory: 1GB, Driver date: 10-16-2017 (M-D-Y).

OpenGL Settings
  Safe mode: Off
  Use accelerated hardware modes: On
  Redraw scene when viewports are exposed: On
  Anti-alias mode: 4x
  Mip Map Filtering: Linear
  Anisotropic Filtering Mode: Height
  Vendor Name: NVIDIA Corporation
  Render version: 4.6
  Shading Language: 4.60 NVIDIA
  Driver Date: 10-27-2017
  Driver Version:
  Maximum Texture size: 32768 x 32768
  Z-Buffer depth: 24 bits
  Maximum Viewport size: 32768 x 32768
  Total Video Memory: 2 GB

Rhino plugins
  C:\Program Files\Rhino 6\Plug-ins\Commands.rhp	"Commands"	6.20.19322.20361
  C:\Program Files\Rhino 6\Plug-ins\rdk.rhp	"Renderer Development Kit"	
  C:\Program Files\Rhino 6\Plug-ins\RhinoRender.rhp	"Rhino Render"	
  C:\Program Files\Rhino 6\Plug-ins\rdk_etoui.rhp	"RDK_EtoUI"	6.20.19322.20361
  C:\Program Files\Rhino 6\Plug-ins\rdk_ui.rhp	"Renderer Development Kit UI"	
  C:\Program Files\Rhino 6\Plug-ins\NamedSnapshots.rhp	"Snapshots"	
  C:\Program Files\Rhino 6\Plug-ins\RhinoCycles.rhp	"RhinoCycles"	6.20.19322.20361
  C:\Program Files\Rhino 6\Plug-ins\Toolbars\Toolbars.rhp	"Toolbars"	6.20.19322.20361
  C:\Program Files\Rhino 6\Plug-ins\3dxrhino.rhp	"3Dconnexion 3D Mouse"	
  C:\Program Files\Rhino 6\Plug-ins\Displacement.rhp	"Displacement"	
  C:\Program Files\Rhino 6\Plug-ins\LABUtility\Mosaix\Mosaix.rhp	"Mosaix"	
  C:\Program Files\Rhino 6\Plug-ins\LABUtility\RhinoNC\RhinoNC.rhp	"RhinoNC"	
  C:\Program Files\Rhino 6\Plug-ins\RPC.rhp	"RPC"	
  C:\Program Files\Rhino 6\Plug-ins\RhinoBonusTools.rhp	"Rhino Bonus Tools"	
  C:\Program Files\Rhino 6\Plug-ins\AnimationTools.rhp	"AnimationTools"	

Here is a perspective view in wireframe mode:

Here is a perspective view in shaded mode:

If I move the object in the scene, the visualized part of the conduit changes…

Here is a perspective view in rendered mode (It is well visualized):

Here is a perspective view in raytraced mode:
When I switch to the raytraced mode from an other one, I can see the raytraced conduit for half a second, the it disappears.


Hi @margari,

Both of these video drivers are pretty old. Can you see to updating them and then try again?

NVIDIA GeForce GTX 1050 (NVidia) Memory: 2GB, Driver date: 10-27-2017 (M-D-Y). OpenGL Ver: 4.6.0 NVIDIA 388.13
Intel(R) HD Graphics 4600 (Intel) Memory: 1GB, Driver date: 10-16-2017 (M-D-Y).


– Dale

Hi @dale,

I updated both the drivers to the latest available versions but I the issues are still there:

Non-hybrid graphics.
Primary display and OpenGL: NVIDIA GeForce GTX 1050 (NVidia) Memory: 2GB, Driver date: 7-24-2019 (M-D-Y). OpenGL Ver: 4.6.0 NVIDIA 432.00

Secondary graphics devices.
  Intel(R) HD Graphics 4600 (Intel) Memory: 1GB, Driver date: 10-29-2018 (M-D-Y).

I saw that also @stevebaer bumped into the same problem but I don’t think his solution will be fine also for me:

Many thanks,

I don’t know if it can help but I don’t have the clipping issue running Rhino in Safe Mode but I have the following issue if I zoom a lot.
The vertical edge on the left should go from the base corner towards the top of the image.

I also tried to run the same command on Rhino5 – 64bit and it works well.
Of course, I had to modify some calls in order to use Rhino5 SDK:

const ON_Color color(255, 0, 255);
const CDisplayPipelineAttributes* attributes = dp.DisplayAttrs();
if (nullptr != attributes && attributes->m_bShadeSurface)
  CDisplayPipelineMaterial material;
  dp.SetupDisplayMaterial(material, color);
  dp.DrawShadedBrep(*m_brep, &material);
dp.DrawBrep(*m_brep, color, 1);


I’m not sure if this is the same issue, but there was something similar in this thread

Make sure in this case that you properly grow your bounding box in the CSupportChannels::SC_CALCBOUNDINGBOX channel.


In the debugger are you getting the bounding box that you are expecting in the calcboundingbox conduit?

These are my bounding box building steps:

case CSupportChannels::SC_CALCBOUNDINGBOX:
case CSupportChannels::SC_VIEWEXTENTS:
  if (nullptr != m_brep)
    ON_BoundingBox bbox;
    m_brep->GetBoundingBox(bbox, false);    // returns bbox with m_min={x=0.0 y=0.0 z=0.0} m_max={x=10.0 y=5.0 z=30.0} as expected
    // Here m_pChannelAttrs->m_BoundingBox is m_min={x=1.0 y=0.0 z=0.0} m_max={x=-1.0 y=0.0 z=0.0}, I don't know if it is correct
    // Here m_pChannelAttrs->m_BoundingBox is m_min={x=0.0 y=0.0 z=0.0} m_max={x=10.0 y=5.0 z=30.0} as expected

Thank you!

Thank you @Pablo_Garcia-Amorena,

I’m growing my bounding box but probably not in the right manner. I can’t find where the error is.

Hello @dale and @stevebaer,

Debugging the program, I noticed that, also if I set the m_pChannelAttrs->m_BoundingBox member during the SC_CALCBOUNDINGBOX step, during the following SC_POSTDRAWOBJECTS step that member is as I have never modified it.

Do you have any suggestions?

I also noticed that the frustum doesn’t change its near and far planes, after I set the bounding box.
Is it correct? I expected it to grow up in order to contain my brep.