Major Changes and Renovations To The Revit API
Major Changes and Renovations To The Revit API
Major Changes and Renovations To The Revit API
Table of Contents
1. API changes...................................................................................................................................................3
1.1. .NET 4.7 ................................................................................................................................................3
1.2. View Filters support OR operators and nesting ......................................................................................3
1.2.1. ParameterFilterElement API changes................................................................................................3
1.2.2. ElementLogicalFilter API addition .....................................................................................................4
1.3. View.ViewName deprecated .................................................................................................................4
1.4. UI API changes......................................................................................................................................4
1.4.1. Main window handle access .............................................................................................................4
1.4.2. Changes to PostableCommand enumeration ....................................................................................5
1.5. Existing APIs now support open from cloud paths (Collaboration for Revit)< ..........................................5
1.5.1. Document Open APIs support cloud paths........................................................................................5
1.5.2. Callback for conflict cases when opening from a cloud path..............................................................5
1.6. BasicFileInfo changes ............................................................................................................................6
1.7. Asset-related API members deprecated .................................................................................................6
1.8. Double Pattern Support ........................................................................................................................7
1.8.1. Material API support for double patterns .........................................................................................7
1.8.2. Support for overriding double patterns ............................................................................................7
1.8.3. Support for double patterns for FilledRegion ....................................................................................8
1.9. Document.Title consistency...................................................................................................................8
1.10. View printing & exporting - activation events behavioral change ...........................................................9
1.11. Structural API change ...........................................................................................................................9
1.12. Rebar API changes ................................................................................................................................9
1.13. MEP API changes ..................................................................................................................................9
1.14. ProjectLocation changes ..................................................................................................................... 10
1.15. Building Site export removed .............................................................................................................. 10
1.16. Obsolete API removal.......................................................................................................................... 10
• ParameterFilterElement.UsesConjunctionOfFilterRules()
can be used to check if a ParameterFilterElement uses a conjunction of filter rules (without any logical OR
operations), as was always the case before Revit release 2019. This function is also deprecated, as are
all functions related to the use of FilterRules in ParameterFilterElement.
• ParameterFilterElement.ElementFilterIsAcceptableForParameterFilterElement()
can be used to check if an ElementFilter is suitable to be used for a view filter (it consists only of logical
filters joining ElementParameterFilters in combination).
• ElementLogicalFilter.GetFilters()
returns the set of ElementFilters that are combined by the given ElementLogicalFilter. This is useful to
read the contents of an ElementFilter obtained from a ParameterFilterElement.
• DB.View.ViewName
has been deprecated. It was a duplication of Element.Name and this property should be used in its place.
• Autodesk.Revit.UI.UIApplication.MainWindowHandle
• Autodesk.Revit.UI.UIControlledApplication.MainWindowHandle
This handle should be used when displaying modal dialogs and message windows to insure that they are
properly parented. Use these properties instead of
System.Diagnostics.Process.GetCurrentProcess().MainWindowHandle, which is no longer a reliable
method for retrieving the main window handle starting with Revit 2019.
now offer the ability to open a C4R model from its location on the cloud. Obtain a relevant ModelPath
representing the document from:
• ModelPathUtils.ConvertCloudGUIDsToCloudPath(Guid, Guid)
by inputting the the project Guid and model Guid (which could be obtained from various Forge APIs).
1.5.2. Callback for conflict cases when opening from a cloud path
The callback method:
• Autodesk.Revit.DB.IOpenFromCloudCallback.OnOpenConflict()
can be passed to the document open methods to gain to handle conflict cases. The method is passed an
OpenConflictScenario value identifying the reason for the conflict ( Rollback, Relinquished or OutOfDate)
and should return an OpenConflictResult with the desired response (keep local changes, discard local
changes and open the latest version or cancel).
• DefaultOpenFromCloudCallback
provides a default way to handle conflicts: it always discards the local change and gets the latest version
from the cloud.
• BasicFileInfo.Extract()
from a version of Revit prior to Revit 2019 will result in an exception if it is called on a Revit 2019 or later
file. The class and method documentation has been clarified to reflect this posssibility that may occur
again in the future.
Deprecated Replacement/new
Notes
property property
The new property contains only the file format indicator
(the major release version such as "2019") used for saving
SavedInVersion Format the file. No build information or product information is
included in this string, making it easier to use for
comparisons or messaging.
Calling BasicFileInfo.Extract() from Revit 2019 on any Revit file version should work as expected. Both
SavedInVersion and Format should be populated for old and new files.
FilledRegionType.ForegroundPatternId
FilledRegionType.FillPatternId
FilledRegionType.BackgroundPatternId
• Document.Title
honored the Windows user setting requiring dlsplay of file extensions. The property has been changed to
consistently return a title with no extension.
1.10. View printing & exporting - activation events
behavioral change
Because of an improvement to Revit processing, views will no longer be activated prior to being printed or
exported. This means that the ViewActivating and ViewActivated events are no longer triggered as each
view is printed or exported from a set.
• Autodesk.Revit.DB.Structure.Rebar.GetShapeId()
now throws an exception if the rebar is a free-form which has multiple shapes (ie. its
WorkshopInstructions type is Bent.)
• BuildingSiteExportOptions
• Document.Export(String,String,View3D, ViewPlan, BuildingSiteExportOptions)
Classes
Methods
• Autodesk.Revit.Creation.Document.NewElectricalSystem(Autodesk.Revit.DB.Connector,
Autodesk.Revit.DB.Electrical.ElectricalSystemType)
• Autodesk.Revit.Creation.Document.NewElectricalSystem(System.Collections.Generic.ICollection
<Autodesk.Revit.DB.ElementId>, Autodesk.Revit.DB.Electrical.ElectricalSystemType)
• Autodesk.Revit.DB.Structure.Rebar.ComputeDrivingCurves()
• Autodesk.Revit.DB.Structure.Rebar.GetBarPositionTransform()
• Autodesk.Revit.DB.Structure.Rebar.GetDistributionPath()
• Autodesk.Revit.DB.Structure.Rebar.ScaleToBox()
• Autodesk.Revit.DB.Structure.Rebar.ScaleToBoxFor3D()
• Autodesk.Revit.DB.Structure.Rebar.SetLayoutAsFixedNumber()
• Autodesk.Revit.DB.Structure.Rebar.SetLayoutAsMaximumSpacing()
• Autodesk.Revit.DB.Structure.Rebar.SetLayoutAsMinimumClearSpacing()
• Autodesk.Revit.DB.Structure.Rebar.SetLayoutAsNumberWithSpacing()
• Autodesk.Revit.DB.Structure.Rebar.SetLayoutAsSingle()
• Autodesk.Revit.DB.Plumbing.PipeSettings.GetPressLossCalculationServerInfo()
• Autodesk.Revit.DB.Plumbing.PipeSettings.SetPressLossCalculationServerInfo()
• Autodesk.Revit.DB.ExternalResourceBrowserData.IsValidResouceName()
Properties
• Autodesk.Revit.DB.Structure.Rebar.ArrayLength
• Autodesk.Revit.DB.Structure.Rebar.BarsOnNormalSide
• Autodesk.Revit.DB.Structure.Rebar.BaseFinishingTurns
• Autodesk.Revit.DB.Structure.Rebar.Height
• Autodesk.Revit.DB.Structure.Rebar.MultiplanarDepth
• Autodesk.Revit.DB.Structure.Rebar.Normal
• Autodesk.Revit.DB.Structure.Rebar.Pitch
• Autodesk.Revit.DB.Structure.Rebar.RebarShapeId
• Autodesk.Revit.DB.Structure.Rebar.TopFinishingTurns
• Autodesk.Revit.DB.ProjectLocation.ProjectPosition
• Autodesk.Revit.DB.ProjectLocation.SitePosition
2. API additions
2.1. Material API additions
2.1.1. Editing the properties of an Appearance Asset
New Revit API capabilties 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
• Autodesk.Revit.DB.Visual.AppearanceAssetEditScope
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).
• AppearanceAssetEditScope.Start() – Starts the edit scope for the asset contained in a particular
AppearanceAssetElement. The editable Asset is returned from this method.
• AppearanceAssetEditScope.Commit() – Finishes the edit scope: all changes made during the edit
scope will be committed. Provides an option to forces the update of all open views.
• AppearanceAssetEditScope.Cancel() – Cancels the edit scope and discards any changes.
• AssetPropertyString.Value
• AssetPropertyBoolean.Value
• AssetPropertyInteger.Value
• AssetPropertyDouble.Value
• AssetPropertyFloat.Value
• AssetPropertyEnum.Value
• AssetPropertyDistance.Value
In addition, the following new methods have been added to support modification of property values:
• AssetPropertyDoubleArray3d.SetValueAsXYZ()
• AssetPropertyDoubleArray4d.SetValueAsDoubles()
• AssetPropertyDoubleArray4d.SetValueAsColor()
AssetPropertyList now has new methods to allow changes to the members of the list:
• AssetPropertyList.AddNewAssetPropertyDouble()
• AssetPropertyList.InsertNewAssetPropertyDouble()
• AssetPropertyList.AddNewAssetAsColor()
• AssetPropertyList.InsertNewAssetAsColor()
• AssetPropertyList.AddNewAssetPropertyInteger()
• AssetPropertyList.InsertNewAssetPropertyInteger()
• AssetPropertyList.RemoveAssetProperty()
2.1.4. Validation
Inputs to change the value of asset properties are validated against the requirements of the associated
schema.
• AssetPropertyString.IsValidValue(String)
• AssetPropertyInteger.IsValidValue (int)
• AssetPropertyEnum.IsValidValue (int)
• AssetPropertyDouble.IsValidValue (double)
• AssetPropertyFloat.IsValidValue (float)
• AssetPropertyDistance.IsValidValue (double)
• AssetPropertyDoubleArray3d.IsValidValue (XYZ)
• AssetPropertyDoubleArray4d.IsValidValue (IList<double>)
• AssetPropertyDoubleArray4d.IsValidValue (Color)
identify if the input value is a valid value that can be set to the given asset property.
The new method:
• AssetProperty.IsEditable()
• Ceramic
• Concrete
• Generic
• Glazing
• Hardwood
• MasonryCMU
• Metal
• MetallicPaint
• Mirror
• PlasticVinyl
• SolidGlass
• Stone
• WallPaint
• Water
In addition, there are 5 schemas representing "advanced" materials - these may be encountered as a
result of import from other Autodesk products:
• AdvancedLayered
• AdvancedMetal
• AdvancedOpaque
• AdvancedTransparent
• AdvancedWood
Finally, there are 10 schemas used for the aspects of the connected assets:
• BumpMap
• Checker
• Gradient
• Marble
• Noise
• Speckle
• Tile
• UnifiedBitmap
• Wave
• Wood
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.
2.1.6. Utilities
The new method:
• Application.GetAssets(AssetType)
• AppearanceAssetElement.Duplicate()
creates a copy of an appearance asset element and the asset contained by it.
• Asset.operator[ ]
• RailingType.RailStructure
provide access to a collection of the information about non-continuous rails that are part of a RailingType.
The Autodesk.Revit.DB.Architecture.NonContinuousRailStructure object returns contains a collection of
Autodesk.Revit.DB.Architecture.NonContinuousRailInfo objects, each of which represents the properties
needed to define a single non-continuous rail.
• RailingType.BalusterPlacement
provides access to the baluster and post placement information for a given railing type. The
Autodesk.Revit.DB.Architecture.BalusterPlacement object returned may contain instances of:
• Element.GetDependentElements()
returns a list of ids of elements which are "children" of this element; that is, those elements which will be
deleted along with this element. The method optionally takes an ElementFilter which can be used to
reduce the output list to the collection of elements matching specific criteria.
• Dimension.AreReferencesAvailable
always returns true for dimensions which are not view-specific. It can return false for view-specific
dimensions that can lose their references in certain situations. For example, the host element references
may not be available when the view containing the dimension is closed. In general, if the host element
view-specific geometry is not available, dimensions that reference that geometry will not be able to
resolve their references.
• Dimension.IsValid
always returns true for dimensions which are not view-specific. It can return false for view-specific
dimensions that are hidden because they are in an invalid state. An example of an invalid state is having
misaligned references for generation of an aligned dimension.
• Autodesk.Revit.DB.TextNoteOptions.VerticalAlignment
allows you to specify the vertical alignment for a new text note created by TextNote.Create().
2.6. BrowserOrganization API additions
The new enumerated value:
• BrowserOrganizationType.Schedules
• BrowserOrganization.GetCurrentBrowserOrganizationForSchedules()
gets the BrowserOrganization that applies to the Schedules section of the project browser.
• BarTypeDiameterOptions
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:
• Autodesk.Revit.DB.Structure.RebarBarType.SetBarTypeDiameters()
which sets all input diameters from the input BarTypeDiameterOptions in the current RebarBarType.
2.7.2. GetDistributionPath()
The new method:
• Autodesk.Revit.DB.Structure.RebarHandlePositionData.GetDistributionPath()
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.
2.7.3. RebarUpdateCurvesData
Several new properties have been added to RebarUpdateCurvesData:
• Autodesk.Revit.DB.Structure.RebarUpdateCurvesData.HostMirrored - If true, then host of the
rebar was mirrored (along with the rebar) before the most recent regeneration.
• Autodesk.Revit.DB.Structure.RebarUpdateCurvesData.IsReversed - Used to store the state of
the bar referring to the direction of the bars. This is useful when using face intersection to
calculate bars. After mirroring, curves created from intersecting faces may be reversed, so we
use this to store the state and keep the rebar pointing in the correct direction.
• Autodesk.Revit.DB.Structure.RebarUpdateCurvesData.ErrorMessage - The reason for calculation
failure. If the calculation fails, this message will be shown in an error, or warning if we are editing
the constraints.
2.7.4. RebarShapes
Two new methods in the Rebar class check or get associated RebarShape objects:
is used to attach steel fabrication information to various Revit elements. Elements which can have
fabrication information include:
• SteelElementProperties.GetSteelElementProperties()
• SteelElementProperties.UniqueID
which is the id of the object in fabrication terms, and can be used to determine the Steel Core element
corresponding to this Revit element, for use with the Advance Steel API.
You can also look up the id about a Revit element using the static method:
• SteelElementProperties.GetFabricationUniqueID()
For Revit elements which do not currently have a fabrication link, it can be added using:
• SteelElementProperties.AddFabricationInformationForRevitElements()
If you have a fabrication id, you can lookup the corresponding Revit element using:
• SteelElementProperties.GetReference()
The methods:
• StructuralConnectionHandlerType.AddElementsToCustomConnection()
• StructuralConnectionHandlerType.RemoveMainSubelementsFromCustomConnection()
provide support for adding or removing steel connection elements in a custom connection.
• StructuralConnectionHandler.IsCustom
• StructuralConnectionHandlerType.IsCustom
• StructuralConnectionHandlerType.IsDetailed
provide read access to information about the structural connection handler elements.
• MEPCurveType.Shape
returns the shape of the profile for the MEP curve type.
• MechanicalEquipmentSet.Create()
• MechanicalEquipmentSet.GetMembers()
• MechanicalEquipmentSet.Add()
• MechanicalEquipmentSet.Remove()
• MechanicalEquipmentSet.AreValidMembers()
• MechanicalEquipmentSet.AreElementsNotConnectedInSeries()
• MechanicalEquipmentSet.Classification
• MechanicalEquipmentSet.OnDuty
• MechanicalEquipmentSet.OnStandby
• MechanicalEquipmentSetType.Create()
• PipingSystem.GetPumpSets()
gets the set of element ids of pump sets associated with this system.
• PipingSystem.CreateHydraulicSeparation()
• PipingSystem.DeleteHydraulicSeparation()
• PipingSystem.IsHydraulicLoopBoundary()
• PipingSystem.CanBeHydraulicLoopBoundary()
support creation, deletion, and validation of members of a hydraulically separated system. Separated
systems will have their own associated system elements from which you can read and modify the
members after creation.
• FabricationPart.SaveAsFabricationJob()
writes a fabrication job to disk in the MAJ file format. The exported file will contain the fabrication parts
included in the input. It takes an options class, FabricationSaveJobOptions, allowing for the possibility of
including holes branches meet the main straight.
2.10.2. API for load and unload of one-off fabrication parts from loose
item files
The new class:
• Autodesk.Revit.DB.FabricationItemFile
contains information about one-off items that can be loaded into a fabrication configuration.
• Autodesk.Revit.DB.FabricationItemFolder
• FabricationConfiguration.LoadItemFiles()
• FabricationConfiguration.UnloadItemFiles()
• FabricationConfiguration.GetAllLoadedItemFiles()
• FabricationConfiguration.GetAllUsedItemFiles()
• FabricationConfiguration.CanUnloadItemFiles()
• FabricationConfiguration.AreItemFilesLoaded()
• FabricationConfiguration.GetItemFolders()
allow control over the loading and unloading of item files into the configuration.
• Autodesk.Revit.DB.FabricationVersionInfo
gives the information about differerent versions of fabrication data, including the reason why the data was
changed.
• FabricationPart.GetVersionHistory()
returns a list of FabricationVersionInfo classes that describe the history of the changes made to the part.
The most recent changes are first in the list.
gives information about a part that was swapped out during reload.
• ConfigurationReloadInfo.OutOfDatePartCount
• ConfigurationReloadInfo.GetOutOfDatePartStatus()
identify the parts that had newer versions found during a reload and which Revit attempted to swap out.
• FabricationPart.CenterlineLength
• AnalysisDisplayColoredSurfaceSettings.Transparency
allows for the use of transparency in the display of the colored surface.
• IFCImportOptions.GetExtraOptions()
• IFCImportOptions.SetExtraOptions()
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.
• RevitLinkType.GetPhaseMap()
allows users to read the Phase Map parameter for the link. The phase map is a correspondence between
phases in the host document and phases in the linked document, and is used by room calculations. Note
that the link must be loaded to read the phase map.
2.14. Export Additions
The new property:
• DWFExportOptions.ExportOnlyViewId
indicates that only the specified view should be exported when creating a DWF export.
• Autodesk.Revit.ApplicationServices.Application.CurrentUsersDataFolderPath
• Autodesk.Revit.ApplicationServices.Application.CurrentUsersAddinsDataFolderPath
provide access to the data folder and add-in data folder for the current Revit version and current user.
• TopographySurface.ArePointsEditable
identifies whether the points of this TopographySurface can be edited independently. This property is
used to check validity for several TopographySurface editing methods.
• BeforeExecutedEventArgs.Cancel
is now permitted to be set to true. This allows the callback to cancel the execution of the impending
command. This can be useful if an add-in wishes to selectively allow the command to proceed based on
interactions which take place in this callback. The property should also report the cancellation status if it
has been canceled by a different subscriber.