# Worksession class

Namespace: [Rhino.DocObjects](https://developer.rhino3d.com/api/rhinocommon/namespace/rhino.docobjects.md) · Assembly: [RhinoCommon](https://developer.rhino3d.com/api/rhinocommon/assembly/rhinocommon.md)

```cs
public sealed class Worksession
```

Manages a list of models that are being used as reference geometry.

## Properties

- [Document](https://developer.rhino3d.com/api/rhinocommon/type/rhino.docobjects.worksession/document.md): Gets the document that owns this worksession.
- [FileName](https://developer.rhino3d.com/api/rhinocommon/type/rhino.docobjects.worksession/filename.md): Returns the path to the open worksession, or .rws, file. If there is no worksession file open, or the active worksession has not yet been saved, then null is returned.
- [ModelCount](https://developer.rhino3d.com/api/rhinocommon/type/rhino.docobjects.worksession/modelcount.md): Returns the number of models in the worksession. The active model will included in this count whether or not it has been saved.
- [ModelPaths](https://developer.rhino3d.com/api/rhinocommon/type/rhino.docobjects.worksession/modelpaths.md): Returns the paths to the models used by the worksession. If the active model has not been saved, then it will not be included in the output array.
- [Models](https://developer.rhino3d.com/api/rhinocommon/type/rhino.docobjects.worksession/models.md): The models in this worksession, including the active model. [WorksessionModel.UpdateAvailable](https://developer.rhino3d.com/api/rhinocommon/type/rhino.docobjects.worksessionmodel/updateavailable.md) is filled in, so this reports the same state the Worksessions panel shows. Use [Worksession.GetModels(bool)](https://developer.rhino3d.com/api/rhinocommon/type/rhino.docobjects.worksession/getmodels.md) with false to skip that check.
- [Name](https://developer.rhino3d.com/api/rhinocommon/type/rhino.docobjects.worksession/name.md): Gets the name of the worksession - the worksession (.rws) file name without its path or extension. Returns an empty string if there is no worksession file open, or the active worksession has not yet been saved; it is up to the caller to decide what to display in that case.
- [RuntimeSerialNumber](https://developer.rhino3d.com/api/rhinocommon/type/rhino.docobjects.worksession/runtimeserialnumber.md): Unique serial number for the worksession while the application is running. This is not a persistent value. Since Rhino 9 worksessions are per-document and no longer have serial numbers of their own, so this returns [Worksession.Document](https://developer.rhino3d.com/api/rhinocommon/type/rhino.docobjects.worksession/document.md)'s [RhinoDoc.RuntimeSerialNumber](https://developer.rhino3d.com/api/rhinocommon/type/rhino.rhinodoc/runtimeserialnumber.md). Prefer that property in new code.

## Methods

- [Attach](https://developer.rhino3d.com/api/rhinocommon/type/rhino.docobjects.worksession/attach.md): (2 overloads) Attaches a model to this worksession as a reference model.
- [Detach](https://developer.rhino3d.com/api/rhinocommon/type/rhino.docobjects.worksession/detach.md): (2 overloads) Detaches several reference models from this worksession.
- [FileNameFromRuntimeSerialNumber](https://developer.rhino3d.com/api/rhinocommon/type/rhino.docobjects.worksession/filenamefromruntimeserialnumber.md): (static) Returns the path to the open worksession, or .rws, file. If there is no worksession file open, or the active worksession has not yet been saved, then null is returned.
- [GetLockInformation](https://developer.rhino3d.com/api/rhinocommon/type/rhino.docobjects.worksession/getlockinformation.md): (static) Describes whether a worksession model's file is locked, and by whom.
- [GetModels](https://developer.rhino3d.com/api/rhinocommon/type/rhino.docobjects.worksession/getmodels.md): The models in this worksession, including the active model.
- [ModelPathFromSerialNumber](https://developer.rhino3d.com/api/rhinocommon/type/rhino.docobjects.worksession/modelpathfromserialnumber.md): Returns the path to a model, used by the worksession, given a reference model serial number
- [Open](https://developer.rhino3d.com/api/rhinocommon/type/rhino.docobjects.worksession/open.md): (static) Opens a worksession (.rws) file.
- [Save](https://developer.rhino3d.com/api/rhinocommon/type/rhino.docobjects.worksession/save.md): Saves this worksession to its existing .rws file.
- [SaveAs](https://developer.rhino3d.com/api/rhinocommon/type/rhino.docobjects.worksession/saveas.md): Saves this worksession to a .rws file.
- [SetActiveModel](https://developer.rhino3d.com/api/rhinocommon/type/rhino.docobjects.worksession/setactivemodel.md): Makes one of this worksession's reference models the active model.
- [Update](https://developer.rhino3d.com/api/rhinocommon/type/rhino.docobjects.worksession/update.md): Re-reads a reference model whose file has changed on disk.
- [UpdateAll](https://developer.rhino3d.com/api/rhinocommon/type/rhino.docobjects.worksession/updateall.md): Re-reads every reference model in this worksession whose file has changed on disk.
