Start coding F# Library for Revit

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…

Published by

Ching-Hua Chen / 陳景華

The logic behind coding structures will be unveiled during step by step practices. A strong background from computer science is not what I have. I’m just an enthusiast of programming, especially in fields of geometry and architecture. Currently I work for an office in Vienna on a BIM project and I write codes in F# and Python, if needed, for the project, but mostly for my own interest.

3 thoughts on “Start coding F# Library for Revit”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.