API Changes 2016


Major changes and renovations to the Revit API


API additions

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

  • GlobalParametersManager

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

  • AreGlobalParametersAllowed() - Tests whether global parameters are allowed in a document.
  • GetAllGlobalParameters() - Returns all global parameters in a document.
  • FindByName() - Find a global parameter by its name.
  • IsUniqueName() - Test uniqueness of the name of a prospective global parameter.
  • IsValidGlobalParameter() - Test if an Id is of a valid global parameter element.

The new class:

  • GlobalParameter

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

  • [static] Create() - Creates a new Global Parameter in the given document.
  • GetAffectedElements() - Returns all elements of which properties are driven by this global parameter.
  • GetAffectedGlobalParameters() - Returns all other global parameters which refer to this global parameter in their formulas.
  • GetLabeledDimensions() - Returns all dimension elements that are currently labeled by this global parameter.
  • CanLabelDimension() - Tests whether a dimension can be labeled by the global parameter.
  • LabelDimension() - Labels a dimension with this global parameter.
  • UnlabelDimension() - Un-labels a dimension that is currently labeled by this global parameter.
  • GetLabelName() - Returns the name of this parameter's label, which is used to label dimension elements.
  • SetDrivingDimension() - Set a dimension to drive the value of this parameter.
  • IsValidFormula() - Tests that the given expression is a valid as formula for this parameter.
  • GetFormula() - Returns the parameter's expression in form of a string.
  • SetFormula() - Sets a formula expression for this parameter.
  • GetValue() - Obtains the current value of the global parameter.
  • SetValue() - Sets a new value of the global parameter.
  • HasValidTypeForReporting() - Tests that the global parameter has data of a type that supports reporting.
  • [static] IsValidDataType() - Tests whether the input Data Type is valid as a type of a global parameter.
  • IsDrivenByDimension - Indicates whether this parameter is driven by a dimension or not.
  • IsDrivenByFormula - Indicates whether this parameter is driven by a formula or not.
  • IsReporting - Indicates whether this is a reporting global parameter or not.

The new class:

  • ParameterValue

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:

  • IntegerParameterValue
  • DoubleParameterValue
  • StringParameterValue
  • ElementIdParameterValue
  • NullParameterValue

All the derived classes have only one property:

  • Value - gets or sets the value as the corresponding type.

New methods added the the Parameter class:

  • CanBeAssociatedWithGlobalParameter() - Tests whether a parameter can be associated with the given global parameter.
  • CanBeAssociatedWithGlobalParameters() - Tests whether a parameter can be associated with any global parameter.
  • AssociateWithGlobalParameter() - Associates a parameter with a global parameter in the same document.
  • DissociateFromGlobalParameter() - Dissociates a parameter from a global parameter.
  • GetAssociatedGlobalParameter() - Returns a global parameter, if any, currently associated with a parameter.

Multiline Text parameter support

The new enumerated value:

  • ParameterType.MultilineText

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

View API additions

TemporaryViewModes

The new class:

  • TemporaryViewModes

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

  • View.TemporaryViewModes

The class has the following methods and properties:

  • TemporaryViewModes.DeactivateAllModes() - Deactivates all temporary modes that are currently active.
  • TemporaryViewModes.DeactivateMode() - Deactivates the given temporary mode.
  • TemporaryViewModes.GetCaption() - A text caption to use for the given mode.
  • TemporaryViewModes.IsModeActive() - Tests whether a given mode is currently active or not.
  • TemporaryViewModes.IsModeAvailable() - Tests whether a temporary view mode is currently available in the associated view.
  • TemporaryViewModes.IsModeEnabled() - Tests whether a temporary view mode is currently enabled in the associated view.
  • TemporaryViewModes.IsValidState() - Tests whether the given state is valid for the associated view and the context the view is currently in.
  • TemporaryViewModes.PreviewFamilyVisibility - The current state of the PreviewFamilyVisibility mode in the associated view.
  • TemporaryViewModes.RevealConstraints - The current state of the RevealConstraints mode in the associated view.
  • TemporaryViewModes.RevealHiddenElements - The current state of the RevealHiddenElements mode in the associated view.
  • TemporaryViewModes.WorskaringDisplay - The current state of the WorksharingDisplay mode in the associated view.

Convert dependent view to independent

The new function:

  • View.ConvertToIndependent()

converts a dependent view to be independent.

Plan view underlay

The new methods:

  • ViewPlan.GetUnderlayBaseLevel()
  • ViewPlan.GetUnderlayTopLevel()
  • ViewPlan.SetUnderlayBaseLevel()
  • ViewPlan.SetUnderlayOrientation()
  • ViewPlan.SetUnderlayOrientation()

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

MEP 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:

  • FabricationPart.ProductListEntry - The product list entry index of the fabrication part. A value of -1 indicates the fabrication part is not a product list.
  • FabricationPart.IsProductList()
  • FabricationPart.GetProductListEntryName()
  • FabricationPart.GetProductListEntryCount()
  • FabricationPart.IsProductListEntryCompatibleSize() -  Checks to see if this part can be changed to the specified product list entry without altering any connected dimensions.

MEP Fabrication API

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

  • FabricationPart.ServiceId
  • FabricationPart.RotateConnectedPartByConnector()
  • FabricationPart.RotateConnectedTap()
  • FabricationServiceButton.ContainsFabricationPartType()

Electrical API additions

The new method:

  • Wire.GetMEPSystems()

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

The new property

  • ElectricalSetting.CircuitRating

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

Revit Link API additions

Link instance locations

The new function:

  • RevitLinkInstance.MoveBasePointToHostBasePoint()

will move a RevitLinkInstance so that the link's base point and host project's base point are in the same location. This function does not set up a monitoring relationship.

The new method:

  • RevitLinkInstance.MoveOriginToHostOrigin()

moves this link instance so that the internal origin of the linked document is aligned to the internal origin of the host document. This is a one-time movement and does not set up any shared coordinates relationship.

Local unload of Revit Links

The new method:

  • RevitLinkType.UnloadLocally()

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:

  • ISaveSharedCoordinatesCallbackForUnloadLocally

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:

  • RevitLinkType.RevertLocalUnloadStatus()

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.