Rhino Viewport embeded in WinForms (or WPF)

Is there a way to do that?

You can use RhinoWindows.Forms.Controls.ViewportControl

And you are an example here : https://github.com/mcneel/GhCanvasViewport/blob/master/CanvasViewportControl.cs

1 Like

Thanks, I’ll check it out.

I cannot find this in the API what is this RhinoWindows namespace?

Could anyone give me an example how to use this?

After building it into gha and reference it inside Python all I can see is GhCanvasViewportInfo and no classes/methods whatsoever.

After dragging the gha in Grasshopper, I don’t see if it even added anything.

You must add the reference to this library in your project (like Grasshopper.dll)
RhinoWindows is in the same directory of RhinoCommon C:\Program Files\Rhino 6\System

1 Like

Check the Display menu.

1 Like

I checked everything and incl. Display:

If you checked the code you’d have seen you need to drill into canvas widgets…

1 Like


Thanks I thought it was more apparent. I did not read the code because RhinoWindows confused me :smiley:

Ultimately I wanna create a window and have this viewport inside, and somehow connect that with rhino3dm and preview the virtual objects before saving to file.

You can read the code to learn how to do it :slight_smile:

I’m sure if I was a more experienced programmer it would be that simple.

I don’t understand something:

if the imported assemblies are these:

using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;
using Grasshopper.GUI.Canvas;

How come using this:

Eto.Forms.UITimer _timer;

shows no errors?

Eto is not added.

In a GH C# Script component? If you meant the GH canvas component:

not sure how it works without a using statement, though.


I saw the DLL was added to the project but how does it find it without using statement?

If I try to do that in python the interpreter will slap me.