Worksession
ReferencesProperties
WorksessionModel.UpdateAvailable is filled in, so this reports the same state the Worksessions panel shows. Use GetModels(bool) with false to skip that check.
Since Rhino 9 worksessions are per-document and no longer have serial numbers of their own, so this returns Document's RhinoDoc.RuntimeSerialNumber. Prefer that property in new code.
Methods
| path (string) | The full path to the .3dm file to attach. |
| paths (IEnumerable<string>) | The full paths to the .3dm files to attach. |
| modelSerialNumbers (IEnumerable<uint>) | The reference models' serial numbers, from WorksessionModel.SerialNumber. |
| modelSerialNumber (uint) | The reference model's serial number, from WorksessionModel.SerialNumber. |
| runtimeSerialNumber (uint) | Since Rhino 9 worksessions are per-document and no longer have serial numbers of their own, so this is a document's RhinoDoc.RuntimeSerialNumber. In new code, prefer getting the document and using its RhinoDoc.Worksession FileName. |
| modelPath (string) | The full path to the model's file. |
| checkForUpdates (bool) | True to fill in WorksessionModel.UpdateAvailable for each model. This compares each referenced file's size and last modified time against the values stored when the file was attached, which opens and stats each file once - no file contents are read, so the cost does not grow with the size of the models, but it is still one round trip per model. Pass false to skip it, for example when reading this repeatedly or when the models live on a slow network share. |
| modelSerialNumber (uint) | The reference model serial number. |
Opening a worksession is a document-level operation rather than a change to an existing worksession, which is why this is static. Always use the returned document: it may be the current document, reused, or a newly created one, depending on the platform and on whether the current document can be reused. On Windows, other than headless, the current document is closed and replaced.
As with SetActiveModel(uint), do not call this from a script running in a document that this might close.
| path (string) | The full path to the .rws file to open. |
| path (string) | The full path to write to. |
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.
| modelSerialNumber (uint) | The reference model's serial number, from WorksessionModel.SerialNumber. |
| modelSerialNumber (uint) | The reference model's serial number, from WorksessionModel.SerialNumber. Pass 0 to update every out-of-date reference model in this worksession. |