Converting to RhinoCommon missing Draw2dRectangle and FillSolidRect

    public override bool ConduitDrawWires(MRhinoDisplayPipeline pipeline)
        pipeline.Draw2dRectangle(rectangleInfoBox, DashStyle.Solid, 1, colorBorderDark, false);

        pipeline.FillSolidRect(rectangleInfoBox.Left, rectangleInfoBox.Top, rectangleInfoBox.Size.Width, rectangleInfoBox.Size.Height, colorContent);

        pipeline.MeasureString(ref rectangle, Text, new On2dPoint(OnUtil.On_origin), false, 0, FontHeight, FontFace);


I am trying to convert our code from .net SDK to RhinoCommon and have come across these 3 functions that I cannot see how to convert. (so I now have a DisplayPipeline pipeline, and am having a hard time converting these above functions)

I have about everything else I need figured out for now.

Any help would be appreciated.


Gordon Jefferyes

I found a post titled “Drawing 2D lines or Rectangles” and this probably could be converted to do the Draw2dRectangle function. But I am completely stuck on the other 2 functions.

Hi Gordon,

RhinoCommon’s pipeline contains a number of Draw2dText and Draw3dText members. With these, I’m not sure there is a need for MeasureString. Perhaps @stevebaer can chime in here.

As for Draw2dRectangle and FillSolidRect, there is no RhinoCommon equivalent at this time. I’ll add these to the to-do list.

Hi Gordon,

As a temporary solution, you can most probably draw a rectangular surface instead.
You can also fix it to the screen coordinates.
However, I would also like to know how to keep it always behind other objects. Perhaps Dale and Steve can comment.

Kind regards,

We are using all of this together.
Including Measure String.
To draw a box in the viewport, with text in it.

The box has a background. (FillSolidRect)
The box then has a colored outline. (Draw2dRectangle)
And we have to calculate the size this box should be to fit the text in it. (MeasureString)
And we then draw the text into it. (Draw2dText)

Another answer to this could be to draw all of this into a bitmap, and then just draw the bitmap into the viewport.
I believe there is now a quick way to draw a bitmap into the Rhinoviewport, Is this correct? and could you guild me in this direction at all?


Hey Gordon,
I just added the following for SR10 RhinoCommon

  • Draw2dRectangle function that takes both stroke and fill colors which should handle the functionalities of both of the older Draw2dRectangle and FillSolidRectangle functions
  • MeasureString function similar to the older Rhino.NET one

The youtrack issue for this is