What's New in the Revit 2018.2 API

Let's discuss the Revit API enhancements added since the initial release of Revit 2018.

Before getting to that, let me briefly mention the new AUGI material pointing out 101 Best Practice Tips for Revit Model Management, in case you are interested in such things.

Revit 2018.2 Product Update and Resolved API Issues

I installed the Revit 2018.2 product update last week from the Autodesk Revit 2018 Product Updates.

In the process, I checked out the release notes to analyse what API issues have been addressed in the various 2018 updates, and extracted the following list of reported issues resolved within Revit 2018:

As we shall see below, a number of other enhancements have also been added.

Revit 2018.2 SDK Update

Next, I visited the Revit Developer Centre to download and install the Revit 2018.2 SDK (Update December 6, 2017) (msi – 369528Kb).

Revit 2018.2 SDK

As far as I can tell, it has no differences at all to the previous version in the Samples collection.

The only changes I see affect the help file and changes and additions document.

C:\a\lib\revit>dir 2018.1\SDK
27/07/17  14:21      53'781 Revit Platform API Changes and Additions.docx
27/07/17  17:02  48'063'436 RevitAPI.chm

C:\a\lib\revit>dir 2018.2\SDK
05/12/17  13:31      55'881 Revit Platform API Changes and Additions.docx
05/12/17  15:05  48'155'903 RevitAPI.chm

Studying those in more depth, I do notice significant enhancements.

I also notice that I did not document the updates listed in the corresponding changes and additions document for Revit 2018.1.

So here goes:

What's New in Previous Versions

Here are links to discussions of What's New in the Revit API for previous versions:

Major Additions to the Revit 2018.1 API

Material API additions

Editing the properties of an Appearance Asset

New Revit API capabilities have been introduced to edit the properties contained in an appearance asset of a material. These properties appear in the Appearance tab of the Materials dialog and govern the appearance of the material in realistic views and rendering.

Editing the properties in an appearance Asset requires establishment of an edit scope. The new class

allows an application to create and maintain an editing session for an appearance asset. The scope provides access to an editable Asset object whose properties may be changed. Once all of the desired changes have been made to the asset's properties, the edit scope should be committed, which causes the changes to be sent back into the document. (This is the only part of the process when a transaction must be opened).

The new class has the following methods:

Editing AssetProperty values

The following properties are now writeable from within an AppearanceAssetEditScope, to support modification of an asset property's stored value:

In addition, the following new methods have been added to support modification of property values:

AssetPropertyList now has new methods to allow changes to the members of the list:

Connected Assets

Connected assets are associated to properties in appearance assets, and represent subordinate objects encapsulating a collection of related properties. One example of a connected asset is the "Unified Bitmap" representing an image and its mapping parameters and values. AssetProperty offers new methods to provide the ability to modify, add or delete the asset connected to a property:

Validation

Inputs to change the value of asset properties are validated against the requirements of the associated schema.

The new methods:

identify if the input value is a valid value that can be set to the given asset property.

The new method:

identifies whether the AssetProperty can currently be edited.

Schemas & Property Names

Appearance asset properties are aligned with specific schemas. Each schema contains necessary properties which define how the appearance of the material will be generated. There are 14 standard material schemas:

In addition, there are 5 schemas representing "advanced" materials – these may be encountered as a result of import from other Autodesk products:

Finally, there are 10 schemas used for the aspects of the connected assets:

The new method:

identifies if the input name is a valid name for a supported schema.

To assist in creating code accessing and manipulating the properties of a given schema, predefined properties have been introduced to allow a compile-time reference to a property name without requiring you to transcribe it as a string in your code. These predefined property names are available in static classes named similar to the schema names, above, e.g. Autodesk.Revit.DB.Visual.Ceramic.

Utilities

The new method:

returns a list of assets available to the session.

The new method:

creates a copy of an appearance asset element and the asset contained by it.

The new operator:

accesses a particular AssetProperty associated to the given asset.

Geometry API additions

Surface API additions

Two new methods allow projecting a point onto a surface:

Curve API additions

The new class:

captures the results of computation of closest points between two generic curves.

It has the following properties:

The new Curve method:

outputs a list of closest points between two generic curves using ClosestPointsPairBetweenTwoCurves.

BrowserOrganization API additions

The new enumerated value:

corresponds to the type of the browser organization definition for schedules.

The new method:

gets the BrowserOrganization that applies to the Schedules section of the project browser.

IFC additions

The new functions:

allow for passing in arbitrary options for custom IFC importers. Users can pass in a string to string map specifying extra data they wish to pass for IFC import.

Rebar API additions

BarTypeDiameterOptions

The new options class:

allows creation of a new set of diameter values for a RebarBarType. It can be used when copying the diameter information as a bulk of data from one RebarBarType to another.

The diameter options can be set for a RebarBarType with the new method:

which sets all input diameters from the input BarTypeDiameterOptions in the current RebarBarType.

GetDistributionPath()

The new method:

gets the distribution path currently stored in the rebar.

For a free form rebar set the distance between two consecutive bars may be different if it is calculated between different points on bars. The distribution path is an array of curves with the property that based on these curves the set was calculated to respect the layout rule and number of bars or spacing.

RebarUpdateCurvesData

Several new properties have been added to Autodesk.Revit.DB.Structure.RebarUpdateCurvesData:

Major Additions to the Revit 2018.2 API

Fabrication API additions

New APIs have been added to change the service or size of a selection of fabrication parts.

FabricationNetworkChangeService

The new class:

exposes the ability to change the service or size of a selection of fabrication parts.

It has the following methods:

FabricationNetworkChangeServiceResult

The new enum:

provides a result status from applying changes to the service or size of fabrication parts.

It has the following values:

FabricationPartSizeMap

The new class:

represents the fabrication part size map for straights. This class allows is an input to several functions of FabricationNetworkServiceChange, and allows multiple straights of different sizes to be changed at once.

It has the following properties:

Other API additions

RevitLinkType API addition

The new method:

returns the LinkedFileStatus enum value indicating the link's load status (loaded, unloaded, missing, etc.). This function returns the same value as ExternalFileReference.GetLinkedFileStatus() but can be called on Collaboration for Revit links.