Guy says: ... maybe it's time to recommend using the Manual transaction mode only and the removal of Automatic mode. This would pave the way for removing the transaction and regeneration attributes all together.
Jeremy says: I personally never use automatic transaction mode, but I do use both the manual and read-only ones.
It would actually be interesting to know the exact difference between an external command using read-only mode and one using manual without opening any transactions.
Arnošt says: I believe I said it publicly before, but probably not on this blog yet:
First of all, Automatic Transaction Mode is considered obsolete, and we (Autodesk.Revit) do not recommend using it for new external applications. It only exists to ensure compatibility with older applications. The Automatic mode has many limitations (for what an external command can or cannot do), while it has virtually no benefits whatsoever. It is likely it will go away in some future release of Revit.
Read-Only transaction mode does two things (well, it's one thing, really, but I'll split it):
- For one, the command using it cannot have any transactions and may not call any methods that modify a document, directly or indirectly, or even temporarily.
- Secondly, while this external command is being executed, nobody else is allowed to modify the document or have a transaction either; that includes Revit itself, but also applies to other applications that might be invoked through events (for example).
All this basically guarantees that during the entire execution of the external command the current models all remain unmodified.
Guy sums up enthusiastically: Yes, I've been a manual transaction person for a long time.
For various reasons, this enjoyable and thought provoking discussion has accelerated a process I have been slowly going through since the R13 alpha's. The richness of the R13 API effected a rethink, and issues such as transactions/exceptions, which I'll admit I hadn't changed my approach to for a very long time, are triggering more fundamental changes in attitude to the API.
I'd have to say compared to the R8 API I first played with a very long time ago, the speed, stability and functionality possible now is quite stunning. And thinking why these scoping and other changes could be happening is making me rather excited.
With Win8/WinRT/iOS/mobile etc., though, apart from keeping it all logically in my brain it all makes for exciting times as a programmer, even if there aren't enough hours in the day ;-)
Jeremy replies: Wow, yes, talking about cloud and mobile computing and enough hours in the day, have you looked at Kean's latest posts on creating a 3D Android viewer, calling a web-service from Unity, etc.?
Many thanks to Guy and Arnošt for this and all the other recent interesting discussions and insights!