The Revit 2022.1 API was recently released and includes some important enhancements addressing new Revit product functionality and developer wishes and requests:
- Information sources
- What's new in previous versions
- Diff to the Revit 2022 SDK
- API Additions to the Revit 2022.1 API
- 4.1 View API additions
- 4.1.1. Duplicating Sheets
- 4.2. Schedule API additions
- 4.2.1. Schedule heights on sheets
- 4.2.2. Managing schedule segments
- 4.3. Worksharing API additions
- 4.3.1. Delete Workset API
- 4.4. Import and Export API additions
- 4.4.1. AXM Import
- 4.4.2. OBJ & STL import/export
Information Sources
The information below is based on the contents of the Revit Platform API Changes and Additions.docx document included with the Revit 2022 SDK, the software developers kit available from the Revit Developer Centre.
It is also provided in the section on What's New in the Revit 2022.1 API help file RevitAPI.chm
included with the SDK:
For convenient, easy, and effective web searching, this blog post provides a cleaned-up online HTML version of that information with numbering and table of contents added, as well as the following PDF printout of the original document included in the SDK:
The What's New section and the Changes and Additions document provide important information, both for discovering and exploring the newly added API functionality and for later reference.
If you encounter any issues migrating your existing add-ins between different versions, this is one of the first places to look.
For detailed information on all other aspects of the Revit API, please refer to the rest of the API documentation and samples provided in the SDK.
The most important things to install and always keep at hand are:
- The Revit API help file
RevitAPI.chm
- The Visual Studio solution containing all the SDK samples,
Samples\SDKSamples.sln
You will regularly need both for research on how to solve specific Revit API programming tasks.
More in-depth official explanations and background information is provided by the online Revit API Developers Guide included in the Revit 2022 online help.
What's New in Previous Versions
Here are links to previous discussions of What's New in the Revit API:
- What's New in the Revit 2010 API
- What's New in the Revit 2011 API
- What's New in the Revit 2012 API
- What's New in the Revit 2013 API
- What's New in the Revit 2014 API
- What's New in the Revit 2015 API
- What's New in the Revit 2016 API
- What's New in the Revit 2017 API
- What's New in the Revit 2017.1 API
- What's New in the Revit 2018 API
- Revit 2018.1 and the Visual Materials API
- Revit 2018.1.1 and 2018.1 API Docs Online
- Revit 2018.1 Visual Materials API
- What's New in the Revit 2018.2 API
- What's New in the Revit 2019 API
- What's New in the Revit 2020 API
- What's New in the Revit 2020.1 API
- What's New in the Revit 2021 API
- What's New in the Revit 2021.1 API
- What's New in the Revit 2022 API
Diff to the Revit 2022 SDK
I performed a quick diff between this update release and the original Revit 2022 SDK and found no significant differences at all.
Presumably unintentionally, numerous obj
intermediate compilation results were included in the SDK release, so
my first diff was large, 155 KB.
Disregarding the obj
files, however, I end up with only these differences:
-- Revit 2022 : Revit 2022.1 -- includes right-only and differing files: .\getting started with the revit api.docx (Revit 2022.1 is more recent) .\read me first.doc (Revit 2022.1 is more recent) .\revit platform api changes and additions.docx (Revit 2022.1 is more recent) .\revitaddinutility.chm (Revit 2022.1 is more recent) .\revitapi.chm (Revit 2022.1 is more recent) .\add-in manager\autodesk.addinmanager.command.dll (Revit 2022.1 is more recent) .\samples\samplescontent.htm (Revit 2022.1 is more recent) .\samples\samplesindex.htm (Revit 2022.1 is more recent) .\samples\cloudapisample\cs\readme_cloudapisample.rtf (Revit 2022 is more recent) -- 9 files listed
4.1. View API additions
4.1.1. Duplicating Sheets
The new enum:
- SheetDuplicateOption
allows you to indicate what information should be copied when duplicating a sheet. Its values are:
- DuplicateEmptySheet – Only copies the title block.
- DuplicateSheetWithDetailing – Copies the title block and details.
- DuplicateSheetWithViewsOnly – Copies the title block, details, viewports and contained views. The newly created sheet will reference the newly duplicated views.
- DuplicateSheetWithViewsAndDetailing – Copies the title block, details, and viewports. Duplicates the sheet's contained views with detailing. The newly created sheet will reference the newly duplicated views.
- DuplicateSheetWithViewsAsDependent – Copies the title block, details, and viewports. Duplicates the sheet's contained views as dependent. The newly created sheet will reference the newly duplicated dependent views.
The new methods:
- ViewSheet.Duplicate(SheetDuplicateOption)
- ViewSheet.CanBeDuplicated(SheetDuplicateOption)
allow you to duplicate sheets and identify sheets which can be duplicated.
4.2. Schedule API additions
4.2.1. Schedule heights on sheets
The new class:
- Autodesk.Revit.DB.ScheduleHeightsOnSheet
returns the heights of schedule title, column header and each body row on sheet view.
The new method:
- ViewSchedule.GetScheduleHeightsOnSheet()
will return the heights object.
4.2.2. Managing schedule segments
The new methods:- ViewSchedule.IsSplit()
- ViewSchedule.Split(int segmentNumber)
- ViewSchedule.Split(IList<double> segmentHeights)
- ViewSchedule.SplitSegment()
- ViewSchedule.DeleteSegment()
- ViewSchedule.MergeSegments()
- ViewSchedule.GetSegmentCount()
- ViewSchedule.GetSegmentHeight()
- ViewSchedule.SetSegmentHeight()
provide the ability to split schedules and manage schedule segments.
The new method:
- ViewSchedule.GetScheduleInstances()
will return the schedule sheet instances for a schedule segment.
The new methods:
- ScheduleSheetInstance.SegmentIndex
- ScheduleSheetInstance.Create(Document document, ElementId viewSheetId, ElementId scheduleId, XYZ origin, int segmentIndex)
provide the ability to place a schedule segment on sheet and to get and set the schedule segment instance's segment index.
4.3. Worksharing API additions
4.3.1. Delete Workset API
The new method:
- WorksetTable.DeleteWorkset()
supports deleting of worksets from the model. It takes a DeleteWorksetSettings input with options for what to do with elements contained by that workset.
4.4. Import and Export API additions
4.4.1. AXM Import
The new class:
- Autodesk.Revit.DB.AXMImportOptions
allows user to determine the import options when importing an AXM file.
The new method:
- Document.Import(String, AXMImportOptions, View)
imports an AXM file into the document.
The new method:
- OptionalFunctionalityUtils.IsAXMImportLinkAvailable()
checks if the Import FormIt function is available.
4.4.2. OBJ & STL import/export
The new method:
- Document.Export(String, String, OBJExportOptions)
supports export of Revit geometry to OBJ format. It uses a new class containing the options available for export:
- OBJExportOptions.TargetUnit
- OBJExportOptions.SurfaceTolerance
- OBJExportOptions.NormalTolerance
- OBJExportOptions.MaxEdgeLength
- OBJExportOptions.GridAspectRatio
- OBJExportOptions.SetTessellationSettings()
The new methods:
- Document.Import(String, OBJImportOptions, View)
- Document.Import(String, STLImportOptions, View)
provide support for importing files of STL and OBJ formats. These methods use new classes representing the options for each of the new formats.
The new property:
- BaseImportOptions.DefaultLengthUnit
supports specification of a default length unit to use during import of unitless STL and OBJ files.