Nugroho's blog.: Create Res2DMod File from Delphi

Thursday, March 14, 2019

Create Res2DMod File from Delphi

I post the full source code below

 
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, Grids, StdCtrls;

type
  TForm1 = class(TForm)
    Edit1: TEdit;
    Edit2: TEdit;
    Edit3: TEdit;
    Edit4: TEdit;
    Edit5: TEdit;
    Edit6: TEdit;
    Edit7: TEdit;
    Edit8: TEdit;
    Edit9: TEdit;
    Edit10: TEdit;
    Edit11: TEdit;
    Edit12: TEdit;
    Edit13: TEdit;
    Edit14: TEdit;
    Edit15: TEdit;
    Edit16: TEdit;
    Edit17: TEdit;
    Button1: TButton;
    StringGrid1: TStringGrid;
    procedure FormCreate(Sender: TObject);
    procedure StringGrid1SelectCell(Sender: TObject; ACol, ARow: Integer;
      var CanSelect: Boolean);
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
var i,j:integer;
begin
  edit1.Text:='Fault Model';
  edit2.Text:='51';
  edit3.Text:='15';
  edit4.Text:='0';
  edit5.Text:='1.0';
  edit6.Text:='2';
  edit7.Text:='0,200,3';
  edit8.Text:='4';
  edit9.Text:='200.0, 350.0, 175.0';
  edit10.Text:='14';
  edit11.Text:='0.2500, 0.5000, 0.7125, 1.1875, 1.6875, 2.3125,'+
                '3.1875, 4.4375, 6.4375, 10.4375, 18.4375, 34.4375,'+
                '66.4375, 130.4375 ';
  edit12.Text:='3';
  edit13.Text:='0';
  edit14.Text:='0';
  edit15.Text:='0';
  edit16.Text:='0';
  edit17.Text:='0';
  for i:=0 to 13 do begin
    for j:=0 to 209 do begin
      stringgrid1.Cells[j,i]:='0';
    end;
  end;
end;

procedure TForm1.StringGrid1SelectCell(Sender: TObject; ACol,
  ARow: Integer; var CanSelect: Boolean);
begin
  if stringgrid1.Cells[ACol,Arow]='0' then
    stringgrid1.Cells[ACol,Arow]:='1' else
      stringgrid1.Cells[ACol,Arow]:='0';
end;

procedure TForm1.Button1Click(Sender: TObject);
var f:textfile;
    s:string;
    i,j:integer;
begin
  assignfile(f,'data.mod');
  rewrite(f);
  writeln(f,edit1.text);
  writeln(f,edit2.text);
  writeln(f,edit3.text);
  writeln(f,edit4.text);
  writeln(f,edit5.text);
  writeln(f,edit6.text);
  writeln(f,edit7.text);
  writeln(f,edit8.text);
  writeln(f,edit9.text);
  writeln(f,edit10.text);
  writeln(f,edit11.text);
  for i:=0 to 13 do begin
    s:='';
    for j:=0 to 209 do begin
      s:=s+stringgrid1.Cells[j,i];
    end;
    writeln(f,s);
  end;
  writeln(f,edit12.text);
  writeln(f,edit13.text);
  writeln(f,edit14.text);
  writeln(f,edit15.text);
  writeln(f,edit16.text);
  writeln(f,edit17.text);

  closefile(f);
end;

end.

.

1 comment:

Nanda said...

Boleh minta format data res2mod nya mas ? Ke email nandaridki99@gmail.com
Terimakasih mas, sukses selalu

323f (5) amp (1) android (12) apple (7) arduino (18) art (1) assembler (21) astina (4) ATTiny (23) blackberry (4) camera (3) canon (2) cerita (2) computer (106) crazyness (11) debian (1) delphi (39) diary (286) flash (8) fortran (6) freebsd (6) google apps script (8) guitar (2) HTML5 (10) IFTTT (7) Instagram (7) internet (12) iOS (5) iPad (6) iPhone (5) java (1) javascript (1) keynote (2) LaTeX (6) lazarus (1) linux (29) lion (15) mac (28) macbook air (8) macbook pro (3) macOS (1) Math (3) mathematica (1) maverick (6) mazda (4) microcontroler (35) mountain lion (2) music (37) netbook (1) nugnux (6) os x (36) php (1) Physicist (29) Picture (3) programming (189) Python (109) S2 (13) software (7) Soliloquy (125) Ubuntu (5) unix (4) Video (8) wayang (3) yosemite (3)