Pythonnet?

Hello !

Have you a solution for use Python 3 ?
Or can i use Python+Pythonnet in replacement ?

Really, I’m confused, I’m starting to learn Python and it’s everywhere recommended to use Python 3.
I see,

and

and other experimental solutions, but Rhino is a professional tool, right?

Thank you

Well lets say it like this: Rhino uses Ironpython which is based on Python 2.7, but under the hood its C# and it has nothing to do with native Python. This is useful because you can use the existing C# library.

Using Python 3.6 would mean that the devs would have to put tremendous amount of extra work into it, which to be fair, I personally see no reason for. Python is popular, but professionals dont need a particular language with an particular version to get something done. Officially Rhino offers 4 languages to work with (but in theory you can use more), I dont know any professional software with more support.

1 Like

Hello @TomTom ! Yes I agree, but, I am a 3d professional, in architecture and object design, not in development.

When I read “Rhino supports Python”, I say to myself, “Good!, I have new opportunities available”. But Rhino supports IronPython 2, not Python, it’s not the same.

I did tests with Pythonnet, it seems to work but without Rhino. I am a 3d professional, not of development.

I’m register here with my personal licence v6 and i have two licence v5 at work. The unique question I have with my tools is: What can I do with?

Rhino 6 give me no more than Rhino 5, why will I change? For a few milliseconds gained on the display and Grasshopper …
Rhino 6 does not improve what I need. So I have think improve it for my needs with scripts.

I tested C #, it works well but it’s harder, with a VS project, a description of plugins, compilation time, theMicrosoftFramework.WithVeryLong.SyntaxSolution (ForSimpleThing). I am a professional 3D, not a developer.

So my question is:

But I think Python for Rhino is a solution to forget.
… Oh! not want to learn C # :frowning: but i do…

I’m not sure what being a professional has to with anything, but:

  1. Rhino/Grasshopper supports several .NET programming languages out of the box (including IronPython through the GHPython component and the EditPythonScript editor.

  2. If one wants/needs to interface CPython with Rhino/Grasshopper, that is possible. But will require either some custom interfaces or the use of plugins that have already done so (i.e. the projects you linked to in your original post).

  3. While IronPython indeed does not support several popular CPython modules (numpy for instance), there are often .NET alternatives (Math.NET for instance).

I do agree that McNeel might be better off being more explicit about the Python flavour in Rhino being IronPython in their marketing/documentation. While this information might initially seem confusing to newcomers, we’ve seen time and time again users thinking that they’re using “normal” Python in Rhino/GH, and then being disappointed/confused/frustrated when they find out that this is not the case.

2 Likes

on short term, yes. Starting scripting in Python is easy, but once you do something more complex it really doesn’t matter, because it requires deeper knowledge of what happens behind the scene.
There is no easy scripting.

1 Like

Yes in the previous post, Steve Baer recommended me to use C # (but really, I do not want to)

:slight_smile: Yes, I know, and that’s my current problem.

Thank you! So my problem is

  • Do I take the time to learn C # and maybe improve as I need
  • Can I wait several years for v7 that may improve what I need
  • Do i take time for migrate on another software
  • Engage developer professional. I’ve call (Rhino4you) for estimate. The prices is not for a small company.

What will C# solve for you that IronPython won’t (they are essentially the same, in that one is written in the other)? Which problems ARE you attempting to solve? How do you imagine CPython would be able to solve those problems? Seems like there are some apples to oranges going on here :slight_smile:

hello @AndersDeleuran

It’s very specific to me. And it’s a constraint because i’m not a good developer. I can not write and understand other code without a types declarations. For example in my hobbies i know node/js but i write with TypeScript (because without the IntelliSense, I can not do it). And the type checking was introduced in Python 3. it’s not optional for me.

In my business, it is specific to our machines and mainly concerns certain export formats.

I sometimes need to learn Rhino to new users. I am a former SolidWorks user. Put a new user in front of sld and rh. With sld we want to extrude, we have an extrusion button. In rh we want to extrude we have 13 buttons and the first question of the news user is “Where is the command for …”.
So for me too, I appreciate a clear interface and I think McNeel improves it with r6.

Not CPython or other standards python lib. Its my problem with the type checking/completion. I know you tell me: Python is not a typed language, but it can with version 3 and I need that.

Sorry my english is bad and i don’t understand this expression…

He is saying you are comparing things which cannot (or shouldn’t) be compared. You cannot compare Solidworks with Rhino, nor you cannot compare Python 3 with IronPython or C#. Its always biased and based on the situation you are in. We may all have very different jobs, where the most common denominator is Rhino. What’s good for you, might be bad for others. I do prefer C# in RH/GH context, although I prefer using Python on other platforms. Its just the tool, the ideas are mine.

I made effort for write in english but i’m not stupid !
The question of this post is :

The response is No !

Ok, thank you.

I did not say you are stupid, the answer is, you can write Python3 code in GH, but there is no official support. Furthermore it doesn’t make any sense to use Python3 if you can do the same with IronPython or C#.

1 Like