Skip to content

Instantly share code, notes, and snippets.

View goswinr's full-sized avatar

Goswin Rothenthal goswinr

View GitHub Profile
@goswinr
goswinr / RhinoScriptSyntax.fs
Last active February 28, 2017 14:49
A suggestion on how Rhinoscriptsyntax could be ported to F#
open Microsoft.FSharp.Collections
open FsEx // some F# helper libraries. eg.type Rarr = ResizeArray
open System
open Rhino
open Rhino.Geometry
open System.Drawing
module GeoExchange =
// translation from custom 3D classes
  1. Download the Mantis zip file from https://dl.dropboxusercontent.com/u/157820459/Mantis.zip
  2. Unblock the Mantis zip file before extraction http://blogs.msdn.com/b/delay/p/unblockingdownloadedfile.aspx
  3. Place the extracted folder Mantis in the program files directory "C:\Program Files" - note that Mantis only works for 64 bit Windows at this stage
  4. Copy the Mantis.addin file from "C:\Program Files\Mantis\Mantis.addin" to "C:\ProgramData\Autodesk\Revit\Addins\2016\Mantis.addin"
  5. Run Revit, open file, and start Mantis from the Add-Ins Ribbon
  6. To test copy the F# code from https://gist.github.com/moloneymb/4561a548a3378bc2775f into the shell. Select all text and run selected (Run button or Alt+Enter). Once the code has run a new shape should appear in 3D Views -> CSGTree
  7. For help or more advanced functionality please feel free to reach out to me at moloneymb (twitter, gmail or skype)
// Based on the SDK Sampl GeometryCreation_BooleanOperations
// This is testing code. Many improvements can be made before use in real work
#r @"C:\Program Files\Autodesk\Revit 2016\RevitAPI.dll"
#r @"C:\Program Files\Autodesk\Revit 2016\RevitDBAPI.dll"
#r @"C:\Program Files\Autodesk\Revit 2016\RevitAPIUI.dll"
#r @"C:\Program Files\Mantis\Tsunami.IDEDesktop.dll"
open Autodesk.Revit
open Autodesk.Revit.UI
@goswinr
goswinr / Ribbon F#
Last active August 29, 2015 14:08
Update for Ribbon menu with ExcelDna and F#
// typos fixed in:
// http://bramjochems.com/blog/2014/05/creating-ribbon-menu-exceldna-f/
module RibbonBuilder =
// http://bramjochems.com/blog/2014/05/creating-ribbon-menu-exceldna-f/
type RibbonButtonSize =
| Large
| Medium
@goswinr
goswinr / if else indentation
Created April 30, 2014 13:14
if else indentation
let x = false
// The indentation of the else clause seems wrong.
// could there be a compiler warning for this ?
if x then
printfn "if ?"
else // bad indentiation
printfn "else ?"