Grasshopper

algorithmic modeling for Rhino

I have finally made up my mind to really learn one of the scripting languages that go with GH. I think the first question, as many people have probably asked themselves before, is which language to learn? To me this question is between C# and Python. I searched the forum and surprisingly didn't find a topic on it (seems people have made up their mind one way or the other). I did a search on the web and it seems there is a tendency toward Python, for it's a simpler and cleaner language. But that only applies to general program, not specific to Grasshopper.

So what's the people's feeling on this forum? Python or C#? I have had experience with Java back in college.

Views: 13867

Replies to This Discussion

Depend o what you want it for. 

I would say just for developing routines inside Rhino Python is very convenient.

Otherwise if you go a step further and want to use other software to run in parallel and use their output within your Rhino routines I would go for C#.

I am not at expert at all, but a bit into the topic, so if anybody is able to point out anything I said and refute anything I said, I would also appreciate. I am now learning and using both.

If you know Java you will find that C# is very similar to java.

This thread has a lot of useful information regarding the three scripting languages and their implementation within Grasshopper. David also had some great pointers regarding the Rhino SDK and learning programming etc. in this thread.

Based on the suggestions from this thread and all the previous links, I feel C# is a slightly stronger candidate... My gut feeling also leans toward it. There has been quite a few places that teach Python for Grasshopper from scratch, like Rhino.Python or a recent tutorial offered by modeLab. Is there such a site that teaches C# for Grasshopper from the beginning? All the sites I have found teach C# syntax in general but not particularly targeted at the Grasshopper environment.

"Python or C#?"

VB.

I've found it easiest to learn, but I may be wrong : my decision was caused by it's clear visual attributes - it's just far more readable for me. VB also won't harm you, if you make any "small" mistakes.

Hi Darren,

If you have a strong java background, then I would recommend C# since it is a very similarly structured language.  If you didn't really enjoy java or your brain decided to let go of it after college, then go with python;)

In all reality, I would recommend that you eventually learn both.  They are both widely used languages throughout the world and then you can make decisions on which language to use for each situation.

Hi,

As you know JAVA, you will find C# very easy because it's very similar to JAVA

PYTHON is a strong and also very easy because of its script.

This factor makes it appropriate for many programmers and it's an important point because even

MAYA now supports PYTHON & MEL.

If you read the grasshopper SDK, it will help you more. 

Based on the suggestions from this thread and all the previous links, I feel C# is a slightly stronger candidate... My gut feeling also leans toward it. There has been quite a few places that teach Python for Grasshopper from scratch, like Rhino.Python or a recent tutorial offered by modeLab. Is there such a site that teaches C# for Grasshopper from the beginning? All the sites I have found teach C# syntax in general but not particularly targeted at the Grasshopper environment.

Btw, thanks for all the replies. These have been really helpful. I just want to know a lot bit more...

I don't really think there is a C# for grasshopper tutorial at the moment. But you can learn yourself to educate yourself (isn't that fun); there's C# and there are the libraries that you have access to; but you can also mix in any other .net managed library to add functionality.

1. Download the Grasshopper SDK:

Here all things grasshopper are documented (a lot in a bit of a technical fashion, but there are some examples on how to create parameters and components, and do some cool gui stuff)

2. The rhinocommon SDK documentation: http://4.rhino3d.com/5/rhinocommon/

Most of the functionaly of rhino is exposed in Rhinocommon the rhino SDK; if you're doing something with geometry this is really a great place to look: it gives an overview of what kind of geometry is defined in what fashion, and can help you in discovering how geometries are represented inside the rhino api.

3. Give visual study a try: it has much better autocompletion, and the cool thing is that there is an template now - so you can get on with writing your own scripts pretty fast:

Here is the template for grasshopper:

http://visualstudiogallery.msdn.microsoft.com/9e389515-0719-47b4-a4...

And here the rhino stuff:

http://visualstudiogallery.msdn.microsoft.com/9e389515-0719-47b4-a4...

I would say that the best thing is just to get started; you'll learn what will and won't work.

hi Arend, you gave me the 1, 2, 3. I'll try to follow it and see how far i get. Thanks a lot!

A few notes:

  1. Python is vendor-independent and available across many platforms; C# is a proprietary Microsoft language.
  2. If you want your scripts to have a chance of working on Macs, Python is the better choice.
  3. Generally, Python is the more concise language, and one of the easiest to learn.
  4. C# seems to me to weigh ones programs down with a great many things with the computer can easily keep track of.
  5. C# is well-supported by Microsoft; Python is tolerated.
  6. If one is interested in writing native Windows apps there are many more examples and code snippets available for C#.

You can write your own Phyton compiler in c#...

You find tons of examples of c# in the World wide Whatever

You will have a 10 times faster Execution of your Programm.

You can use look into other dll which are manged code with ease if you know c#...

You have much better support of the net framework.

You can use Attributes .... I have no idea if this is possible in Phyton but i do not think so... and you can have a meta layer in programming because of this.

You are strong typed ... something which is much better than dynamic because you will have better control in big projects.  A and you can be dynamic or use expandoobjects. (I never used this because i did not find any reason doing so.)

You can use Lambda sugar so you can programm functional ... you can programm declarative ... what ever you like... and even better Aspect like if you like ... and even better make this sideeffect free... and and and by the way when you learned c# you are closer to c and c++ ... something the industry likes and do stuff cloer to the computer.

The main commercial slogan for Phyton is what Phyton has only one way of doing something, which keeps the programmer in the right track. I think this is a quite arrogant and stupid way. If you Programm in one style or another where is a reason for it.

Main thing is do not believe what your university tutors say only because they find it hip. They are mostly idiots. Experiment by your self. And c# is a very good start. You will have a low and high language at the same time. Only it you want to do Iphone apps or web stuff think of something else.

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service