Rhinocommon 101

Hi all,

Does anyone know of some sort of resource for getting to grips with rhinocommon ?
I’m a C# developer. I can ‘do’ rhino and grasshopper and have scripted rhino before back when it was rhino script.
The problem I am facing is lack of practice in moving shapes around.

Yes did the maths primer aeons ago and the scripting primers. I’m fine with coding but rusty with coding geometries.

I’ve been studying the underlying maths but really wonder if getting knee deep in computational geometry is what I should be doing right now.

Before grasshopper, when any automation had to be scripted, there was loads of info on this but now it’s gone because it’s presumed run of the mill geometry work will be done in grasshopper.

Suggestions please.

Check out https://developer.rhino3d.com/ . The guides (specifically https://developer.rhino3d.com/guides/rhinocommon/) and the samples should get you started.

Hi Nathan,

Yes I did look at those; they were my first port of call. But the samples didn’t seem very geometry focussed.
Clearly its the rhinocommon.geometry namespace I need to focus on but the samples didn’t hit this much.
We all know rhino is all about vertices, curves, breps etc. Should I just start creating primitives long hand using rhinocommon.geometry and then do progressively more complex operations or can you suggest another way ?

Hi @cottonbale,

The Developer samples repo on GitHub has a ton of source code samples you might find helpful.

– Dale

Ok, I’ll go take a look.

Thanks Dale

BTW, I made this a topic by mistake - sorry about that - perhaps the administrator can revert it to a normal question

Hi Dale,

I took a look. There are quite a lot of samples.

This being said, given that rhinocommon is the future of rhino development I can’t understand why there is no introductory guide.

I’m not expecting another primer here. After all most people diving into rhinocommon will be developers already. But just being pointed at the samples seems a bit off given the importance of rhinocommon.

You’re all so helpful but I can’t help but think your lives would be easier without everyone badgering you for help due to lack of proper documentation.

Hope you see my point here…

+1, I too wish for a kind of RhinoCommon 101 paper.
Samples are great but making a good step by step intro and concepts guide would help a lot to transition and undrestand the examples.
RhinoScript 101 was so helpfu to go from zero to advanced scripting in short time. I have hard time with RhinoCommon transition due to lack of coding background and no ‘easy’ guide.

Jarek - If you have no coding background it will very hard indeed. But there is lots of help on using rhinopython with the rhinoScriptSyntax libraries. Do you have to use rhinocommon?

That’s exactly why I am interested in it. It is easy to build up on the basic knowledge explained well with all the samples available. Jump-start in a form of 101 guide is priceless.

If I was to use just RhinoScriptSyntax, I may as well stick with RhinoScript, it actually still has more functionality in the “simple” scripting area since many methods were still not implemented in Python equivalent and it doesn’t seem to be a priority or coordinated, parallel effort.
It is the power of RhinoCommon that is very appealing to transition into, but as you noted, quite hard without good guides and prior real coding experience. I have tried several times but missing understanding the “big concepts” or how RhinoCommon namespaces and general usage of things is structured. Hope one day we can see RhinoCommon 101 Guide, maybe based on the previous ones, extended…:slight_smile:

Yes that’s a good point; you might as well use RhinoScript with it’s extra functionality than go to python with RhinoScriptSyntax. It’s annoying for us but i guess they were just trying to make the transition more gradual. It is what it is.

Anyway, I’m revisiting the geometry section of rhinopython 101 because I’m rusty at all this and the last time I coded rhino was years ago writing a point cloud utility plugin with c++ and therefore I’m fine with points and that’s about it :rofl:

However, because RhinoScriptSyntax libs are just wrappers round rhinocommon it should be straightforward to move to rhinocommon. I mean, if you’re using RhinoScriptSyntax you’re really using rhinocommon anyway. So, all one has to do is suss out which RhinoScriptSyntax functions map to which rhinocommon methods. I’d imagine it’s probably pretty obvious which is why the Devs have gone silent on this.

That’s the idea anyways. I’ll let you know how I get on.

Good point, and that is the method suggested to me by others, too (digging into the RhinoCommon code of RhinoScriptSyntax). It is a-OK reverse engineering learning method, too. I just remembered how well the original 101 was laying out the basic concepts, “For Dummies”. I guess maybe RhinoCommon is not for Dummies and that’s what lack of such guide suggests :wink:

Hmmm, y’know you really should watch Long Nguyen’s videos on the vid section of this site. Yes it’s very grasshopper centric but it’s all rhinocommon.

Watch day 1 at least. Go on for hours and was quite painful for me since he teaches how to code as he goes along but what an awesome resource it is. In day 1 he compares python with c# and clearly shows how strongly typed languages like c# can lead to less debugging than weakly typed ones like python. Can’t praise those videos highly enough.

1 Like

Great, I was not aware of these…thanks for the suggestion.

If you haven’t tried it, I would also suggest putting a basic rhinoscriptsyntax based python script together. Set a breakpoint in your script and step into the rhinoscriptsyntax functions. While you are doing this, look at the variable values. This sometimes gives a better understanding of how RhinoCommon is used in rhinoscriptsyntax than just staring at the code.

interesting suggestion, thanks I will try that!

That is something I’d not thought of Steve. So you mean from Visual Studio? The built in editor can’t step into called libraries can it ?

@cottonbale you can set breakpoints in the python editor of Rhino.

OK, thanks Nathan. I’ve been using visual studio from the get go so I’ve missed all this