tyrX is purpose-built for Autodesk Revit, starting with version 2025, seamlessly adapting to the transition to the .NET 8.0 framework introduced in this release. By dynamically targeting the specified RevitVersion
, tyrX ensures compatibility with the appropriate framework and Revit API version, offering a streamlined and future-proof development experience.
As the successor to tyRevit, tyrX retains its lightweight architecture, delivering an optimized external command solution for Revit. It remains dedicated to empowering users to craft custom workflows in Revit using F# programming. With robust support for IntelliSense in both Visual Studio Community and Visual Studio Code, tyrX enhances coding efficiency and simplifies the development process, making it an indispensable tool for Revit developers.
To install tyrX, follow these straightforward steps:
Fork this repository to your own GitHub account.
You can either:
- Clone the repository using GitHub Desktop.
- Download the ZIP file directly from the repository and extract its contents.
- Open the unzipped folder with Visual Studio Code or load the solution file in Visual Studio.
Depending on your Revit version, change the constant RevitVersion in the .fsproj file.
When compiling, Visual Studio will choose the targeted Revit API version to reference. If the chosen Revit major version is prior to 2025, the constant TargetFramework will be set to net48, otherwise it will target net8.0-windows.
Modify the tyrX.addin
file to point to the correct path of the built assembly rX.dll
.
Change the highlighted line <Assembly>...</Assembly>
to your own assembly path.
Copy the tyrX.addin
file to the appropriate Revit add-in directory:
- For current user:
%appdata%\Autodesk\Revit\Addins\<RevitMajorVersion>
- For all users:
%programdata%\Autodesk\Revit\Addins\<RevitMajorVersion>
Start Revit according to your version, and you are ready to go!
Once loaded into the Revit environment, the core application of tyrX will search for classes that implement the IExternalCommand
interface within the compiled rX.dll
assembly. These classes will then be loaded and recognized as add-ins within Revit.
In the root folder, you will find two F# scripts:
DevCommandCompiler.fs
SelectedCommandCompiler.fs
These scripts are set to be compiled into the assembly and can be accessed in Revit under:
Tab: Add-Ins
Panel: External
Drop-down button: External Tools
My preferred workflow when programming with F# for Revit is an iterative try-and-error approach. This involves making frequent changes to the code and testing them quickly. The most efficient way to do this is to just save my work-in-progress code and recompile it only by clicking the command button to run it. In fact, I use keyboard shortcuts to run my code, avoiding the time wasted searching for the right button to click. Once I'm satisfied with the code, or if I want to experiment with alternative solutions without losing my progress, I save a copy of the current code for comparison and further development.
This is where the two compiler scripts come into play.
- Develop Command Compiler: The
DevCommandCompiler.fs
script is designed to compile thecmd/develop.fs
file, enabling you to focus on problem-solving without distractions. - Selected Command Compiler: This command offers a drop-down list of all F# scripts located in the
cmd
folder, allowing you to select and execute any script easily. Once you’re done withdevelop.fs
, simply duplicate it, give it a meaningful name, and keep it available for future use.
- No Revit Restarts Needed: There is no need to restart your Revit session! You can modify and test your scripts in the
cmd
folder as often as needed. - Accelerate Your Workflow: This approach encourages experimenting with different solutions, ensuring a fast and effective Revit coding experience.
Enjoy exploring and refining your Revit coding workflow!