Skip to content

Instantly share code, notes, and snippets.

@chuongmep
Created June 27, 2020 03:51
namespace FsharpDemo
open Autodesk.Revit.Attributes
open Autodesk.Revit.UI
open Autodesk.Revit.DB
[<TransactionAttribute(TransactionMode.Manual)>]
type SelectedElement() =
interface IExternalCommand with
member this.Execute(cdata:ExternalCommandData, msg, elset) =
let uiapp = cdata.Application
let uidoc = uiapp.ActiveUIDocument
let selected =
uidoc.Selection.GetElementIds() |> Seq.cast
|> Seq.map (fun(eid:ElementId) -> uidoc.Document.GetElement(eid))
let msg =
selected
|> Seq.map (fun(e:Element) -> e.Name)
|> String.concat "\n"
TaskDialog.Show("Title", msg) |> ignore
Result.Succeeded
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment