Your Choice?

What language do you use in computational design? c # or python? if it is more logical to use python for solving a single specific problem inside the program, but it makes sense to use c # for solving the problem that everyone faces with as a plug-in.But why should I use two languages ​​if I can solve for both situation I did with C#?So the answer would be c# for me.what do you think about that?

In most circumstances, you may use Python to write plugins as well.

I’d say it depends on your background. Python is easier for newcomers while C#, from my perspective, is more structured.

but code written by python is harder way to access rhino or grasshopper’s source code and also to compile for python code is harder and it needs to secondary framework.doesn’t it?

No. You can compile GHPython components easily and access Rhino & GH’s .NET interfaces directly.

The issue here is: GHPython is based on IronPython, which is stuck at Python 2.7 and cannot use many third-party libraries.

Python in Rhino is IronPython (C# based), and basically you code within the .NetFramework which is rather not made for a language like Python. Therefore you’ll encounter several weird things once you dig deeper. I always advise to simply learn both and simply stick to the one you like most. Knowing a bit of C# helps you with IronPython. Knowing Python, helps you in many other scripting environments (since its more common). So there is a win-win of learning both!

1 Like

GHPython (using RhinoCommon) for scripting on the canvas, C# for developing compiled components in Visual Studio. These are the most low friction (for me, at least). There’s a lot of posts on this subject if you do a search. Here’s a recent one expanding a bit:

1 Like

python for everything small and qucik for personal, often one-time use. C# for everything that is larger, is to be used by other colleagues or used more than once.
with a big library of often-used methods, C# is about as fast as python to write.

3 Likes

This is a bit of a prejudice by people prefering strongly typed languages. I was believing this for a long time as well. In reality they pretty much can do the same, with some advantages to certain things. But I know from very large Python Desktop apps, which performing incredible well and stable. Personally I would go for C# on larger apps, especially because Visual Studio provides you with a great debugging/profiling experience, but I’m pretty sure I could do the same with Python.

2 Likes

If you want to create new things for 3d graphics, use C#, since a strongly structured and typed language is desirable. If you only want to call APIs, use Python. But every beginner should try both.

Well if you really want to dive into 3d graphics go for C++. All Python and C# OpenGL/DirectX wrapper are incredible horrible to use.

I myself started to write C++ from elementary school so I found it very weird to use indents instead of brackets… :joy:

Anyway on performance-critical issues, neither is good enough to defeat C.

1 Like

With 3d graphics I was not referring to a graphics/modeling engine, or something concrete (I wouldn’t recommend any beginner to go there :sweat_smile:), on the contrary, to everything related to 3d computer graphics (such as a plugin to make chairs), since C# allows you to comfortably and safely organize the information you need to represent and process it, and you have more examples and help out there.

1 Like

is these issue depence on which you have your own occupation?for example i m an architect i m not computer engineer.

Hello,

I am a structural + aerodynamics engineer and I use python personally :snake: but I think either or both are excellent choices. Both have large ecosystems of tutorials, tooling, packages, etc so you have a lot of options for the future with one or the other.

Happy coding!

Graham

1 Like

The topic is, what we chose in the given situation. I don’t want to write more than 100 lines in the rhino python editor, and if I have to write a command for others to use, it’s easier to write in VS, compile one of our internal plugins and tell the users to update the specific plugin.
This is not a take on python or a any other specific language, but how I use both languages in reality while working with and around Rhino. Distributing python scripts is more tedious in many ways, so only use it for my own tools and mainly if I dont want to leave Rhino.

I’m pretty much 50% 50% in Rhino. Python for direct scripting (without GH), C# for Plugins, or GH scripts.
I sometimes write parts in C# to translate it in Python, just because I’m more used to it. In general both in-app-editors are poor. And Visual Studio is definitly an overkill for 99 % of all tasks. But apart from that, once you know how to code, why not coding in other apps? In practice many people use more than one platform, so it does make sense to judge based on that.

I like plain C as well. Especially on embedded devices, however for the majority of cases its absolutly impractical. But on the other hand, I barely encountered situations where I would not use a higher language. Its always claimed that C/C++ is performing so much better, but in reality most don’t ever need that extra boost, or are running into performance issues because of other reasons, mostly by choosing a weak algorithm or having issues with the language itself. The reason to go for them, are libraries, the level of access and direct memory management. So in other words if a person is able to pick the right language for the right job, without complaining (much), then this will be the best solution. That being said, its always good to learn more then one language, also as a casual user.

And yes, personal preference impacts a lot, just as you indirectly say.

I used Python and not only functions inside examples but also can find them in rhino python packages like corece- related which could convert geo into string or document or list conveniently.