Grasshopper

algorithmic modeling for Rhino

Hi,

I visit this page for RhinoCommon http://developer.rhino3d.com/api/RhinoCommonWin/html/N_Rhino.htm 

However, the methods mentioned on the page are for C# and VB. Is there any other resource / page where I can find those methods for Python?

Thanks,

Views: 1903

Replies to This Discussion

Hi Tom,

Thank you for responding and taking the time to explain with examples. I have been using rhinoCommon already. Similar to what you recommend, I start writing Rhinocommon commands and experiment with them until I get the desired outcome. The good thing is, as soon as I am about to enter the parameters, all the information about required parameters is displayed and that helps a lot. I was only wondering if I could cut time on that experiment and just read about all the methods before hand. But, it appears, there's no other way. So, I will keep doing it.

Thanks again!

Devang

Devang, this is an unfortunate limitation of the documentation software that we use. It's only capable of generating code snippets for C# and VB.NET. However, in certain places we've started to add our own sample code and here you'll find python included as well. For example:

http://developer.rhino3d.com/api/RhinoCommonWin/html/M_Rhino_Geomet...

Hi Will,

This page did come up in my search results earlier. Thanks for sharing again though. If I am not wrong, such pages are still very rare. So I would just keep on doing what I have already been doing. Simply start typing the RhinoCommon commands and select from the menus that pop up till I have something similar to what I want to achieve.

Thank you again for responding!

Devang

hi all,

I'm an architect and after the grasshopper's revolution the world of architecture/design/3d is changed because "programming" is every day more used from architects/designers. to use python in grasshopper is the next step, because it's powerful and easier then other languages (and the architects can't studies program languages as developers), so I think mcneel could improve GHPYTHON with many thanks of this community.

roy

Yes, Roy, we are just using a documentation generator that was written for .Net, so methods show C#/Vb.Net declarations first. This does not mean that the functions won't work great in Python, too.

Additionally, as Python is dynamic, you just need to know that data type you need to pass for each argument. Generally, in the GhPython editor, you can navigate types too. Just find the type of a variable with print(type(variable)). Then, navigate to that type by using package.module.class.method( and the info for that function will show up.

For example, you can write this code and see the pop-up or help docs:

import Rhino
Rhino.Geometry.Mesh.CreateFromBox( # when you type "(",
            # documentation for these functions is shown

When methods work on an object, the first method argument will be self.

Thanks,

Giulio
--
Giulio Piacentino
for Robert McNeel & Associates
giulio@mcneel.com

hello giulio,

thank you too for your message.

I'm a very happy user of rhino for Mac and unfortunately the python editor is still unavailable as other features in the rhino Mac version.

I'm very interested in your opinion also about what language is better I will learn to use with GhPython. I have understand very good the Tom advice about this, what's your advice? could be better I change to c# from python? what's are the mcneel planning about the future of this? 

thanks,

roy

Hi again

I think Python is great for open-source projects and to automate tasks, relatively better than C# in this. C# is better to create standalone plug-ins, and maybe to hide code, but this difference is getting smaller now that GHPYs are there. It is overall a very small difference.

As Tom is mentioning, the difference in idioms within programming languages is relatively small; you can write good and bad code in all, and that will make most of the difference in any case.

In Grasshopper, our plans are to support C#, Vb.Net and Python for the long-term. Unfortunately there is no editor on the Mac, and for that reason alone, ALL languages are way too difficult to learn: without a proper editor beginner's errors are very common.

For this reason, the best approach would be to type code in an editor like Atom, and run later the code in Rhino. That does not mean that we should still add a good editor to Rhino for Mac, too. I know some other devs are working on this :)

hi giulio,

thanks again for your message, a very clear and useful explanation.

so, good work to you and to the devs are working on the good editor to rhino for Mac also... :)

roy

p.s. personally I've used for years (unfortunately) windows and now with Mac is like run my mouse/tablet on velvet instead of sand... :)

hello tom,

thank you very much for your reply, I've understand important things after your clear explanation!

Hi Roy,

On the other hand you cannot expect being good in scripting or even coding just by learning from some tutorials and documentation. Imagine software architects planning their own housing, just because they have read some books about architecture...  

A very good analogy. I think I will always remember this.

Thanks,

Devang

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service