Rhino.Scripting.FSharp is a set of useful extensions to the Rhino.Scripting library. This includes type extension for pretty printing of Rhino objects as well as implementations of commonly used functions in curried form for use with F#.
This library allows you to compose RhinoScript functions with pipelines:
Get started by opening the Rhino.Scripting
namespaces.
Opening Rhino.Scripting.FSharp
will extend
Rhino.Scripting
and Rhino.Geometry
types with additional static and member functions.
#r "nuget: Rhino.Scripting.FSharp"
open Rhino.Scripting
open Rhino.Scripting.FSharp
type rs = RhinoScriptSyntax
Now you can use the |>
and |>!
operator to chain RhinoScript functions together in a more F# idiomatic way.
The |>!
operator is part of Rhino.Scripting.FSharp library.
It passes its input on as output. See definition.
rs.AddPoint( 1. , 2., 3.)
|>! rs.setLayer "my points"
|>! rs.setUserText "id" "point123"
|> rs.setName "123"
instead of regular RhinoScript syntax like this:
let guid = rs.AddPoint( 1. , 2., 3.)
rs.ObjectLayer (guid, "my points")
rs.SetUserText (guid, "id", "point123")
rs.ObjectName (guid, "123")
goswinr.github.io/Rhino.Scripting.FSharp
While the main Rhino Document is officially not thread safe, this library can be used from any thread.
If running async this library will automatically marshal all calls that affect the UI to the main Rhino UI thread
and wait for switching back till completion on UI thread.
Modifying the Rhino Document from a background thread is actually OK as long as there is only one thread doing it.
The main reason to use this library async is to keep the Rhino UI and Fesh scripting editor UI responsive while doing long running operations.
Contributions are welcome even for small things like typos. If you have problems with this library please submit an issue.
see CHANGELOG.md