Migrating the Building Coder Samples to Revit 2012

This is the third migration of the The Building Coder samples, after moving from Revit 2009 to Revit 2010 and then to Revit 2011.

The move from 2010 to 2011 was a tougher round with many changes. This time around, from 2011 to 2012, it is quite easy and straightforward again.

For details on what needs modifying, as always, please refer to the Revit 2012 SDK documentation and especially the chapter 'What's New' in the Revit 2012 API help file RevitAPI.chm.

I spent a couple of hours migrating The Building Coder samples. The time is rather long because there are a large number of commands, over eighty. It was shortened somewhat because I had some experience from previously migrating lots of other ADN sample code for the Revit API trainings in Jeddah and Verona.

Without further ado, let me here present the new Revit 2012 version 2012.0.87.0 of The Building Coder sample code. For comparison purposes, here is an updated last Revit 2011 version 2011.0.87.2. In the latter, I already updated some administrative global stuff, so that it can be used to easily determine what the really relevant differences between the 2011 and 2012 versions are. Actually, I also removed the regeneration attribute, so this version will not run in Revit 2011 – it is really for comparison purposes only. I hope you are aware of the Unix diff, Visual Studio Windiff, and numerous other tools for comparing files and directory structures that can be used for this purpose.

One systematic difference that affects every single file in the same way is the removal of the regeneration attribute. It was obligatory in Revit 2011, and is voluntary but useless in Revit 2012 API, since the only supported regeneration mode is now manual.

Here is the list of different files produced by Windiff after updating the regeneration attribute in both versions:

  properties\assemblyinfo.cs
  cmdcollectorperformance.cs	
  cmdcolumnround.cs	
  cmddimensionwallsfindrefs.cs	
  cmdeditfloor.cs	
  cmdgetsketchelements.cs	
  cmdimportsinfamilies.cs	
  cmdlibrarypaths.cs	
  cmdmirror.cs	
  cmdnewlightingfixture.cs	
  cmdnewspotelevation.cs	
  cmdnewwalllayer.cs	
  cmdroomwalladjacency.cs	
  cmdsettagtype.cs	
  cmdspaceadjacency.cs	
  cmdtransformedcoords.cs	
  cmdwalllayers.cs	
  cmdwalllayervolumes.cs	
  util.cs

This is how the differences are displayed in Windiff, with deleted lines displayed in red and added ones in yellow:

Windiff displaying file differences

In the 2012 version of the code, I commented out the 2011-specific lines of code and added a '// 2011' comment suffix to them. The 2012 version of the lines are also marked, with a '// 2012' comment suffix.

I suggest downloading and unpacking the two versions in two neighbouring directories and running Windiff on them yourself to examine the changes in detail.

Here is a full log of the migration steps.

I fixed all errors and most of the warnings, but 12 still remain. I consider these acceptable for the moment, and will leave things as they are for now. I have tested a very few of the migrated commands. Most are still untested in Revit 2012.

Good luck in your own porting efforts!

Version Number

I am maintaining the version numbering system introduced for Revit 2011: major.minor.build.revision. I bumped the major revision to 2012 to make the link to Revit 2012 obvious. I may use the minor revision to indicate intermediate updates of the Revit API, if any appear. The build number is currently set to 87 and indicates the number of commands defined, more or less.

RvtSamples

As before, I continue to use the RvtSamples SDK sample to load and launch all The Building Coder samples, as well as all the other ADN samples that I work with, just like I did for Revit 2010 and 2011. The BcSamples.txt include file read by RvtSamples is included in the zip file and provides all the details required. For more information, you can also refer to the RvtSamples documentation.