-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFermaNewMat.pas
201 lines (173 loc) · 5.93 KB
/
FermaNewMat.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
unit FermaNewMat;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, Buttons, ExtCtrls, Ferma_FD, Ferma_M, Grids, Ferm_Dat;
type
TFermaNewMatForm = class(TForm)
Bevel1: TBevel;
Bevel2: TBevel;
Bevel3: TBevel;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
FermaNewMatName: TEdit;
Label1: TLabel;
FermaNewMatModUpr: TEdit;
FermaNewMatDopNapr: TEdit;
MUL: TLabel;
DNL: TLabel;
Bevel4: TBevel;
StringGrid1: TStringGrid;
NM_Plotn_edit: TEdit;
pltn: TLabel;
Image1: TImage;
Image2: TImage;
Image3: TImage;
procedure FormShow(Sender: TObject);
procedure BitBtn1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
FermaNewMatForm: TFermaNewMatForm;
implementation
uses Main;
{$R *.DFM}
procedure TFermaNewMatForm.FormShow(Sender: TObject);
var i : integer;
begin
StringGrid1.Cells[0,0] := 'Lambda';
StringGrid1.Cells[1,0] := 'Phi';
for i := 1 to 21 do StringGrid1.Cells[0,i] := inttostr((i-1) * 10);
if Ferma_Fd_Form.Material_ComboBox.Items[Ferma_Fd_Form.Material_ComboBox.ItemIndex]='<äðóãîé>' Then
begin
FermaNewMatName.Text:='<äðóãîé>';
FermaNewMatName.SetFocus;
FermaNewMatName.SelectAll;
FermaNewMatModUpr.Text:=Ferma_Fd_Form.ModUpr_Edit.Text;
FermaNewMatDopNapr.Text:=Ferma_Fd_Form.DopNapr_Edit.Text;
end
else
begin
FermaNewMatName.Text:='';
FermaNewMatModUpr.Text:='';
FermaNewMatDopNapr.Text:='';
FermaNewMatName.SetFocus;
end;
MUL.Caption:='Ìîäóëü óïðóãîñòè ['+Ferma_M.TFerma_Form(Main_Form.ActiveMdiChild).ferm.s_for+'/'+
Ferma_M.TFerma_Form(Main_Form.ActiveMdiChild).ferm.s_lin+'**2]';
DNL.Caption:='Äîïóñêàåìîå íàïðÿæåíèå ['+Ferma_M.TFerma_Form(Main_Form.ActiveMdiChild).ferm.s_for+'/'+
Ferma_M.TFerma_Form(Main_Form.ActiveMdiChild).ferm.s_lin+'**2]';
PLTN.Caption:='Ïëîòíîñòü ìàòåðèàëà ['+'Êã'+'/'+
Ferma_M.TFerma_Form(Main_Form.ActiveMdiChild).ferm.s_lin+'**3]';
end;
procedure TFermaNewMatForm.BitBtn1Click(Sender: TObject);
var
i:integer;
error:boolean;
Phi : Phi_Table;
Phi_File : file of Phi_Table;
Ferma_num_mat:integer;
ff:System.Text;
begin
{AssignFile(Phi_File,'Phi.ini');
filemode := 2;
Reset(Phi_File);
while not EOF(Phi_File) do read(Phi_File, Phi);
Phi.Material := FermaNewMatName.Text;
for i := 1 to 21 do
begin
Phi.Lambda := (i - 1) * 10;
Phi.Phi := strtofloat(FermaNewMatForm.StringGrid1.cells[1,i]);
write(Phi_File, Phi);
end;
CloseFile(Phi_File);}
error:=False;
// Ïðîâåðêà íà èìÿ
if FermaNewMatName.Text='' then
begin
// error:=True;
beep;
Main_Form.StatusBar1.Panels[1].text:='Îøèáêà. Íå çàäàíî èìÿ ìàòåðèàëà';
exit;
end;
if FermaNewMatName.Text='<äðóãîé>' then
begin
// error:=True;
beep;
Main_Form.StatusBar1.Panels[1].text:='Îøèáêà. Çàðåçåðâèðîâàííîå ñëîâî â íàçâàíèè';
exit;
end;
for i:=1 to Main_Form.Ferma_num_mat+2 do
begin
if FermaNewMatName.Text=Main_Form.Ferma_MMaterials[i].MName then
begin
// error:=True;
Beep;
Main_Form.StatusBar1.Panels[1].text:='Îøèáêà. Ñóùåñòâóåò ìàòåðèàë ñ ââåäåííûì íàçâàíèåì';
exit;
end;
end;
try
StrToFloat(FermaNewMatModUpr.Text);
except
// Error:=True;
beep;
Main_Form.StatusBar1.Panels[1].text:='Îøèáêà ïðè ââîäå ìîäóëÿ óïðóãîñòè';
exit;
end;
try
StrToFloat(FermaNewMatDopNapr.Text);
except
// Error:=True;
beep;
Main_Form.StatusBar1.Panels[1].text:='Îøèáêà ïðè ââîäå äîïóñêàåìîãî íàïðÿæåíèÿ';
exit;
end;
try
StrToFloat(NM_plotn_edit.Text);
except
// Error:=True;
beep;
Main_Form.StatusBar1.Panels[1].text:='Îøèáêà ïðè ââîäå äîïóñêàåìîé ïëîòíîñòè';
exit;
end;
for i:=1 to Main_Form.Ferma_num_mat+2 do
begin // Ñóùåñòâóåò ëè ìàòåðèàë ñ ââåäåííûìè õàðàêòåðèñòèêàìè
if (FloatToStr(StrToFloat(FermaNewMatModUpr.Text)/ferma_fd.s_num)=FloatToStr(Main_Form.Ferma_MMaterials[i].MModUpr)) and
(FloatToStr(StrToFloat(FermaNewMatDopNapr.Text)/ferma_fd.s_num)=FloatToStr(Main_Form.Ferma_MMaterials[i].MDopNapr)) then
begin
Main_Form.StatusBar1.Panels[1].text:='Ñóùåñòâóåò ìàòåðèàë ñ äàííûìè õàðàêòåðèñòèêàìè';
Main_Form.StatusBar1.Panels[2].text:='Âûáåðèòå ìàòåðèàë ['+Main_Form.Ferma_MMaterials[i].MName+']';
Error:=True;
beep;
break;
end;
end;
if not Error then // Ñîçäàåì íîâûé ìàòåðèàë
begin
Main_Form.Ferma_num_mat:=Main_Form.Ferma_num_mat+1;
Main_Form.Ferma_MMaterials[Main_Form.Ferma_num_mat+2].MModUpr:=StrToFloat(FermaNewMatModUpr.Text)/ferma_fd.s_num;
Main_Form.Ferma_MMaterials[Main_Form.Ferma_num_mat+2].MDopNapr:=StrToFloat(FermaNewMatDopNapr.Text)/ferma_fd.s_num;
Main_Form.Ferma_MMaterials[Main_Form.Ferma_num_mat+2].MPlotn:=StrToFloat(NM_plotn_Edit.Text)/ferma_fd.s_num;
if f.s_lin = 'M' then Main_Form.Ferma_MMaterials[Main_Form.Ferma_num_mat+2].MPlotn:=StrToFloat(NM_plotn_Edit.Text)*ferma_fd.pltn_num;
Main_Form.Ferma_MMaterials[Main_Form.Ferma_num_mat+2].MName:=FermaNewMatName.Text;
// AssignFile(Phi_File,'phi.ini');
// filemode := 2;
// reset(phi_file);
{ while not EOF(Phi_File) do read(Phi_File, Phi);
Phi.Material := FermaNewMatName.Text;}
{ for i := 1 to 21 do
begin
Phi.Lambda := (i - 1) * 10;
Phi.Phi := strtofloat(FermaNewMatForm.StringGrid1.cells[1,i]);
write(Phi_File, Phi);
end;}
// CloseFile(Phi_File);
// CloseFile(ff);
Ferma_Fd_Form.ShowD(Ferma_M.TFerma_Form(Main_Form.ActiveMdiChild).ferm);
end;
end;
end.