What's New in the Revit 2017 API

Here is the online version of the 'What's New' section of the Revit 2017 API help file RevitAPI.chm included in the Revit SDK, which is also provided in the separate document 'Revit Platform API Changes and Additions.docx'.

This is very important information, both for exploring the new features and for later reference.

If you encounter any issues at all migrating your add-in between different versions, this is one of the first ports of call.

I am putting it online to ensure that this valuable information is available through web searches.

To look up the introduction of changes and features in previous versions, here are links to the preceding 'What's New in the API' discussions:

For more detailed information, please refer to the complete API documentation and samples collection in the SDK and the online Revit API Developers Guide provided as part of the Revit 2017 Help.

Major Revit API Changes and Renovations

API Changes

.NET 4.6

All Revit API binaries are now built targeting .NET 4.5.2. However, Revit uses the runtime from .NET 4.6. At a minimum, add-ins will need to be set to target .NET 4.5.2, but .NET 4.6 will also work.

Visual C++ Redistributable for Visual Studio 2015

Revit is now built with and installs runtime libraries from the Visual C++ Redistributable for Visual Studio 2015. Specifically, version 14.0.23026.0, which corresponds to vanilla Visual Studio 2015. Third party applications which include native components may want to upgrade to the same VC runtime as there is no guarantee that Revit will install any other runtime on client machines.

Automatic transaction mode obsolete

The transaction mode:

is now obsolete and this capability will be removed in a future release. The Manual transaction mode should be used for command callbacks that make changes to the Revit model (using the Transaction APIs to start, commit and manage the needed transactions). The ReadOnly transaction mode can be used for commands that do not require making any changes to the Revit model.

Code signing of Revit Addins

To improve the security of Revit and its addins, and help users to clearly understand the origin of 3rd party code running within the context of Revit to avoid malicious tampering, a new code signing mechanism has been introduced. All API developers should:

If this is not done, one or more message dialogs will be shown during Revit startup:

In each case, the end user can choose whether they want to always trust the addin, load it once, or skip loading.

Please refer to https://msdn.microsoft.com/library/ms537361(v=vs.85).aspx for detailed introduction about the code signing from Microsoft.

Background processes can load DB applications

Revit uses background processes called RevitWorker to perform certain calculations and operations out-of-process. While the situations in which these RevitWorkers are used is currently limited, the RevitWorker process is capable of loading a DB application add-in (<AddIn Type="DBApplication">) and events set in that add-in may be triggered by activities in the RevitWorker.

By default, no add-ins are loaded into RevitWorker. To have an add-in loaded into RevitWorker, add the LoadInRevitWorker flag to the .addin file:

The new property:

indicates whether or not a RevitWorker process will load this add-in. The default is false.

Application API changes

The default constructor for

has been removed. Use of this constructor in unsupported situations could result in unexpected behaviour. The correct way to obtain the handle to the Application is from the arguments passed to the associated Revit API callback being invoked, for example:

One location where a full Application is not available is in the callbacks to IExternalApplication (OnStartup() and OnShutdown()). ControlledApplication is supplied instead. This is because Revit is not ready to perform operations with Documents while in this initialization state. If you need to start working with Documents immediately after Revit completes startup, you can subscribe to the ApplicationInitialized event.

Family API changes

The following member has been deprecated and replaced:

The following member has been changed:

Revit now transforms the input position into the SpatialElementFromToCalculationPoints objects's coordinate space before calculating the distance. Previously, the input position was used unchanged, which could lead to Revit incorrectly claiming the point was out of bounds.

View API changes

Category visibility API

The following members related to category visibility in a view have been deprecated and replaced or added:

Text API changes

Revit text handling has been reworked, addressing long-standing issues and introducing new editing capabilities. Most of the existing API for text access has been maintained, but a few changes have been made.

Text related to CustomExporter contexts

Note that the class FormattedTextRun has been marked obsolete. It is replaced by the new class FormattedText.

TextNote creation behavior change

The various TextNote.Create methods now need to be followed by a call to Document.Regenerate before the newly created TextNote can be queried for data.

Event API changes

The following member has been deprecated and replaced:

Alignment API changes

The method:

will now throw exceptions with more informative messages, such as "The two references are not geometrically aligned so the Alignment cannot be created."

Geometry API changes

NurbSpline creation changes

The methods used to create a NurbSpline curve have been replaced. In the replacement methods, the newly created curve may be returned as a NURBSpline or a simpler curve such as line or arc. This is consistent with Revit expectations that the simplest possible representation of curve should be used in Revit elements.

TessellatedShapeBuilder changes

The method Build() has changed from the prior release as follows:

The results of Build are now stored in the TessellatedShapeBuilder instead of returned from Build(). Access these results through the new method:

The options for building are now set as options in the TessellatedShapeBuilder itself. Access these options through the new properties:

Structure API changes

FoundationWall API

The following members have been deprecated and replaced:

Rebar API changes

The following method has been deprecated and replaced:

The method generates full geometry for a Rebar for a specific view, before cutting is applied.

The following methods have been deprecated and replaced:

FabricSheet API changes

The following property has been deprecated and replaced:

FabricSheet.PlaceInHost behavioural change

The behaviour of the method:

has been updated. It now properly supports move of the FabricSheet to a different structure with a modified transformation.

LoadCase API changes

The following types and members have been deprecated and replaced/added:

MEP API changes

Duct API

The following duct creation methods have been deprecated and replaced by new methods. Many of the new methods offer additional parameters supporting the assignment of duct system type and reference level:

Pipe API

The following members have been deprecated and replaced:

The deprecated property returns one pipe schedule type element on the pipe type. In case that the pipe type contains multiple pipe segments and schedule types in its routing preference definition, only the first pipe schedule type is returned in the deprecated property. Instead, the correct usage is to use the new property Pipe.PipeSegment, which provides the correct pipe schedule type and other segment properties, just as Revit property palette shows.

Additionally, the following new methods are available related to PipeScheduleType:

MEP System API

The following properties have been deprecated and replaced by methods:

A new method is also added:

Internally, these MEP system values are now calculated asynchronously on a non-blocking evaluation framework. In order to handle asynchronous calculation results, the caller needs to define callback methods to react on background calculation results (e.g., to refresh the user interface). API developers cannot define callbacks but will still get the correct value. If no callback methods are defined (e.g., in third party applications), the calculation is automatically switched to synchronous calculation.

These values have been exposed via built-in parameters in the past. They are still supported. For example, PipingSystem.get_ParameterValue(BuiltInParameter.RBS_PIPE_FLOW_PARAM) will get the correct flow value synchronously, assuming no callback is detected. The caveat is that, due to the internal support of asynchronous calculation, these parameters no longer support dynamic model update.

EnergyDataSettings API changes

The following members have been deprecated and replaced:

Rendering API changes

The rendering API has undergone major changes with the switch from NVIDIA mental ray to RapidRT. Several functions and enum values have been removed, as their corresponding functionality no longer exists.

Removed functions

New enum value

RenderQualitySettings changes

RenderingQualitySettings has been completely overhauled. All of the properties and functions have been removed and new functions have been added to be compatible with the RapidRT interface.

New properties and functions:

Plane API changes

The constructors and methods used to construct a Plane have been obsoleted and replaced, for consistency with the other exposed subclasses of Surface.

The new method:

creates a Plane object passing through three points supplied as arguments.

DirectShape API changes

Functions that treat application id and application data id as mandatory GUIDs are being phased out.

This affects:

The DirectShape.ApplicationId and DirectShape.ApplicationDataId properties should be used instead.

DirectShape.IsValidCategoryId() has been reimplemented. The new version lists categories approved for use with DirectShape. The old version listed all top-level built-in model categories.

Point Cloud API changes

PointCloudOverrides API

PointCloudOverrides now supports overrides for point cloud regions. Several functions related to point cloud overrides have been deprecated and replaced:

The following new functions support region overrides:

Schedule API changes

ScheduleField

The following member has been deprecated and replaced:

The new enum:

allows the user to specify the display type for a field. In addition to a standard field, the user can choose to display a total, the maximum value, the minimum value, or both.

The new method:

indicates whether the field can display minimum and maximum values.

UI API change

Rectangle class

The Rectangle class has been moved from the namespace Autodesk.Revit.UI to the namespace Autodesk.Revit.DB, and is now found in RevitAPI.dll.

Obsolete API removal

The following API members and classes which had previously been marked Obsolete have been removed in this release. Consult the API documentation from prior releases for information on the replacements to use:

Methods

Properties

Enumerated types

API Additions

Application API additions

Document creation

The new method:

creates a new imperial or metric project document without a specified template.

Family API additions

New PromptForFamilyInstancePlacement() options

The new options:

allow more programmatic control over the options available to govern the placement of a given family. The FaceBasedPlacementType option exposes the available options for placement of a face-based family, while the SketchGalleryOptions offer control over the types of sketched curves which can be used for a curve-based family.

Family and FamilyInstance members

The new property:

identifies whether the family contains parametric relations between some of its elements.

The new method:

determines whether the family contains sketches with a large number of elements.

The new members:

provide access to the ability to split a curve-driven family instance (such as beam, column, or brace).

View API additions

TemporaryViewModes

The new class:

carries data related to the state and properties of available temporary view modes. Access to an instance of this class is via the property:

The class has the following methods and properties:

Convert dependent view to independent

The new function:

converts a dependent view to be independent.

Plan view underlay

The new methods:

provide access to the underlay levels and settings for plan views.

Assembly views creation

The creation of assembly views and schedules has been improved to allow the creation of an assembly view or schedule with template information. The new overloads for methods:

offer two new arguments:

Depth Cueing

The new class:

allows users to control the display of distant objects in section and elevation views. When depth cueing is active, objects blend into the background colour (fade) with increasing distance from the viewer.

The class contains the following methods and properties:

The new methods:

allow the user to get and set the depth cueing settings for the view.

Text API additions

Revit text handling has been reworked, addressing long-standing issues and introducing new editing capabilities.

Text range

The new class:

identifies a range of text in a FormattedText via its start index, end index and/or length.

Formatted text

The new methods:

access a FormattedText object which contains the text and its associated formatting. FormattedText allows read and write access to the text and the formatting in the text note.

The text in a FormattedText object is accessible at a whole or at the level of a specific TextRange (overloads exist for both levels of access):

Most formatting can be accessed at the level of the entire text, or at the level of a specific TextRange (overloads exist for both levels of access):

When checking the status of a particular range, it is possible that the formatting is applied to all text in the range, or no text in the range, or a mixture. This is reflected in the enumerated type FormatStatus.

The method:

returns a TextRange identifying the entire formatted text.

The method:

returns a TextRange identifying the first occurrence of the given string within the text, from a given index.

TextElement additions

The text element now has size restrictions. The new functions:

return the minimum and maximum permitted width for an existing, or newly created, TextElement.

Text editor options

The new class:

provides access to settings that control Revit's Text Editor appearance and functionality.

Geometry API additions

ShapeImporter class

The new utility class:

supports conversion of geometry stored in external formats (such as SAT and Rhino) into a collection of Revit geometry objects. Use ShapeImporter.Convert() to generate the geometry objects (and where possible, corresponding materials and graphics styles in the associated document).

Builder for 3D boundary representations

The new builder class:

offers the ability to construct Revit boundary representation geometry (either solids or "open sheets") as a result of inputs of surface, edges, and boundary loops of edges. If the construction of the boundary representation is successful, the resulting geometry objects can be used directly in any other Revit tool that accepts geometry, or the BRepBuilder can directly be passed to populate a DirectShape via:

New Surface subclasses

Several new subclasses of Surface have been introduced:

These subclasses expose creation methods and read-only properties suitable for use in constructing import geometry.

Frame

New method added

XYZ

New method added

Fixed Reference Sweeps

The new static method:

allows creation of a solid using the "fixed reference sweep" method, similar to the method defined in the STEP ISO 10303-42 standard.

A typical use of this method is to create a swept solid for which a line in the cross-section of the solid remains horizontal all along the sweep. As an example, this can be used to construct railings to ensure that the top of the railing remains oriented to the horizontal steps of the stairs. In this example, the fixed reference direction would be chosen to be the upward vertical direction. See the function's description for further details.

As with other GeometryCreationUtilities methods, there is a second version of CreateFixedReferenceSweptGeometry that takes a SolidOptions input, allowing the user to assign a material or graphics style to the solid.

Parameter API additions

Global Parameters

Global Parameters support controlling geometry constraints through special parameters defined in a project document. Global Parameters can be used for both labeling and reporting to/from dimensions, as well as setting values of instance parameters.

The new class

provides the main access point to managing global parameters in project document. It offers the following members:

The new class:

contains methods to control and manipulate a single global parameter. It's most important members include:

The new class:

contains a value of a corresponding global parameter. It is a base class for derived concrete classes, one per each type of a parameter value:

All the derived classes have only one property:

New methods added to the Parameter class:

InternalDefinition.Id

The new property:

returns the id for the associated parameter. This is the id of the associated ParameterElement if the parameter is not built-in.

Multiline Text parameter support

The new enumerated value:

was added for creation and use of multi-line text parameters.

CurveElement API additions

End joins and tangent constraints APIs

CurveElements now support options to read elements that are joined to this element at the given end point, and to apply and lock tangent constraints.

The new methods:

support read of elements joined to this curve element.

The new methods:

support access and modification to tangent constraints on the given curve element.

Railing API additions

Several new methods have been added to BaseRailing:

Schedule API additions

Combined Parameters

Several methods and properties have been added to support combined parameters in schedules:

The new enum value:

indicates a combined parameter field.

Tag API additions

SpatialElementTag API

SpatialElementTag is a base element for Autodesk.Revit.DB.Architecture.RoomTag, Autodesk.Revit.DB.AreaTag and Autodesk.Revit.DB.Mechanical.SpaceTag.

The following new properties have been added:

RoomTag API

The following new properties have been added to RoomTag:

UI API additions

ColorSelectionDialog

The new class:

provides the option to launch the Revit Color dialog to prompt the user to select a colour. The original colour can be set as well as the selected colour before the user changes it. The method:

returns a status indicating if a colour was selected and the dialog confirmed, or if the user canceled the selection.

FileOpenDialog and FileSaveDialog

The new classes:

allow an add-in to prompt the user with the Revit dialog used to navigate to and select an existing file path. FileOpenDialog is typically used to select a file for opening or importing. FileSaveDialog is typically used to enter a file name for saving or exporting.

The behaviour and appearance of this dialog matches the Revit "Open" dialog. This is a general-purpose dialog for opening any given file type, and options to configure settings like worksharing options will not be included. Use of this dialog does not actually open an existing file, but it will provide the selected file path back to the caller to take any action necessary.

These dialogs inherit from:

which exposes the shared options and operations needed for prompting with either an open or a save dialog. The method:

returns a status indicating if a file was selected and the dialog confirmed, or if the user canceled the selection.

TaskDialog API additions

The new members:

provide access to an extra checkbox shown the user in the TaskDialog. If it is set, a checkbox with the text will be shown in the task dialog. The caller can get the user setting for the checkbox by checking the return value of the WasExtraCheckBoxChecked() method

Support for journal data in overridden commands

The new members:

support the ability for the add-in to store journal data associated to an overridden command, similar to the capability offered for External Commands.

Dockable Pane API additions

The new members:

support the ability for the add-in to control the whether or not any Dockable Panes they register should be visible by default or not. Default is to true.

Structure API additions

FabricSheet

The new property:

returns the reinforcement numbering value for the fabric sheet element.

The new method:

returns the set of parameter ID and length pairs that correspond to segments of a bent fabric sheet (like A, B, C, D etc.).

The new method:

sets the length of the bent fabric sheet segment (like A, B, C, D etc.)

Quantitative FabricSheet layout

The new enum value:

indicates a pattern containing multiple groups of wires with a specific spacing and diameter.

Several new methods have been added to support this layout pattern:

The new class:

represents a single fabric wire.

It has the following methods and properties:

LoadCase API additions

The property:

can now be set.

The new method:

allows users to check if the proposed number is unique.

RebarContainer

The new members:

provide access to the option to hide an individual RebarContainerItem in the given view.

The new property:

identifies if Items should be presented in schedules and tags as separate subelements.

Structural Connection API additions

Structural Connection API

The new class:

represents connections between structural elements. A StructuralConnectionHandler can connect structural walls, floors, foundations, framings, or columns.

Some methods and properties include:

The new class:

defines the type of a StructuralConnectionHandler.

The new class:

defines a type element which represents a connection approval type.

The new class:

provides access to project-wide structural connection settings. It contains the following methods and properties:

Rebar Couplers

The new class:

represents a rebar coupler element.

RebarCoupler has the following methods and properties:

The new method:

returns the id of the RebarCoupler applied to the rebar at the specified end.

The new enum value:

indicates the built-in schema for numbering rebar coupler elements.

The new enum:

contains various error states for a rebar coupler.

The new class:

contains information about rebar couplers.

RebarReinforcementData has the following methods:

Rebar end treatments

The new class:

represents an end treatment type for rebar.

It has the following methods:

Several methods have been added to other classes to support end treatments:

The new enum value:

indicates an end treatment type.

The new property:

indicates whether end treatments are defined by the RebarShape of the Rebar element. This value can be changed if the document contains no rebars, area reinforcements, or path reinforcements.

Additionally, the following methods and properties have been modified to require that the RebarShape has no end treatments:

Other Structure API additions

New properties have been added to ReinforcementSettings:

One property has been added to Rebar:

The new Rebar method:

returns the ParameterValue at the given bar index inside a rebar set.

Fabrication API additions

FabricationPart – product list support

To specify a size, some FabricationPart elements, such as purchased duct and pipe fittings, have a Product Entry field in the Properties palette. In the API these FabricationPart elements are identified as having a "product list". The product list entries represent a catalog of available sizes for the selected part.

The following new members are added to support product list FabricationPart elements:

Design to fabrication conversion

The new class:

supports the conversion of design elements to FabricationPart elements. Use the method:

to carry out the conversion, and use the available accessor methods to get the elements created during the conversion, and the elements which failed to convert for various reasons.

FabricationPart – Stretch and fit

The new method:

supports the operation to stretch the fabrication part from the specified connector and fit to the target routing end. The routing end is indicated as a FabricationPartRouteEnd object, which can be obtained from:

Support for fabrication configuration profiles

The new method:

sets the fabrication configuration with the specified profile.

The new methods:

return the profile associated with the loaded configuration or all configurations, respectively.

Support for accessing fabrication configuration data abbreviations added

The new methods:

MEP Fabrication API

The following new members and properties have been added to the MEP fabrication and FabricationPart capabilities:

The new properties:

The new methods:

Electrical API additions

The new method:

gets the system(s) to which the wire belongs.

The new property:

provides access to the default circuit rating for a newly created circuit.

The new property:

provides read and write access to method Revit will use to calculate the apparent circuit load.

Cable Tray API

The new class:

contains settings for cable trays.

It has the following methods and properties:

The new class:

contains info about the cable tray sizing options in the project.

Some methods include:

The new class:

allows iterating over the CableTraySizes.

Conduit API

The new class:

contains settings for conduits.

It has the following methods and properties:

The new class:

contains basic size information for a conduit.

It contains the following methods and properties:

The new classes:

allow traversal of the ConduitSize objects in the project.

The new class:

contains settings information about the ConduitSize objects in the project.

Some methods include:

Other MEP API additions

DuctSettings Class

New properties:

PipeSettings Class

New properties:

MechanicalUtils

The new method:

breaks the duct or duct placeholder into two parts at the given position.

PlumbingUtils

The new method:

breaks the pipe or pipe placeholder into two parts at the given position.

Validation for fitting and accessory pressure drop calculations

The new calculation type:

can be passed by Revit to servers as a member of the bitmask in PipeFittingAndAccessoryPressureDropData.CalculationType and DuctFittingAndAccessoryPressureDropData.CalculationType.

ValidateCurrentSettings indicates that the server should validate the settings stored in the current entity. A server should implement this calculation type if its settings can become invalid after changes such as flow. The server should return the status of the validation in the new properties:

If the setting validation returns false, Revit will replace the setting with the default one, and update the fitting pressure drop accordingly.

Family Connector Info

The new class:

adds the following methods:

Revit Link API additions

Link instance locations

The new method:

will move a RevitLinkInstance so that the link's base point and host project's base point are in the same location.

The new method:

moves this link instance so that the internal origin of the linked document is aligned to the internal origin of the host document.

Both methods cause a one-time movement and do not set up any shared coordinates relationship.

Local unload of Revit Links

The new method:

allows unloading a Revit link in a workshared file for the current user only. When another user opens their local model, the link will still be loaded for them. This method accepts an instance of a new interface class:

The response to the method in this interface is used to control Revit when trying to unload locally a Revit link with changes in shared coordinates.

The new method:

turns off a user's local link override. If the link is loaded for other users, this function will reload the link. If the link is unloaded for other users, then the link will remain unloaded, but the local unload override will be cleared.

Category API additions

Line Patterns

The new functions:

can be used to get or set the line pattern id associated with that category for the given graphics style type.