Revit 2017 and 2018 SDK Samples

The Revit API discussion forum thread on drawing or rendering over the active view brought to my attention that an important new SDK sample created to demonstrate the use of the Revit 2018 functionality DirectContext3D for display of externally managed 3D graphics in Revit is missing in the current version of the SDK.

I added it as an attachment to that discussion thread, and am also providing it right here, in DuplicateGraphics.zip.

Here is an overview of the new SDK samples added in the past year or two:

Revit 2017 and Revit 2017.1 SDK Samples

Here is a repetition of the list of new Revit SDK samples added in Revit 2017 and the REX SDK DRevitFreezeDrawing sample, described in more detail and added in Revit 2017.1:

Revit 2018 SDK Samples

The first customer shipment of the Revit 2018 SDK includes one new sample:

As mentioned above, another new sample was initially omitted:

New Samples Overview

For future reference, let's quickly summarise what each one of these does (skipping the structural ones):

CapitalizeAllTextNotes

Capitalizes all the text of all the TextNotes in the project by formatting the text to use 'AllCaps'.

All TextNotes will have their text formatted to be rendered using upper case characters.

DuplicateGraphics

Demonstrate the basic usage of DirectContext3D. The external application creates DirectContext3D servers that extract geometry from selected Revit elements, encode it in pairs of vertex and index buffers, and submit it for rendering using DirectContext3D. This process is triggered using an ExternalCommand and displays the geometry content of selected Revit elements at an offset, so that the graphics appear to be duplicated.

GenericStructuralConnection

Demonstrates basic Create, Read, Update and Delete operations on a generic or detailed structural connection.

In detail:

  1. Create generic structural connection: A generic structural connection is created for the selected structural elements.
  2. Delete generic structural connection: The structural connections should get erased and the former connected elements should be independent.
  3. Read generic structural connection information: A dialog displaying connection information should appear on screen.
  4. Update generic structural connection information: The structural connection is updated to include the additional selected elements.
  5. Create detailed structural connection: A detailed structural connection (clip angle) should be created.
  6. Copy detailed structural connection: The structural connection and the connected elements should be copied to another place in the current project.
  7. Match properties on a detailed structural connection: The properties of the destination connection should be matched to the source one.
  8. Change detailed structural connection: The type and graphic representation of the detailed structural connection should change from 'clip angle' to 'shear plate'.
  9. Reset detailed structural connection: The type and graphic representation of the detailed structural connection should change from 'clip angle' to generic

BRepBuilderExample

Demonstrate several cases of BRepBuilder usage for constructing Revit geometry using API.

BRepBuilder cube

BRepBuilder NURBS surface

BRepBuilder cone and cylinder

The geometry created by BRepBuilder is then set in a DirectShape element to make it visible in Revit views.

MultistoryStairs

MultistoryStairs editing utilities, including creating multistory stairs by a standard stair, adding and removing stairs by picking levels.

PlacementOptions

This sample demonstrates how to place a family instance via options:

The external command Execute method shows the options dialog for user to choose the option of placing the family instance.

I hope you find this overview inspiring and useful and encourage you to explore further yourself.

Have fun!