Skip to content

goswinr/Rhino.Scripting.FSharp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

84 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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. 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")

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

About

F# Extensions to the Rhino.Scripting libray.

Topics

Resources

License

Stars

Watchers

Forks

Contributors 2

  •  
  •  

Languages