Remove(Index: Integer): Boolean;
Index. Breakpoint index.
The Remove method removes the point from the collection by its index. The method returns True if removal was successful.
Value of the Index parameter must be a non-negative number but less than the value of the IMsBreakpoints.Count property. Index of the first object in the collection is 0, of the last one IMsBreakpoints.Count is 1. Index numbering is continuous.
If the point was successfully removed, the method returns True, value of the IMsBreakpoints.Count property is decreased by one; otherwise the method returns False.
Executing the example requires that the repository contains a modeling container with the MODEL_SPACE identifier. This container must have a modeling problem with the PROBLEM identifier that calculates a model with the MODEL identifier. The example uses the MCallback class described in IMsproblemCalculationCallback.OnBreak.
Also, before starting the procedure add links to the Metabase, Ms system assemblies.
Sub Main;
Var
Mb: IMetabase;
ModelSpaceDescr: IMetabaseObjectDescriptor;
Problem: IMsProblem;
CalcSettings: IMsProblemCalculationSettings;
CallBack: MCallback;
Calculation: IMsProblemCalculation;
Breakpoints: IMsBreakpoints;
Breakpoint: IMsBreakpoint;
CalendarBreakpoint: IMsModelCalendarBreakpoint;
Model: IMsModel;
Begin
Mb := MetabaseClass.Active;
ModelSpaceDescr := Mb.ItemById("MODEL_SPACE");
Problem := Mb.ItemByIdNamespace("PROBLEM", ModelSpaceDescr.Key).Edit As IMsProblem;
CalcSettings := Problem.CreateCalculationSettings;
CallBack := New MCallback.Create;
CalcSettings.Callback := CallBack;
CalcSettings.FactIncluded := True;
Calculation := Problem.Calculate(CalcSettings);
Breakpoints := Calculation.Breakpoints;
Breakpoints.Clear;
Breakpoint := Breakpoints.Add(MsBreakpointKind.ModelCalendar);
CalendarBreakpoint := Breakpoint As IMsModelCalendarBreakpoint;
CalendarBreakpoint.Name := "CalendarBreakpoint";
Model := Mb.ItemByIdNamespace("MODEL", ModelSpaceDescr.Key).Edit As IMsModel;
CalendarBreakpoint.Model := Model;
CalendarBreakpoint.CalendarPoint := DateTime.ComposeDay(2012, 01, 01);
Calculation.Run;
Breakpoint := Breakpoints.FindByKey(0);
Breakpoints.Remove(0);
Calculation.Resume;
End Sub Main;
After executing the example the breakpoint that is triggered if the MODEL model is calculated for 01.01.2012 is set for the problem. The problem calculation is started. After that the first point in the collection is removed.
See also: