Closed sbaer closed 12 years ago
Do you mean something like this?:
I found this at mcneel.com and extract this:
Protected Overrides Function OnLoad(ByRef errorMessage As String) As Rhino.PlugIns.LoadReturnCode
'register it with rhino
Rhino.UI.Panels.RegisterPanel(Me, GetType(UserControl1), "my PlugIn Control", My.Resources.Icon1)
Return Rhino.PlugIns.LoadReturnCode.Success
End Function
Public Sub TooglePanel()
If Rhino.UI.Panels.IsPanelVisible(UserControl1.GetGUID) Then
Rhino.UI.Panels.ClosePanel(UserControl1.GetGUID)
Else
Rhino.UI.Panels.OpenPanel(UserControl1.GetGUID)
End If
End Sub
Imports System.Runtime.InteropServices
<GuidAttribute("B444DE2F-F19F-4791-B90C-12F7F34F8A61")> _
Public Class UserControl1
Public Shared Function GetGUID() As Guid
'thanks Steve for this little bit
Dim id As Guid = GetType(UserControl1).GUID
Return id
End Function
End Class
thats all, you have now a panel, to display you can do this manually in rhino or you can use your command class in your plugin:
Protected Overrides Function RunCommand(ByVal doc As RhinoDoc, ByVal mode As RunMode) As Result
MyProject1PlugIn.Instance.TooglePanel()
Return Result.Success
End Function
Best Holger Rasch
Hello, Is it possible to use a button to run a command ?
@CataIin123 please use https://discourse.mcneel.com/ to ask Rhino plug-in questions
Need to create a simple "hello world" docking panel sample