Let’s just jump right in to having the first look of the essential of coding a command as Dynamic-linked library (.dll) for Autodesk Revit.

To write a Revit plug-in, the first step is to set the transaction mode to manual:

[<TransactionAttribute(TransactionMode.Manual)>]

As each of the plugins is an external command, each command class is built with the interface of IExternalCommand:

type MyCommand(args) =
  interface IExternalCommand with

To run the command, the execute methode is to overload with arguments: CommandData, Message and Elements.

  member this.Execute(cdata: CommandData, msg: string, elm: ElementSet) =

Then goes the content of the command, until the end of the code, and it must be a result returned:

    Result.Succeeded

To build the command into a dynamic-link library (.dll), an confortable way is to set up a F# library with Visual Studio Community. With the interface of Visual Studio, it is easy to set up the correct environment and to have the neccesary references for building up an assembly, to be deployed in Revit, which is based on the .NET Framework.

Stay tuned…