0742/2078

New Revit 2013 SDK Samples

Originally Published in

Revit 2013 has been released, and I presented an overview of the Revit 2013 API two days ago.

As always, the use of most of the API features is demonstrated by various SDK samples. For a better understanding of the use and contents of the Revit SDK in general, please refer to the getting started and self-preparation guides.

Here is an overview of the new samples:

These samples are all related to the new add-in integration functionality, except for the RoutingPreferenceTools which obviously demonstrate some of the MEP related enhancements.

By the way, the ‘VSTA Samples’ folder was renamed to ‘Macro Samples’ since VSTA was replaced by the open source SharpDevelop IDE.

ModelessForm_ExternalEvent and ModelessForm_IdlingEvent

Both of these display and show how to interact with a modeless form. One way to do this is to use the Idling event initially provided in Revit 2012, which we have discussed so much and in such depth in the past.

The ModelessForm_IdlingEvent sample should clarify many of the issues we dealt with, and is also related the material presented by Arnošt Löbel in his Autodesk University 2011 class CP5381 on asynchronous interactions and managing modeless UI.

The ModelessForm_ExternalEvent sample demonstrates an easier way to implement this interaction using the new external event interface.

ProgressNotifier

RoutingPreferenceTools

The RoutingPreferenceTools sample provides a number of MEP pipe routing preference tools.

This sample contains three commands, one for analysis and reporting purposes, two for importing and exporting routing preferences to XML:

  • Routing Preference Analysis: Analyze the routing preferences of a given pipe type to check for common problems, using the routing preferences API to look at all rules and criteria for a given PipeType.
  • Routing Preference Builder with its two commands CommandReadPreferences and CommandWritePreferences: Set pipe type, fitting, and routing preferences in a project from data in an XML file and export these preferences to XML for archival, documentation, and collaboration purposes, allowing a user to work with routing preference data in a shareable XML format suitable for reuse in a wide variety of BIM management environments.

UIAPI

The UIAPI sample demonstrates a number of the new add-in integration API features that I already listed, including embedding a Revit view as WPF control inside its own dialogue, the new drag and drop API, and the Options dialogue support for custom extensions using arbitrary WPF components. This sample was also shown at the DevDays 2011 conferences.

WorkThread

The WorkThread sample demonstrates utilizing the Idling event in a multi-threaded application to communicate with the Revit API from an external work thread.