Getpanel() equivalent in rhino6

I’m trying to migrate a plugin to Rhino6, but I have an issue: I can’t find the equivalent for getpanel() in the new rhinocommon framework.
Until now I used this:

    Dim type = GetType(MSP_MainPanel)
    Dim MyMSPPanel As MSP_MainPanel = TryCast(Rhino.UI.Panels.GetPanel(type.GUID), MSP_MainPanel)

but is it deprecated, what should I do now to get my panel instance?
Thanks for helping.

You should use the one that takes also a RhinoDoc or a document runtime serial number:


(or their generic version or


Thanks @nathanletwory, I’ll try this. Though I don’t understand why a panel would need a reference to rhinodoc.

This is pretty much in preparation for the Mac so we, and you, can write cross-platform plug-ins. On the Mac on Rhino instance is alive with multiple documents open. These additions allow you to know what document a panel is for so the right data can be shown.

To prepare your plug-in for this you should try to get rid of ActiveDoc usage in your code. Use the doc passed to you and get its runtime serial number. With that you can always retrieve the doc you need.

ok thanks. it works for me

1 Like