IMsCalculationModelTreeNode.Model

Syntax

Model: IMsModel;

Description

The Model property returns the model, for which the breakpoint is set.

Example

Executing the example requires a scheduled tasks container with the identifier MODEL_SPACE that contains a modeling problem with the identifier PROBLEM in the repository.

Add links to the Metabase, Ms system assemblies.

Sub UserProc;
Var
    mb: IMetabase;
    ModelSpaceDescr: IMetabaseObjectDescriptor;
    Problem: IMsProblem;
    CalcSettings: IMsProblemCalculationSettings;
    Calculation: IMsProblemCalculation;
    CalculationTree: IMsCalculationTree;
    CalcChildren: IMsCalculationTreeNodes;
    i: Integer;
    Item: IMsCalculationTreeNode;
    ModelTreeNode: IMsCalculationModelTreeNode;
Begin
    mb := MetabaseClass.Active;
    ModelSpaceDescr := Mb.ItemById("MODEL_SPACE");
    Problem := Mb.ItemByIdNamespace("PROBLEM", ModelSpaceDescr.Key).Bind As IMsProblem;
    CalcSettings := Problem.CreateCalculationSettings;
    CalcSettings.FactIncluded := True;
    Calculation := Problem.Calculate(CalcSettings);
    CalculationTree := Calculation.CalculationTree;
    CalcChildren := CalculationTree.Children;
    For i := 0 To CalcChildren.Count - 1 Do
        Item := CalcChildren.Item(i);
        If Item.Kind = MsCalculationTreeNodeKind.Model Then
            ModelTreeNode := Item As IMsCalculationModelTreeNode;
            Debug.WriteLine("Breakpoint ");
            Debug.WriteLine("  - key: " + ModelTreeNode.Key.ToString);
            Debug.WriteLine("  - scenario key: " + ModelTreeNode.Scenario.ToString);
            Debug.WriteLine("  - is present the parent: " + (ModelTreeNode.Parent <> Null).ToString);
            Debug.WriteLine("  - model: " + (ModelTreeNode.Model As IMetabaseObject).Name);
        End If;
    End For;
End Sub UserProc;

After executing the example information about the breakpoints, if they are present in the problem, is displayed in the console window.

See also:

IMsCalculationModelTreeNode