Geometry preview rhinoinside Marimo Notebook

Hello everybody,

I’m using rhinoinside a Marimo Notebook I was wondering if there is the possibility to preview geometries. Something like “Content Viewer” in Rhino WIP.

Thanks

Something like this should work:

import rhinoinside
rhinoinside.load(r"C:\Program Files\Rhino 8\System", 'net8.0')
import System
import System.Threading as SysThreading
import Rhino
import Rhino.Geometry as rg
import System.Windows.Forms as WinForms
import RhinoWindows.Forms.Controls as RWControls

def run_viewport():
    global form, viewport_control

    form = WinForms.Form()
    form.Text = "Rhino Viewport"
    form.Width = 800
    form.Height = 600

    viewport_control = RWControls.ViewportControl()
    viewport_control.Dock = WinForms.DockStyle.Fill
    form.Controls.Add(viewport_control)

    WinForms.Application.Run(form)

thread = SysThreading.Thread(SysThreading.ThreadStart(run_viewport))
thread.SetApartmentState(SysThreading.ApartmentState.STA)
thread.IsBackground = True
thread.Start()

doc = Rhino.RhinoDoc.Create(None)

cylinder = rg.Cylinder(rg.Circle(rg.Plane.WorldXY, 5.0), 5.0)
brep = cylinder.ToBrep(True, True)
doc.Objects.AddBrep(brep)

if form and form.IsHandleCreated:
    form.Invoke(System.Action(doc.Views.Redraw))