IMsProblemCalculation.CalculationTree

Syntax

IMsCalculationTree: IMsCalculationTree;

Description

The CalculationTree property returns the tree of modeling problem calculation.

Comments

The calculation tree in the hierarchical form represents the sequence of calculation, it also enables the user to display the tree node, to which the breakpoint is set.

Example

Executing the example requires a form, a button with the Button1 identifier on it and the  TreeList  component with the TreeList1 identifier. The repository should include a modeling container with the MODEL_SPACE identifier that contains a modeling problem with the PROBLEM identifier. Also, before executing the problem it is necessary to add links to the Metabase, Ms system assemblies.

Click the button to start executing of this example.

Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);

Var

Mb: IMetabase;

ModelSpaceDescr: IMetabaseObjectDescriptor;

Problem: IMsProblem;

CalcSettings: IMsProblemCalculationSettings;

Calculation: IMsProblemCalculation;

CalculationTree: IMsCalculationTree;

CalcChildren: IMsCalculationTreeNodes;

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;

FillCalcList(CalcChildren, Null);

End Sub Button1OnClick;

Sub FillCalcList(Items: IMsCalculationTreeNodes; ParentNode: ITreeListNode);

Var

TreeNodes: ITreeListNodes;

i: Integer;

Item: IMsCalculationTreeNode;

TreeNode: ITreeListNode;

Text: String;

Begin

TreeNodes := TreeList1.Nodes;

For i := 0 To Items.Count - 1 Do

Item := Items.Item(i);

Text := Item.Text;

If Item.Kind = MsCalculationTreeNodeKind.Model Then

Text := Text + (The breakpoint is set!);

End If;

TreeNode := TreeNodes.AddChild(ParentNode, Text);

FillCalcList(Item.Children, TreeNode);

TreeNode.Expand(False);

End For;

End Sub FillCalcList;

After executing the example, a tree of modeling problem calculation is displayed in the TreeList component.

See also:

IMsProblemCalculation