AI News and Sub-Transaction Regen

Things continue moving fast in AI, and the need to regenerate in the Revit API remains unchanged:

AI News

I reported on the surprising success of AlphaGo 18 months ago, when it unexpectedly defeated legendary player Lee Se-dol 4-1, cf. the DeepMind Go challenge overview.

That revolutionised the expectation and perception of AI of scientists and the industry alike: AI is indeed capable of extracting and generating knowledge that exceeds the best human capacity.

Now another important step was taken, completely settling the matter: AlphaGo retires from competitive Go after defeating world number one Ke Jie 3-0.

In this game, Ke Jie made use of some unconventional new moves that AlphaGo invented and first demonstrated in its previous public games... nota bene, it invented new moves after 3000 years of human exploration... one question this raises: 'Invent'? Or discover?

Go game

The DeepMind research team behind AlphaGo has conclusively proved its point and is moving on to new and greener pastures.

Another recent impressive example of what AI enables is provided by the startup that uses AI to create programs from simple screenshots, cf. the corresponding research paper pix2code: Generating Code from a Graphical User Interface Screenshot.

Exciting times indeed.

Back to the Revit API:

Sub-Transaction Requires Regeneration

Alexander Ignatovich, @CADBIMDeveloper, aka Александр Игнатович, shares another important example that fits in perfectly with our continuing series demonstrating the need to regenerate.

In his own words:

It's time to share some piece of knowledge about sub-transactions in your brilliant blog ;-)

I've spent some time, so it should be documented somewhere.

As most Revit programmers know, the document automatically regenerates on transaction commit.

My problem was, that sub-transactions do not cause this, as I previously assumed.

I wanted to retrieve family symbol geometry. I activated the family symbol earlier in a sub-transaction, but I didn't call the document.Regenerate method, so the familySymbol.get_Geometry method returned null. I was confused, because in the debugger I saw that my family symbol is active. I also looked at the activated family symbol geometry, and it was not null.

After I added document regeneration, my code execution path looks like this:

  start main transaction

    start sub transaction

      if (!familySymbol.IsActive)





    geometry = familySymbol.get_Geometry(options)


I previously considered sub-transactions as mini transactions with practically the same behaviour, except they are nested to the transaction and make real changes to model only when outer transaction is committed.

Now I understand that nothing is really committed automatically to the Revit database before completion and commitment of the outer-most transaction.

Many thanks to Alexander for explicitly pointing this out!