Ja. Die Funktion soll eine StringList zurückgeben.
Delphi-Quellcode:
function TClassZeissCFG.BuildNewFile(CFG: TCFGValues; XStrList: TRenishawValues;
YStrList: TRenishawValues; ZStrList: TrenishawValues;
DataLoaded: array of boolean): TStringList;
var
i: integer;
const
xpc = 1;
ypc = 2;
zpc = 3;
begin
I := 0;
Result := TStringList.Create;
Result.Add(ArrayToStr(CFG.Text));
Result.Add(ArrayToStr(CFG.Axis_x));
Result.Add(ArrayToStr(CFG.Axis_y));
Result.Add(ArrayToStr(CFG.Axis_Z));
Result.Add(ArrayToStr(CFG.Tilt_y));
Result.Add(ArrayToStr(CFG.Tilt_x));
Result.Add(ArrayToStr(CFG.Tilt_const));
// Wenn Renishaw Daten geladen wurden, werden diese genommen.
// Ansonsten die Original Daten aus der CFG Datei
// X-Achse
if DataLoaded[xpc] then
begin
Result.Add('komp_x ' + IntToStr(XStrList.TargetCount + 2));
Result.Add('-99999.999 0');
for i := 0 to XStrList.TargetCount - 1 do
begin
Result.Add(XStrList.Targets[i] + ' ' + XStrList.Deviation[i][2]);
end;
Result.Add('99999.999 0');
end
else
begin
Result.Add('komp_x ' + IntToStr(cfg.Comp_count_x));
for i := 0 to cfg.Comp_count_x - 1 do
begin
Result.Add(cfg.Comp_x[i][0] + ' ' + cfg.Comp_x[i][1]);
end;
end;
// Y-Achse
if DataLoaded[ypc] then
begin
Result.Add('komp_Y ' + IntToStr(YStrList.TargetCount + 2));
Result.Add('-99999.999 0');
for i := 0 to YStrList.TargetCount - 1 do
begin
Result.Add(YStrList.Targets[i] + ' ' + YStrList.Deviation[i][2]);
end;
Result.Add('99999.999 0');
end
else
begin
Result.Add('komp_y ' + IntToStr(cfg.Comp_count_y));
for i := 0 to cfg.Comp_count_y - 1 do
begin
Result.Add(cfg.Comp_y[i][0] + ' ' + cfg.Comp_y[i][1]);
end;
end;
// Z-Achse
if DataLoaded[zpc] then
begin
Result.Add('komp_z ' + IntToStr(ZStrList.TargetCount + 2));
Result.Add('-99999.999 0');
for i := 0 to ZStrList.TargetCount - 1 do
begin
Result.Add(ZStrList.Targets[i] + ' ' + ZStrList.Deviation[i][2]);
end;
Result.Add('99999.999 0');
end
else
begin
Result.Add('komp_z ' + IntToStr(cfg.Comp_count_z));
for i := 0 to cfg.Comp_count_Z - 1 do
begin
Result.Add(cfg.Comp_Z[i][0] + ' ' + cfg.Comp_Z[i][1]);
end;
end;
end;