We present a long-awaited solution to check for a valid Revit API context and a whole bunch of short pointers to other topics of interest, mostly AI related:
Luiz Henrique @ricaun Cassettari finally cracked the question how to know if Revit API is in context:
Revit API throws exceptions if your code is trying to execute Revit API methods in a modeless context, e.g., a WPF modeless view; that's the reason you need to use
ExternalEvent
to execute Revit API code in context.Sometimes you need to know whether code is running in context or if not, to just execute the Revit API code right away or send it to ExternalEvent to be executed.
If you have access to
UIApplication
orUIControllerApplication
, and if you try to subscribe to an event outside Revit API context, you are gonna have this exception: Invalid call to Revit API! Revit is currently not within an API context.Meaning: you can use that to know if your code is in context or not.
- Code sample and video
- 14-minute video on Tasks and InContext in Revit API
I'm using this technique using my open source library to manage the creation of an external event if it is not in context and enable it to run Revit API asynchronously in ricaun.Revit.UI.Tasks.
Many thanks to ricaun for sharing this long-sought-after solution!
In a related vein, we also discussed the question of detecting Revit user input state in real-time via Revit API.
Big welcome to a new member in the Revit programming blogosphere, Easy Revit API. Welcome, Mohamed-Youssef. Best of luck and much success with your blog and other projects!
An impressive example of use of LLM with video input support is presented stating that [the killer app of Gemini Pro 1.5 is video](https://simonwillison.net/2024/Feb/21/gemini-pro-video.
I tested using Gemini myself for a Revit API discussion forum question on 2024 dark theme colouring addins with acceptable and useful results, afaict.
... Even though Anthropic’s Claude 3 causes stir by seeming to realize when it was being tested.
A nice beginner's guide to understanding LLM explains why generative AI exists because of the transformer.
We are generating huge and ever-growing amounts of data, much of which is useless and never looked at again, so it is well worth pondering – and avoiding — design patterns that encourage junk data.
70 percent of all security vulnerabilities are caused by memory safety issues, and many of those are automatically eliminated by working in a memory-safe programming language. Therefore, the White House urges developers to dump C and C++.
Talking about things we ought to dump, I seldom watch long videos, but this hour-long one had me mesmerised all the way through: the harsh reality of ultra processed food with Chris Van Tulleken.