Same procedure as every year: eliminate all deprecated Revit API usage warnings before even thinking of migrating to the next major release.
First, however, two other technical news items:
- Self-teaching AI surpasses human knowledge
- CAD trends 2019
- Deprecated API usage warnings
- Replace
GetRules
byGetElementFilter
- Deprecated material asset accessors
- Update with zero compilation warnings
Self-Teaching AI Surpasses Human Knowledge
I followed the progress of AlphaGo with great fascination.
Now, AlphaZero seems more fascinating still:
AlphaZero is a computer program or algorithm by DeepMind to master go, chess and shogi. On December 5, 2017 the DeepMind team released a preprint introducing AlphaZero, which, within 24 hours, achieved a superhuman level of play in these three games by defeating world-champion programs, Stockfish, elmo, and the 3-day version of AlphaGo Zero, in each case making use of custom tensor processing units (TPUs) that the Google programs were optimized to use. AlphaZero was trained solely via "self-play" using 5,000 first-generation TPUs to generate the games and 64 second-generation TPUs to train the neural networks, all in parallel, with no access to opening books or endgame tables. After ... 9 hours of training, the algorithm decisively defeated Stockfish 8 in a time-controlled 100-game tournament (28 wins, 0 losses, and 72 draws)...
Chess.com describes the chess implications in the article Google's AlphaZero Destroys Stockfish In 100-Game Match:
Chess changed forever today. And maybe the rest of the world did, too.
A little more than a year after AlphaGo sensationally won against the top Go player, the artificial-intelligence program AlphaZero has obliterated the highest-rated chess engine.
Oh, and it took AlphaZero only four hours to "learn" chess...
AlphaZero was not "taught" the game in the traditional sense. That means no opening book, no endgame tables, and apparently no complicated algorithms dissecting minute differences between center pawns and side pawns.
One expert said, "After reading the paper but especially seeing the games I thought, well, I always wondered how it would be if a superior species landed on earth and showed us how they play chess. I feel now I know."
Ex-champion Kasparov said, "We have always assumed that chess required too much empirical knowledge for a machine to play so well from scratch, with no human knowledge added at all... The ability of a machine to replicate and surpass centuries of human knowledge in complex closed systems is a world-changing tool."
CAD Trends 2019
Possibly more relevant to us today, or possibly not, the Business Advantage Group published its survey of 2018/2019 CAD trends in the form of both a webinar recording and survey results.
16 Key CAD trends were identified for the survey this year; newly added ones italic:
- 3D Modelling, BIM, Cloud Based CAD, Mobile access to CAD, Collaborative Design, PLM, Rendering, CAD Licensing Options, PDM, Augmented Reality, 2D Drafting, CAM, Virtual Reality, Machine Learning, Artificial Intelligence, Generative Design
The analysis includes aspects such as:
- Adoption ratio, Awareness, Current usage, Changes in awareness over time, Usage over time, Importance ranking, Looking to the future and Predicted future usage.
Download the webinar or survey results from the links above in case you are interested in the detailed results.
Deprecated API Usage Warnings
Back to the nitty-gritty details of the Revit API...
As pointed out above, we expect a new major release sometime in the future, and I highly recommend eliminating all deprecated Revit API usage warnings before even thinking of migrating to the next major release.
Before I started out eliminating the deprecated Revit API usage warnings, compiling The Building Coder samples generated eight warnings.
The first is just a notification of unreachable code in the module CmdListAllRooms.cs
that I recently worked on
to export room boundaries to CSV for Forge surface classification,
so I'll fix that first.
It was caused by a const bool
variable _exportInMillimetres
.
The warning disappeared after I changed that to static bool
instead.
That leaves seven warnings, all numbered CS0618
and caused by deprecated Revit API usage, from two different API calls:
- In CmdCollectorPerformance.cs:
ParameterFilterElement.GetRules
is obsolete: This method is deprecated in Revit 2019 and will be removed in the next version of Revit. We suggest you useGetElementFilter
instead. - In CmdGetMaterials.cs, repeated six times:
AssetProperties.this[]
is obsolete: This property is deprecated in Revit 2019 and will be removed in the next version of Revit. We suggest you use theFindByName(String)
orGet(int)
method instead.
Both of these deprecated API usages can be easily fixed by following the instructions given by the warning messages.
Replace GetRules by GetElementFilter
To eliminate the first warning, we can replace GetRules
by GetElementFilter
and simplify the code using it like as follows; before:
ParameterFilterElement pfe ... foreach( FilterRule rule in pfe.GetRules() ) // 2018 { IEnumerable<Element> elemsByFilter2 = elemsByFilter.Where( e => rule.ElementPasses( e ) ); }
After:
ElementFilter ef = pfe.GetElementFilter(); // 2019 IEnumerable<Element> elemsByFilter2 = elemsByFilter.WherePasses( ef );
Deprecated Material Asset Accessors
That leaves six warnings caused by calls to deprecated material asset accessors.
Again, easily eliminated by doing what the man says, calling Get
for int
accessors and FindByName
for the ones taking a string argument.
Update with Zero Compilation Warnings
The cleaned-up code is available from The Building Coder samples release 2019.0.145.11.
We are now ready to face whatever it takes to migrate to the new major release, if and when that shows up.