I would like to be able to modify worksession files in an automated way. I would like to specify which model is the active one and I would like to automatically add or remove models to a worksession. I would also like to be able to save a worksession to a specified location.
If a .rws file would be human readable, all of the above would be very straightforward, however, it is not. I can’t seem to find any references in the Rhino Common reference, nor in any Rhino Script reference.
Check the RhinoScript help file (Help -> Plug-ins -> RhinoScript) for details.
These methods, along with the fact that the Worksession command is scriptable, should allow you to do what you’ve described.
For example, the following script allows you to set the currently active worksession model.
Sub TestWorksessionCurrentModel
Dim arrModels, strModel, strCommand
arrModels = Rhino.WorkSessionModelAliases
If IsNull(arrModels) Then Exit Sub
strModel = Rhino.ListBox(arrModels, "Select model to set current:", "Worksession")
If IsNull(strModel) Then Exit Sub
strCommand = "_-Worksession _Current " & Chr(34) & strModel & Chr(34) & " _Enter"
Call Rhino.Command(strCommand, True)
End Sub