Well I am going to update a plugin written in c++ but I want to split it in 2 parts
All the heavy math stuff inside a c++ 64 bit plugin
interface stuff in a c# plugin
Since I am a newbie in c# and have no idea on where to start to add a Property panel in rhinoui
does anybody have a code snippet of a property panel to share ?
or at least point me on how to create one ?
I have searched for the code examples in the rhinocommon but nothing related to UI and interfaces
If you are new to c# and looking for the actual control for a “property panel” style control (assuming you are using WinForms) you’ll want to check out the PropertyGrid in the Controls ToolBox when you are making your form (it may not show up under the Common Controls section, but shows up under All Windows Forms). I’m quite fond of them, and have used them in my own Rhino Docking Panels. You end up writing a lot of wrapper “Properties”, but for me it’s less overhead and headache than having to code 30 edit boxes…
Thanks in advance for any help. I’ve been looking with no success about how to develop a panel with a “dynamic” update based on user selection in Rhino.
At present the data is stored as usertext, and I’d like to be able to “disable” the displayed value if it differs when multiple objects are selected. Something like the display color. If the sample also showed a pick list like this, it would be great.
If I understand correctly, you want to enable or disable items on the Properties page (panel) depending on what is selected. This is not possible using any Rhino SDK.
You can, though, add custom pages to the Properties panel. The Material, Texture Mapping, and Detail pages (shown in your image) are examples of this.
This is great (sorry, I didn’t spot the reply earlier and if I got a notification I didn’t recognize it).
I’ll take a look further at implementing this.
Now I just need to think the logistics of how to support this as I’m assuming many of my users are still on RC0 of v5.
For anyone looking to still build against an older rhcommon dll but support this, I found using reflection I could invoke the SelectedObjects property using this code in the SampleCsObjectPropertiesPage class
RhinoObject[] robjs = this.GetType().GetProperty(“SelectedObjects”).GetValue(this, null) as RhinoObject[];
foreach (RhinoObject rh_obj in robjs)
Thanks for the reply. In an ideal world, yes I would only build against latest release. But I have some clients who never move from SR0. Not necessarily the end users, but typically the IT support in charge of deployments (usually in large firms). Users don’t have admin permissions on their computer. Whilst it should be obvious that fixes and improvements are there to be gained, it’s not as easy as observing that. So if I try to enforce latest build I’m going to loose clients and users. I actually only recently stopped supporting v4.0 (although I was enforcing a service release on this, v4SR0 was too many years ago).
This isn’t necessarily a problem for me, this is the first time where I’ve found a property in a new release that I really wanted to use. Especially given that it seems it’s only one property, Using reflection I’ll be able to disable the panel on incompatible installations, and support the feature in those that do.
(I hope I’m at the right place for my question :] )
In your helpfull plugin sample “SampleCsObjectProperties” you’re displaying the radius of a circle in an custom property panel.
Would it be for example possible, as the panel close (i.e. when the object is deselected), to store the displayed radius as the object name itself?
The final goal would to be able to display/modify custom objects UserText’s from a custom Panel. I’m quite a newbie in C# programming, I already (& roughly) achieved to display a UserText value, but I don’t get how to update it as the panel close.
public override void InitializeControls(RhinoObject rhObj)
{
foreach (var rh_obj in SelectedObjects)
{
if (null != rh_obj)
{
if (null != rh_obj.Attributes.GetUserStrings())
{
Rhino.RhinoApp.WriteLine(rh_obj.Attributes.GetUserString("SampleUserStrKey").ToString());
}
break;
}
}
}