Possible to write F# code for Grasshopper?

unhandled

(qythium) #1

Wait, it’s possible to write F# code for Grasshopper?:open_mouth:
I realise it’s based on the same .NET framework as C#/IronPython but how would you go about setting up the runtime, linking assemblies etc. - Or is this some sort of developer-only feature that’s still in the works?


Conversion from GH_Number to Double
(Nathan 'jesterKing' Letwory) #2

My GhShaderNodes plug-in started out as an F\# plug-in - old code is still available for that here: https://github.com/mcneel/GhShaderNodes/tree/master/FsShaderGraphComponents (I have now rewritten it in C\# so it is “easier” to point people to the code repository if they want to learn more about it).

It isn’t all that hard, just make sure all the necessary DLLs are included when packaging for distribution.

These days GhShaderNodes is in Yak, the package distribution system for Rhino and Grasshopper so I don’t release packages on the github page anymore, but you can download one of the old zips and see what I bundled with the thing.

You can use F\# also for writing Rhino plug-ins. It is just a matter of setting up your projects properly and off you go, writing functional plug-ins like there is no tomorrow.

/Nathan

P.S. I just split off these posts into a brand new topic - hopefully less confusion in the original thread :slight_smile:


(qythium) #3

Thanks! ( and sorry about the off-topic post :sweat_smile:)

I’ll take a close look at that plugin and see what I can learn from it - It’s really amazing that McNeel puts so much code out in the open, especially compared to other commercial CAD software companies :slight_smile:

Do you happen to know offhand if this compatible with Mono on Mac OS, or has to be compiled against any specific NET framework?


(Nathan 'jesterKing' Letwory) #4

The theory is that it Should Just Work. I have many smaller (test) plug-ins that I compile on Windows, but then run on the Mac without recompiling first. It is quite nifty really.

I’ll see if I can run the old F\# plug-in on the Mac without recompiling.

I haven’t tried before because my MBP doesn’t do GPU Raytraced, just CPU - and on a high-DPI setting that is slow. Raytraced works, but response wouldn’t be the funnest, so I generally prototype my shaders on Windows only :slight_smile:


(Nathan 'jesterKing' Letwory) #5

Loading the F\# version of GhShaderNodes will have to wait until I have a build of Rhino that doesn’t have Grasshopper crash on start :slight_smile: