IMsProblemScenarios.AddScenario

Syntax

AddScenario(Scenario: IMsScenario);

Parameters

Scenario. Modeling container scenario.

Description

The AddScenario method adds a modeling container scenario to the collection of problem scenarios.

Example

Sub UserProc;
Var
    MB: IMetabase;
    MObj: IMetabaseObject;
    KMSpace: IMsModelSpace;
    KmScens: IMsScenarioTreeEntries;
    Problem: IMsProblem;
    ProbScen: IMsProblemScenarios;
Begin
    MB := MetabaseClass.Active;
    MObj := MB.ItemByIdNamespace("PROBLEM_1", MB.ItemById("KONT_MODEL").Key).Edit;
    KMSpace := MB.ItemById("KONT_MODEL").Bind As IMsModelSpace;
    KmScens := KMSpace.ScenarioTree;
    Problem := MObj As IMsProblem;
    ProbScen := Problem.Scenarios;
    ProbScen.AddScenario(KmScens.Item(KmScens.Count - 1As IMsScenario);
    MObj.Save;
End Sub UserProc;

After executing the example the last scenario of modeling container is added to the list of scenarios of the problem with the PROBLEM_1 identifier.

See also:

IMsProblemScenarios