BeforeOptimization

This events is called only when Optimization G2 is in use. It will be called before the profile selections dialog, and allows you to turn modify behavior and eventually turn off/on profiles.

Example and syntax

procedure BeforeOptimization(aWrapper: TBeforeOptimizationRunScriptWrapper);
var
  I: Integer;
  vItem: TBeforeOptimizationRunScriptWrapperItem;
  vIsWhite: boolean;
begin
  if aWrapper.Count = 0 then
  begin
    aWrapper.Aborted := True;
    exit;
  end;  

  vIsWhite := false;
  for I := 0 to aWrapper.Count-1 do
  begin
    vItem := aWrapper.GetItem(I);

    if IsWhiteColor(vItem.ColorCode) then
    begin
      vItem.IncludeStockBars := (gElumatecNo=1);
      vIsWhite := true;
    end;  
    
    //vItem.WastescoreProfileId := 0;
  end;
  
  aWrapper.DoUpdateProfileStocks := vIsWhite;
end;

Properties for the wrapper (TBeforeOptimizationRunScriptWrapper)

Properties for the individual items

These are available from aWrapper.GetItem(I)

Last updated

Was this helpful?