Grasshopper

algorithmic modeling for Rhino

Hi everyone,

 

version 0.4.6 of the GhPython component is now available on food4Rhino.

This release addresses the breaking SDK changes in Grasshopper 0.8.50. It is an alternative to version 0.4.4, that targeted previous versions of Grasshopper.

If you are ever in doubt, check which version is installed on your system by opening the editor and looking at the bottom right corner, just as in Grasshopper.

 

----

Numerics enthusiasts

There is a small example for NumPy attached here that can help getting started. You will need Rhino 5 32-bit and the last version of NumPy.

 

----

If you are new to GhPython

For designers who want to use the same flexible language everywhere, GhPython is the Python interpreter component for Grasshopper that allows to execute dynamic scripts of any type. Unlike other scripting components, GhPython allows to use the rhinoscriptsyntax to start scripting without needing to be a programmer. Once on-board and with some practice, you can also get the most of external Python and .Net libraries, including NumPy and SciPy.

 

Please post on this forum suggestions and errors.
You can also visit the source page of this component on GitHub and participate in the development through the bugtracker.

 

- Giulio
______________
giulio@mcneel.com
McNeel Europe

Views: 4580

Attachments:

Replies are closed for this discussion.

Replies to This Discussion

thanks Giulio!!! it is great!

This works much better now, but I'm still having issues passing lists out of the python component to grasshopper components.  Perhaps I just don't understand the correct way to do it. When I make a list of points and use the rs.AddInterpCurve(curvepointlist) function, it works fine, but if I try and pass the list of points to the Grasshopper IntCrv component it fails:  "Error: Data conversion failed from Goo to Point ..."

 

I've attached a sample file.

 

 

Attachments:

Hi Harold,

 

very nice script.

The 'Goo' thing is due to the fact that Grasshopper itself does not understand tuples. I could fix it for this special case, but then again should this very tuple be a Vector, a Point, or Lists of 3 numbers in Grasshopper? It's probably just wiser to keep tuples like this (they are a special Python construct after all).

The fix in the script, however, is very simple. Change curvepointlist.append(pt) to curvepointlist.append(rs.AddPoint(pt)) on line 24.

This will make RhinoPython tranform the tuple into a Guid, and the object will marshal nicely and quickly as the type that you expect it to be.

I hope this helps,

 

- Giulio
________________
giulio@mcneel.com
McNeel Europe

Attachments:
Great!  Thanks for the tips.
Thanks Giulio!

Does this only work in Rhino 5?

Yes, the implementing libraries for Python are only present in Rhino 5, and for this version of Python, called IronPython, we also need .Net 4.0. This is also a Rhino 5-only thing.

- Giulio
________________
giulio@mcneel.com
McNeel Europe

hey giulio, i'm trying to get started with numpy with ghpython. I have an instance the numpy source from sourceforge, but i'm having difficulty getting it running with ghpython. do i need to use the specific flavor of numpy on enthought (per the link in the gh def) and if so, do you know of another link to download this module?

thanks, k

Nevermind. Thank you to John Cook for contacting Enthought and getting everything back up to date - numpy/scipy on Iron Python. Also, ironpkg is pretty great, like macports and yum but for this particular version of Windows python.

Glad to hear that you managed to make it work. Please let the forum know with a new thread if you have any doubts, suggestions or tricks to share.

Thanks,

- Giulio
________________
giulio@mcneel.com

RSS

Translate

Search Grasshopper

Photos

  • Add Photos
  • View All

© 2017   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service