-
Notifications
You must be signed in to change notification settings - Fork 0
Examples FSharpScript
Truong Giang Vu edited this page May 31, 2026
·
1 revision
Scripts:
Use this example when you want to try F# scripting inside Revit.
- referencing Revit API assemblies;
- referencing NuGet packages from a script;
- loading local F# modules;
- creating an
IExternalCommand; - selecting a Revit element;
- printing element metadata;
- trying computational geometry packages such as
geometry3SharpandNetTopologySuite.
- Open Revit 2025 or adjust the
#rpaths for your installed Revit version. - Add
Samples/FSharpScriptDemo/as a script folder. - Run
main_script.fsx. - Select an element when prompted.
- Review the trace panel output.
First run may take longer because NuGet packages need to be resolved.
Common edits:
- Change Revit API reference paths for another Revit version.
- Add F# helper code under
modules/. - Try a smaller set of NuGet packages while debugging.
- Replace selection with a collector when you do not need user input.
| Symptom | Check |
|---|---|
| Revit API reference not found | update #r paths |
| NuGet package fails | check package name/version and network access |
| selection cancels | ESC/cancel is expected to stop the command |
| command not discovered | file name must end with script.fsx
|
- Run Code Overview
- Modern Python Scripting
- Python Debugging
- Python Ecosystems
- RevitDevTool And pyRevit
- Python Stub Generation
- Run .NET Add-ins
- Scripting Runtimes