So far, we looked at the following aspects of the Revit 2020 API enhancements:
The next obvious question is:
What can we do with the new features?
Well, just like most of the existing functionality, the enhancements and some typical yet simple use cases for them are demonstrated by the updated SDK samples.
Revit 2020 sports five brand new SDK samples:
This list also highlights some the most exciting areas of enhancement.
AttachedDetailGroup implements an external application with a ribbon panel UI providing access to its two commands.
The other four implement just one external command each.
Revit 2020 boasts several attached detail group API additions.
The AttachedDetailGroup sample shows how to use these to show and hide the attached detail groups of a model group in the active view.
In its readme file, it purports to be released with Revit 2019.1, although in fact it did not appear before the Revit 2020 SDK.
It includes three modules:
Demonstration instructions:
Revit 2020 supports the creation of concave topography surfaces using
the new TopographySurface
API additions.
The CreateTrianglesTopography SDK sample creates a new topography surface element from triangle points and triangle facets using the new overload of the TopographySurface
Create
API method,
In its readme file, it purports to be released with Revit 2019.2, although in fact it did not appear before the Revit 2020 SDK.
Command.cs implements the Create Triangles Topography external command.
TrianglesData.cs defines two classes, TrianglesData
and XYZConverter
.
The TrianglesData.json
input file contains all the points and facets data to define the topography surface.
The contents of this file can be deserialised to a TrianglesData
object.
TrianglesData
parses the triangle points and triangle facets stored in the TrianglesData.json
input file.
These points and facets are passed to Revit API method to create the topography surface.
XYZConverter
converts to Revit XYZ
instances using a JavaScriptSerializer
.
In Revit 2020,
the CustomExporter
supports some 2D views.
The Custom2DExporter SK sample demonstrates its use to export 2D views using various exporter options, enabling the user to export and visualise 2D model and annotation geometry.
This sample lives in the new CustomExporter
subfolder.
In its readme file, it purports to be released with Revit 2019.0, although in fact it did not appear before the Revit 2020 SDK.
The external command defined by Command.cs displays the dialog defined in Export2DForm.cs enabling you to pick the exporter options and export the current view.
TessellatedGeomAndText2DExportContext.cs implements the IExportContext2D
used for the 2D export. This particular implementation exports 2D curves tessellated into lines and also does some rudimentary text exporting.
Notes:
The sample also includes a proof of concept for exporting text. The absolute minimum is exported, with all text notes separated by a newline. However, OnText
receives all necessary information about text location, font, size and formatting, so the API user can reconstruct it in its entirety.
Some important details:
Known issues:
OnElementBegin
to detect these elements and export any necessary geometry by writing custom code.Instructions:
Revit 2020 enhances the Analysis API with support for a new Path of Travel API.
The PathOfTravel SDK sample demonstrates how to use it to create PathOfTravel
elements from rooms to doors in a plan view and:
The external command defined by Command.cs displays the dialog defined in CreateForm.cs.
It consists of three radio controls selecting one of three different PathOfTravel creation methods.
Instructions:
The Revit 2020 API includes some View Template API additions.
The ViewTemplateCreation SDK sample shows how to use them to create and configure a new view template from a regular view and a view template settings configuration, including:
The external command defined in Command.cs creates and shows the view template creation form.
ViewTemplateCreationForm.cs declares this form, enabling selection of a view for template creation and setting the 'Parts Visibility' and 'Detail Level' parameters. On pressing 'Apply', a new view template will be created based on the selected view and parameter settings. V/G Overrides Model cut patterns settings will be changed for the following categories: Columns, Doors, Walls, Windows. V/G Model cut patterns settings will be changed in the following way: 'Foreground Pattern' will be set to 'Solid fill', 'Background color' will be set to 'Black'. Finally, the newly created template will be assigned to the selected view.
Utils.cs contains several helper methods for showing message boxes and a constant string with the name of the sample.
Instructions:
Launch Revit and create a new project from the Architectural template.
I hope you find these enhancements useful.
Many of them are driven by developer requests.
I look forward to hearing about exciting new applications using them.