Plugin GUI change

Hello
I have a windows form plugin that create simple objects (usually polysurface) and saves numeric parameters to the object. Then the object can be modified by loading the numeric parameters to the plugin (it is deleted and recreated after providing new parameter value). It works fine, however I do not like the workflow so I need to redesign the GUI.

As for now I display a modeless form when the command is run and get all the numeric parameters input by the user to the form, which then is closed. If I want to modify the object I read the parameters from the object and redisplay the form.

What I would like to have is user giving basic data (like points, lines or objects). Then I would create a basic object using hardcoded numeric values. All the changes requiring numeric input would be made in the docked tab like properties table. In this case I do not need special modify command.

For example: User calls a command and gives two points. A box with an edge length of distance between points is created. The box is (automatically) selected and the command ends. Docked table shows three parameters a,b,c with a value of distance between points. If a parameter is changed different command is called and the box is updated with new edge length.

What I am able to do is get data from user, store in the object as user data, read the data and create the object.

How can I read the properties to the docked table? I would like it to be populated when the object is selected without calling a command. I would like to execute a command only when a value is changed that changes parameter in user data and recreates the object.

Thank you in advance for any help.

Did you ever find a solution for this?

Hello Dale
Thank you for your reply.
Unfortunately I couldn’t even come up with where to start. I imagine that it will require some kind of event watcher and I have no knowledge about it.
Currently I am trying a solution that a separate modify command will populate the dockable table and property change will call an object redraw command. However lately I didn’t have time to do much work on this. If you have any tips for automatic population from object data after user selects an object I would be grateful.

Best regards
Mike

If you want to use an event watcher, you’ll find a sample project here: https://github.com/dalefugier/SampleCsEventWatcher

I guess, you could do something like:

RhinoDoc.SelectObjects += (sender, e) =>
                {
                    foreach (var obj in e.RhinoObjects)
                    {
                        //if obj has UserData do X
                    }
                };

Not sure if this is what you want, though…