Grasshopper

algorithmic modeling for Rhino

hello

I am looking to both learn Grasshopper scripting and F#. I looked for a bit and I didn't find any tools that would allow me to use F# in developing Visual Studio plug ins, or even something like the C# scripting component in GH.

Is there some sort of Guide or Tutorial on how to get started with a plugin with that purpose in mind ? I looked up the GhPython code at Github https://github.com/mcneel/ghpython . Should I get started by editing that or how does it work?

The reason I am asking is that F# seems to be the kind of language that would work very well with Grasshopper. Grasshopper components are all either Functions or immutable values, and you write Grasshopper "code" by attaching Functions to each other. That way of thinking would make the coding components more accessible if you're familiar with GH but NOT programming in general.

I am using this book as my F# learning tool, in case anyone is curious: http://www.amazon.com/Real-World-Functional-Programming-Tomas-Petri...

Views: 1485

Replies to This Discussion

This is a chicken and egg problem, tho, no ? There is no tooling because people don't want to use them but people don't want to use them because there is no tooling. Not to mention that functional languages as a whole are gaining in popularity. For example, Twitter is now written in Scala, a functional language for the JVM. There is Clojure as well. F# is one of the most "beloved" languages in the recent StackOverflow survey.

Besides, there are already plug-ins for other popular .NET languages: C#, VB.net, IronPython. F# is gaining in popularity and, as I mentioned, is already pretty similar to the way GH deals with things. 

Thanks for the links I will check them out.

Hi Tom,

I am curious to see how your project evolves, as I can also see good aspects in bringing F# to GH. Maybe you could start a group dedicated to F#?

Best, Thibault

I'm also looking into developing an F# interface.  Given the ease .NET interop, the best idea seems to just make a C# component (that basically replicates the ghpython forms and inputs) which would fire up and manage an embedded fsi.exe interface and to which it would send intellisense queries and compile messages.  The latter is described here.

The problem is that the component in the ghPython repository linked above is outdated and needs to be refactored (and the C# sdk is remarkably sparse).  

If anyone has the experience to setup a shell component with a text-editor interface, it would greatly speed up my work.

Hi Gustave

the GhPython version there is not outdated. "0.6.0.3" is the same version that ships at food4Rhino.
A few methods have been updated in Rhino WIP, but it's all working code.

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

Hi Giulio,

  I was referring to this line in PythonCompoenent.cs:

public class PythonComponent_OBSOLETE : ScriptingAncestorComponent, IGH_VarParamComponent

Which, after digging through the source and sdk a little more, I suppose is obsolete and should be ignored in favor of the ZUIPythonCompoenent.cs?

Oh, yes. That's where you found "obsolete". Well, that's the current component that is used to deserialize earlier releases, when the zoomable user interface (ZUI) was not available, yet.

The source for the C# scripting component isn't available, is it?  

I'm trying to understand how much of the doc-replacement et al I need to re-implement for an F# component.  As far as I can tell, I think I should just be able to save the raw string of the F# input and the the dynamically compiled F# assembly as a properties of the C# GH component and just call the compiled assembly from the GH component side with the IGH_DataAccess instance as an argument.  Does this sound reasonable? 

Yes it does.

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service