Accessing and working with User Control Panels

Hi everyone,

I just created my first UserControl Panel. I put some buttons, a field and labels on them.
The labels should display certain values of the current model (Angle Tol, Unit System, etc.)
The field should display user Strings of an Object
The Buttons basically should run Commands


  • Accessing the User Control from a Command
    In Order to change something on the User Control, e.g. a label, I need to access it. But how do I do that? Could someone provide a snippet on how to change the text of a Label on a User Control from a Rhino Command.

  • The Properties Window in Rhino changes its contents depending on if and what is selected in the viewports. How does that work. How could I display e.G. User Strings of a selected object?

Thanks in advance for your Help

Have you seen this sample?

Hi Dale,

thank you for the post. It really was helpful to see how you set set it up.

Currently, I have the same functionality you have in your Example. (Register, Show and Hide the UserControl Panel)
However, the question I have is more of what comes after I have it set up.

I’m stuck at the part, where I want to acces the User Control.
Here is what I tried - but it didn’t work.

override Result RunCommand(RhinoDoc doc, RunMode mode)
            // Get the User Control ID
            System.Guid panelId = UI.MainUserControl.PanelId;

            //Check if the panel is already opend, if not, open it
            bool panelVisible = Rhino.UI.Panels.IsPanelVisible(panelId);
            if (!panelVisible)
            MainUserControl panel = (MainUserControl)Rhino.UI.Panels.GetPanel(panelId);
        panel.Label1.Text = doc.ModelAbsoluteTolerance.ToString();

Do you undestand my problem? (It’s hard for me to explain)


Look here:

Notice how the constructor is adding a reference to itself the the plug-in object?