Visual Studio Community is a great tool, when coding your own Revit add-in command. While typing, you have its IntelliSense helping you by suggesting your next move, so that you will not get lost in the API library jungle. Especially the one from Revit. However, you’ve always got have to re-compile your whole dynamic linked library from the whole solution, and it took you an huge amount of time for waiting Revit to re-start and re-load your extremely heavy model, even if you’ve just changed a tiny bit of code for debugging. Even if just for one letter. Nevertheless, in this case you have to have all your codes - not only the one you’re debugging now - compiling-ready to prevent any error emerging while building it. But sometimes you’ll have a few other unfinished codes, and you want to just test this current one really quickly to see if it works or how a certain section of it works.
I found this in-efficient issue hugely annoying right at beginning of my coding experience for Revit. Since then, I have been working on developing an efficient, dynamic coding environment along with an instant F#-code-compiler. After daily testing and repeated improvement, I’d like to share with the public: the Tailor-your-Revit core (tyRCore).
As mentioned, the advantage that we definitely should take from Visual Studio Community is its IntelliSense, and this is the reason that this compiler should be built upon with a matching solution folder structure. Here are the steps for setting up your efficient, dynamic and instant coding environment to your Revit:
Download and install Visual Studio Community
This is quite straight forward - just go to this page for Visual Studio and get the community version, for Windows or Mac, and install it with those packages, relevant to developing F# desktop programs.
Create an F# solution
Follow the other post for a step-by-step tutorial to set up an F# solution. For working with tyRCore, you just need additionally set up a folder collecting your codes with a strucutre as mentioned below, or directly fork me on GitHub to get a template with all the needed setups for Visual Studio solution to work with tyRCore. Without further setup, this repository can be immediately loaded into Revit through tyRCore add-in.
Download and install tyRCode
Download tyRCore here or from Autodesk App Store. The installation is straight forward. However, if you’re not sure if you’d do it right, just follow the README section in this repository from above.
This is a trial version of tyRCore with simple interface layouts and automatic toolbar setups in the Revit environment. However, regardless of its work-in-progress, it’s a version which serves the basic needs, as I work with it everyday in Revit and it saved me huge amount of time from inefficient restarts while debugging, and I could then produce a lot more within a narrow time frame.
After installing tyRCore into Revit, you’ll find these two new features added onto the tool ribbon:
- A new PushButton Load F# Codes in the external tools from Add-ins tab, and
- A new RibbonTab named tyR Core on the ribbon.
Both of these two buttons are calling the same command (i.e. same source code) and have the loading PushButton “Load Your FSharp Codes”. With a click on either of them, you’ll be asked to pick the folder with your F# codes and load them into Revit ribbon, according to your folder structure. The difference between the two buttons is just that, you can only call this command without an open document, if it’s registered standalone as an external command. For demonstration purpose, I’ll just take our pre-set F# solution Using_tyRCore as an example:
- The name of the upper directory Using_tyRCore from your choosen folder cmd will be the name of the ribbon tab (It’s also the name of your project in Visual studio.)
- The names of sub-folders will be mapped with formats, either RibbonPanel or RibbonPanel.PullDownButton. (e.g. modify or modify.parameter)
- In the sub-folders, you saved your F# source codes, and each of them will be connect to a PushButton and put under a RibbonPanel or within a PullDownButton respectively.
By the way, tyRCore will also load automatically all those source codes, which are located in the folders, whose names starting with "standalone", additionally as standalone external commands, which can be found in the “Add-Ins” tab, “External” panel. They can be executed without opening any Revit documents at first. This comes in handy, if you code some commands which should run “formlessly”.
This was an introduction to the tyRCore, a great starting point for you to build a comprehensive, structured Revit external commands library step-by-step for your own workflow. I’ll cover more about, how to put it into action, later on, and you’ll see how this will change your experience with coding in BIM!
I’ll be grateful to receive some feedbacks via e-mail from you to improve tyRCore!
And if you like it, buy me a coffee by following a click on the coffee cup on the right-hand side corner of this page.
Until next time, dig in and have fun!