Revit 2022.1 SDK, RevitLookup Build and Install

Exciting news with a lot of changes to RevitLookup and The Building Coder samples:

Revit 2022.1 SDK Released

The Revit 2022.1 SDK has been released in the Revit Developer Center.

The initial Revit 2022 SDK dates from April 12, 2021.

The updated Revit 2022.1 SDK was released on October 28, 2021.

It includes important enhancements addressing new Revit product functionality and developer wishes and requests. A list of what's new is provided in the SDK documentation in the What's New section and the Changes and Additions document. I'll put that information online for easier searching and finding asap.

WallCrossSection vs. WallCrossSectionDefinition

The Revit 2022.1 unfortunately introduced a breaking change:

WallCrossSection was renamed to WallCrossSectionDefinition

The Revit team is working on a knowledge base article to document this and provide a recommendation on how to handle it.

The issue was brought to our attention by @ricaun, Luiz Henrique Cassettari, in his Revit API discussion forum thread on RevitApi 2022 update change WallCrossSection to WallCrossSectionDefinition:

Question: I was messing with GroupTypeId and found something interesting and a little worrying.

On my computer, I have the Revit 2022 first release.

My plugin application uses the NuGet package Revit_All_Main_Versions_API_x64, and I usually use the last version:

The GroupTypeId property WallCrossSection changed to WallCrossSectionDefinition in the Revit 2022.1 update.

If I use the old property, it will throw an exception on the new version.

I use the new one, the first Revit 2022 release will break.

I will probably never use this ForgeTypeId, but I worry that other things could change in this update.

Should I be worried about my application breaking each time a new Hotfix is released?

Answer: Very sorry about this mishap!

No, you should not need to worry about that; this is an exceptional case and an error in the update release.

Thank you very much for pointing it out!

This launched a significant discussion in the development team.

First of all, it did indeed happen as you noted.

Secondly, it should not have happened.

They are discussing both how to handle this specific issue and how to prevent anything similar from occurring in the future.

The simple workaround for the moment is to use the integer value of the enum to cover both 2022.0 and 2022.1.

They discussed reverting back again in future updates, but that would cause even more disruption.

They discussed defining both enumerations with the same underlying integer values.

For the moment, just using the underlying integers is the safest way to go, I guess:

  // BuiltInParameterGroup.PG_WALL_CROSS_SECTION_DEFINITION; // -5000228,
  // BuiltInParameterGroup.PG_WALL_CROSS_SECTION; // -5000228,
  var PG_WALL_CROSS_SECTION = (BuiltInParameterGroup) (-5000228);

RevitLookup Build and Install

Moving on to more positive news, we were blessed last week with a very exciting contribution to create a modeless version of RevitLookup.

This rapid evolution continues with an untiring stint of contributions from Roman @Nice3point and his extensive series of pull requests:

As a result, RevitLookup now boasts a modern up-to-date build system, a multi-version installer, a separate GitHub developer branch dev, and many other enhancements:

RevitLookup installer

Here are some of Roman's explanations from our pull request conversations:

  optionsBtn.AddPushButton(
    new PushButtonData(" HelloWorld "," Hello World ... ", 
      ExecutingAssemblyPath, typeof (HelloWorld) .FullName));

It can now be written like this:

  optionsBtn.AddPushButton(typeof (HelloWorld),
    " HelloWorld "," Hello World ... ");

The latest versions of the C# language allow you to write like this:

  MApp.DocumentClosed += m_app_DocumentClosed;

instead of

  m_app.DocumentClosed 
    += new EventHandler<Autodesk.Revit.DB.Events.DocumentClosedEventArgs>(
      m_app_DocumentClosed);

Ever so many thanks to Roman for all his inspired work moving this tool forward and especially his untiring efforts supporting me getting to grips with the new technology!

Bye-Bye Lookup Builds

Until now, you could download the most recent build of RevitLookup from lookupbuilds.com, provided by Build Informed, implemented back in 2017 and diligently maintained ever since by Peter Hirn.

The new build system broke that and replaces it, as discussed in the issue #103 – Gitlab pipeline broken.

Ever so many thanks once again to Peter for all his work setting up and supporting lookupbuilds over the past years!

The Building Coder Samples Revamped

As if all the above were not enough, Roman also went ahead and revamped The Building Coder samples, submitting pull request #18 – Refactoring:

Same as for RevitLookup. I did not add a build system, there is only one command in the project that displays a small dialog box. Switched msbuild to Net SDK, now the .csproj file contains much fewer lines. Added automatic copying of dll and addin to Revit addins folder. Some variables cannot be renamed as it causes conflicts, manual renaming will take too long, left as is. There are some unoptimized sections left in the project, but their fixing requires manual labour, there are a lot of files, so I left it as it is. Changelog has been moved to a separate file. Mainly this is the addition of new features of the latest versions of C#, refactoring according to the latest guidelines.

Integrated and cursorily tested in release 2022.1.152.2.

Many thanks again to Roman for this!

Now I just have to figure out how to get back my preferred personal C# editor and formatting settings...

Copy as HTML Update

With the revamped version of The Building Coder Samples, I also finally moved from Visual Studio 2017 to 2019 to compile it. I hope I am the last of the Revit add-in developer community to do so.

It lacked the Copy as HTML option that I use for C# source code colourisation, so I revisited my 2019 note on updating Copy as HTML and again installed the Productivity Power Tools 2017/2019 via Extensions > Manage Extensions.

Image Cleanup and a Robot Arm

Finally, two nice little snippets that caught my attention, a useful image editor tool and impressive novel hardware technology: