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)

..
published
  property Count: Integer read GetCount;
  property Aborted: boolean read GetAborted write SetAborted;
  property DoUpdateProfileStocks: boolean read GetDoUpdateProfileStocks write SetDoUpdateProfileStocks;
  property ErrorList: TStrings read GetErrorList;
  property GroupKeyCaption: string read GetGroupKeyCaption;
  property HasColour: boolean read GetHasColour;
  property HasGrouping: boolean read GetHasGrouping;
  property LongestBar: TTenthOfAMillimeter read GetLongestBar;
  property MachineLinkErrorLIst: TStrings read GetMachineLinkErrorLIst;
  property RemainderHandlingMode: TRemainderHandlingMode read GetRemainderHandlingMode;
  property Test: boolean read GetTest;
  property UseScoreMap: Boolean read GetUseScoreMap;
end;
  ..

Properties for the individual items

These are available from aWrapper.GetItem(I)

..
published
  property ColorCode: string read GetColorCode;
  property Include: boolean read GetInclude write SetInclude;
  property GroupingCode: string read GetGroupingCode;
  property IncludeStockBars: boolean read GetIncludeStockBars write SetIncludeStockBars;
  property PiecesSumNetLength: TTenthOfAMillimeter read GetPiecesSumNetLength;
  property PiecesQty: Integer read GetPiecesQty;
  property PiecesSumGrossLength: TTenthOfAMillimeter read GetPiecesSumGrossLength;
 
  property BarLength: TTenthOfAMillimeter read GetBarLength;
  property CleanCut: TTenthOfAMillimeter read GetCleanCut write SetCleanCut;
  property Cutwaste: TTenthOfAMillimeter read GetCutwaste write SetCutwaste;
  property Description: string read GetDescription write SetDescription;
  property Itemnumber: string read GetItemnumber;
  property MinLength: TTenthOfAMillimeter read GetMinLength;
  property ProfileId: string read GetProfileId;
  property WastescoreProfileId: Integer read GetWastescoreProfileId write SetWastescoreProfileId;
end;
  ..

Last updated

Was this helpful?