Creating properties for rhino objects

Hello all,
I am looking in the Rhinocommon for a documentation to help me to create new properties for rhino objects and add that to the properties window that belongs to that specific object in rhino.

Is it possible ? and if yes where can I find that in the documentation.


UserData and UserDictionary comes to mind. What exactly are you trying to do?

Thanks for the reply !.
I want to add additional properties for geometry. for example I want to drop a sphere with the radius parameter in its properties. my idea is to register it as a class when dropping it and add the class parameters as properties to it so I can manipulate that at any time from the properties window or even as an attribute from Grasshopper. I will use that to store parameters over objects.It should be possible but I have no idea where to look for the object properties class so to call it.

Yes userdata can do that easily.

Or an easy example:

foreach (ObjRef objRef in objRefs)
                    objRef.Object().Attributes.SetUserString("radius", "20.0");

This looks interesting !. It looks exactly what I was looking for. Thanks for sharing !.
I have to go through it.and try it out. It should work for me.

I have just tried this script that I have made based on yours and I could retrieve the radius value from the selected sphere which is considered good to me.

private void RunScript(bool x, ref object A)

Rhino.DocObjects.ObjRef objref;

if(x == true)
  const ObjectType filter = Rhino.DocObjects.ObjectType.Brep;
  Rhino.Commands.Result objRef = Rhino.Input.RhinoGet.GetOneObject("Select curve to divide", false, filter, out objref);

  objref.Object().Attributes.SetUserString("radius", "20.0");

  A = objref.Object().Attributes.GetUserString("radius");

Now I want to show that in the properties list in Rhino viewport when I select the sphere. Do you have an idea on how to axis this properties list and change it ?.

It should be here:


Or am I misunderstanding the question?

You are totally right. So if I want to redraw it with different radius, the best way is to use the sphere class with the new stored parameter. This sounds really good. then I could create parametric objects like this.

Don’t forget that you have to delete the old object if you are “changing” its geometry. Also, if you expect the user to change the radius often it might be more interesting to look into the preview geometry

This gets really interesting for me. The only Thing is that I am using the C# componant in Grasshopper for testing what do you suggest me to use if I want to do These interactive objects ?
Because I want to use Events and I dont know how to use timer in the C# componant. And I think it is not really practical. In the Dynamically Draw Geometry was that a Rhino Plugin or where was that programmed in Rhino ??.

It would be cool to have it like in Unity3D where you drop the C# script over the object and you script its behavioure.

1 Like

I’m sorry, I don’t fully understand what you are saying. If you are using GH, then the geometry preview shoud be already taken care of by GH itself.
I was speaking about using some kind of variable input inside Rhino itself and before adding the actual geometry to the document.

For your second part: I’m not sure this will work with rhino common, you should probably look into the c++ side but others can give you more input on that.

You understood me Right !. Forget About the grasshopper part. It was a walk around attempt. I want to parametrize blocks in Rhino. This is what I am Looking for. In the example you have sent me, they have used Events to redraw circles. I want to know where that was programmed. That was my Question.

Just search for the term and you’ll get to it:


Rhino is not a parametric modeller.

UserText / UserDictionary are static. You’re right that in order to create a dynamic one you have to use events.

I fear the only way to achieve what you want to achieve is if you re-create derive the class of object you wish to have parametric overloading it with methods for automatically assigning and reading usertext or userdictionary attributes. You have to basically create your own API.
But then again, you cannot use the properties panel, you’ll have to create your own panel.

I am also looking to create something similar, and believe me it is not that easy. Especially if you use Python, like me. As there’s no way to create docking panel with python, yet…or ever will be by the looks of McNeel’s interest on the matter.

Thanks for the Information !.
I will look into that again and let you know if I have some updates. But that was what I am Looking for you are totally Right. Do you have a referance to what you have mentioned ?. This might help alot !.

I am not really fixed to Python. I can do other languages but it depends on the interest. I am just curiouse to know how that might be done in Rhino. Because it is already exists in Autodesk products.

Not really, I am pretty much doing prototyping. I want to see what is possible before I commit to a particular project.

I have several scritps some work some not yet.
I found using Eto difficult, to say the least.
pure WPF and WinForms are easier. More intuitive.

:slight_smile: yes, I’m currently focused on the gui part.

Yes, this sounds interesting !. Looking Forward for your future Shares !.

1 Like

Hi @tigberlin89 you can have a look at my example plugIn Octopus Where I implemented custom objects with prooerties.
It’s still in development though so don’t expect a fully working thing