Getpanel() equivalent in rhino6

Hi,
I’m trying to migrate a vb.net 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.
Regards

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

http://developer.rhino3d.com/api/RhinoCommon/html/M_Rhino_UI_Panels_GetPanel_1.htm

or

http://developer.rhino3d.com/api/RhinoCommon/html/M_Rhino_UI_Panels_GetPanel_2.htm

(or their generic version http://developer.rhino3d.com/api/RhinoCommon/html/M_Rhino_UI_Panels_GetPanel__1_1.htm or http://developer.rhino3d.com/api/RhinoCommon/html/M_Rhino_UI_Panels_GetPanel__1_2.htm)

/Nathan

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