Click or drag to resize

WorksessionSetActiveModel Method

Makes one of this worksession's reference models the active model.

Namespace:  Rhino.DocObjects
Assembly:  RhinoCommon (in RhinoCommon.dll)
Since: 9.0
Syntax
public RhinoDoc SetActiveModel(
	uint modelSerialNumber
)

Parameters

modelSerialNumber
Type: SystemUInt32
The reference model's serial number, from SerialNumber.

Return Value

Type: RhinoDoc
The document the worksession is now using, or null on failure.
Remarks

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.

See Also