Lab: Revit’s C# Playpen: 23 Code Tricks & Hidden Commands
The Revit C# API gives us freedom to build size-to-fit interface commands to fit your job. Learn 23 special techniques from my wheelhouse of code tricks. This double lab is in a gamified structure that caters for both novice and expert coders of two different difficulty levels. Easy Mode (Walkthrough): Discover what’s possible. C # 101 training available. Hard Mode (Challenge): Use of visual studio for selective debugging…will test comprehension
1. Build your own size-to-fit Revit plugin to fit your job using C#.
2. Execute prebuilt assemblies and discover the hidden commands.
3. Selectively debug with visual studio. Test code comprehension.
You can do a lot of great things with Revit as it ships “out of the box” from Autodesk, but there are still many tasks that are repetitive, boring, and error prone. There are also many situations where you can be more effective and productive if you can add additional functionality to Revit.
The Revit C# API gives us freedom to build our own size-to-fit interface commands to fit your firms specialities and to make our workdays easier and more productive.
Last year I was honoured to present ‘5 Secrets of Revit API’ which rated well and now I have mined an additional 23 techniques from my wheelhouse of code tricks … too numerous to list here, but the highlights include:
• Using Intersection Filter with a Linked Files
• Family revision control with xml serialisation
• Rebar, Wall Centreline, Core and Grid Dimensioning
• Adding new shared parameters with code
• FilteredElementCollector vs. Linq
• Connecting control sliders to a adjust the size of the view box
• Creating a Sweep with Multiple Closed Loops
• Use of RevitLookup Snoops Edges, Faces and Links
• Exploration of GetTransform() what it is there for and how it can be used
• Batch Processing and Aspects of AsStringValue
• An alternate properties grid that allows carriage returns
This double lab is in a gamified structure that caters for both novice and expert coders of two different difficulty levels.
Easy Mode (Walkthrough): Discover what is possible and execute prebuilt assemblies to see a result, hear an explanation on what just happened and directions on how to access the code behind for future reference.
Hard Mode (Challenge): As above, but you will be required to use visual studio to make small, but significant, adjustments to the code which will test your comprehension.
A successful compile & test will count as an achievement and whoever has the most achievements at the end wins.
Note: This not a C # 101 course but if more C # 101 training is of most benefit to the delegates then is it not an issue to adjust the format to meet this need. This is your conference.
All these C# techniques allow us to access different parts of the Revit API and is only a small part of a huge library that provides many ways of tapping into Revit through custom plugins.