Breakpoint: IMsBreakpoint;
The Breakpoint property returns a breakpoint.
The property returns the basic interface for work with the breakpoint. To work with different types of breakpoints parameters, cast the IMsBreakpoint interface to the IMsModelCalendarBreakpoint or IMsDataBreakpoint interface.
Executing the example requires that the repository contains a form with a button with the BUTTON1 identifier 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.
The example is a handler of the OnClick event for the BUTTON1 button.
Add links to the Metabase and Ms system assemblies.
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;
ModelKindItem: IMsCalculationModelTreeNode;
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 + "(breakpoint is set)";
ModelKindItem := Item As IMsCalculationModelTreeNode;
Debug.WriteLine("Breakpoint: " + ModelKindItem.Breakpoint.Name);
Debug.WriteLine("Triggered in the point: " + ModelKindItem.CurrentPoint.ToString);
Debug.WriteLine("----");
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. Information about the tree elements, that are breakpoints, is displayed in the console window.
See also: