WorksessionSetActiveModel Method |
Namespace: Rhino.DocObjects
Changing the active model loads the requested model into a different document, so carry on with the returned document: treat Document and this Worksession instance as unusable once this returns.
The document this was called on is closed as part of the switch, but on Mac that close is asynchronous and may not have finished when this returns. Do not rely on the old document either still being open or already being gone.
This is not fully silent: if the outgoing document has unsaved changes the user is prompted to save it, and cancelling that prompt makes this return null. Save the document first if you need it to run unattended.
Do not call this from a script that is itself running in the document being replaced. Scripts run in a document context, and closing that document from underneath the running script leaves Rhino's command machinery working with a document that no longer exists. Drive this from a command, a panel, or an idle handler instead.