Header menu logo Rhino.Scripting.Fsharp

logo

Rhino.Scripting.FSharp

Rhino.Scripting on nuget.org Build Status Docs Build Status Check dotnet tools license code size

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:

open Rhino.Scripting
open Rhino.Scripting.FSharp // opening this will extend RhinoScriptSyntax and some Rhino.Geometry types with additional static and member functions.
type rs = RhinoScriptSyntax
rs.AddPoint( 1. , 2.,  3.)
|>! rs.setLayer "my points"
|>! rs.setUserText "id" "point123"
|>  rs.setName "123"

instead of

let guid = rs.AddPoint( 1. , 2.,  3.)
rs.ObjectLayer (guid, "my points")
rs.SetUserText (guid, "id", "point123")
rs.ObjectName (guid, "123")

The |>! operator is part of Rhino.Scripting via the FsEx library. It passes it's input on as output. See definition.

Full API Documentation

goswinr.github.io/Rhino.Scripting.FSharp

Thread Safety

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.

Contributing

Contributions are welcome even for small things like typos. If you have problems with this library please submit an issue.

License

MIT

Changelog

see CHANGELOG.md

type rs = | RhinoScriptSyntax
union case rs.RhinoScriptSyntax: rs
val guid: 'a

Type something to start searching.