Currently, modeling containers contain scenarios as a tree and not as individual repository objects. Use the IMsScenarioTreeEntries interface to work with a scenario tree. The following elements can be added to this tree:
Folder. It is used to arrange the structure of scenario tree. The IMsScenarioTreeFolder interface.
Scenario. Tree element, to which modelling scenario corresponds. The IMsScenarioTreeElement interface.
NOTE. The example given below requires objects listed in variable description section.
The desired scenario must be added to the modeling problem to calculate by the required scenario:
Sub Main;
Var
ModelSpace: IMsModelSpace; // modeling container
scriptTree: IMsscriptTreeEntries; // Scripts tree
scriptElement: IMsScenarioTreeElement; // Tree element to what script corresponds
problem: IMsproblem; // modeling problem
scripts: IMsScenarios; // Collection of modelling scripts
script: IMsscript; // modelling script
Begin
ScenarioTree := ModelSpace.ScenarioTree;
ScenarioElement := ScenarioTree.Item(0) As IMsScenarioTreeElement;
Scenario := ScenarioElement.Scenario;
Scenarios := Problem.Scenarios;
Scenarios.AddScenario(Scenario);
End Sub Main;
The example of creating a scenario is given in the Working with Modeling Container Scenarios section.
See also: