Custom properties window

Hi,

Is it possible to customize properties tab? I need to display user strings whenever I select the object.

Yes, it is possible to provide your own custom object properties pages.

From a RhinoCommon plug-in project, you will need to override the ObjectPropertiesPages virtual function, found on your plug-in object, and return one or more ObjectPropertiesPage objects.

Let me know if you need to see a sample…

2 Likes

I would appreciate a simple example.
I will also need to use ComboBox, so if this also needs any special approach, It would be nice to see it. But with comboBox I hope I should manage by myself.


OK, I’m nearly there. Now I try to initialize this control, but I’m not sure what I need to provide to Initialize method? What kind of Rhino Object?

InitializeControls(RhinoObject rhObj);

I have also been trying to get this to work (sorry for hijacking the topic :smile:) and have run into this problem:

Upon selecting an object in Rhino, I get a call to the overridden ShouldDisplay method. The RhinoObject that is received there is always null. So I cannot decide in this method whether the custom object properties page should be shown.

After making a run, clearly there isn’t enough exposed to properly add a page to the Object Properties panel. I’ll work with @stevebaer to see if we can get what we need in a future Rhino release.

Here is the tracking item:

http://mcneel.myjetbrains.com/youtrack/issue/RH-28555

How can I register and get to this link?

How far did you get with this? The comments below don’t really close the discussion.

The work item on the bug tracker s still open, so I don’t think it has been fixed…

There is a Sample which seems to work: https://github.com/dalefugier/SampleCsObjectProperties
It is showing up on circles.

Use an object iterator with a filter for the object types that you care about to get the selected objects in InitializeControls. This will work as good if not better than the C++ functions that are not wrapped.

Would it be possible to achieve this entirely through Rhino.Python?

No, not at this time. These panels need to be associated with a compiled plug-in

@stevebaer, recently i´ve stumbled across this example using a PropertyGrid in a WinForm dialog which seems to work through Rhino Python. Below is a stripped down example:

import System
from System.Drawing import *
from System.ComponentModel import *
from System.Windows.Forms import *
    
class OptionsDialog(System.Windows.Forms.Form):
    def __init__(self):
        OptionsPropertyGrid = PropertyGrid()
        OptionsPropertyGrid.Size = Size(280, 260)
        self.Controls.Add(OptionsPropertyGrid)
        self.Text = "Options"
        appset = AppSettings()
        OptionsPropertyGrid.SelectedObject = appset
    
class AppSettings():
    def __init__(self):
        #[CategoryAttribute("MySettings"), DefaultValueAttribute(True)]
        self.SaveOnClose = True
    
d = OptionsDialog()
if d.ShowDialog() == DialogResult.Cancel:
    print "saveOnClose =", d.Controls[0].SelectedObjects[0].SaveOnClose
d.Dispose()

I´ve found a way to track PropertyValueChanged events to make it work in SemiModal way and to return results when the window is closed as shown above.

However setting simple things like CathegoryAttribute() or DefaultValueAttribute() are still a mystery. (see the comment in the code above). Can you please help with this and show an example how the AppSettings() class above has to look like ?

thank you,
c.

Hi @Jess the link https://github.com/dalefugier/SampleCsObjectProperties is unusable,

Hi, this thread is probably outdated. Better start a new topic…

Hi,
It has been moved here: https://github.com/mcneel/rhino-developer-samples/tree/6/rhinocommon/cs/SampleCsWinForms

Sample for ObjectPropertiesPage form is here: https://github.com/mcneel/rhino-developer-samples/blob/6/rhinocommon/cs/SampleCsWinForms/Forms/SampleCsObjectPropertiesPage.cs

@jeffoulet Thanks, It is helpfully for me

I’m trying to write a script in Rhino 7, in EditPythonScript, that would set up my page
to the Properties panel.
But I can’t use the PlugIn.ObjectPropertiesPages function
Is this even possible or not?

From a Python script, no. You’ll need to write a plug-in for this.

– Dale