forked from lizhen-dlut/ReducerDesign
-
Notifications
You must be signed in to change notification settings - Fork 0
/
FrmDetailDesign.cs
345 lines (313 loc) · 15.5 KB
/
FrmDetailDesign.cs
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
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
using System;
using System.Windows.Forms;
using ReducerDesign.CommonClass;
namespace ReducerDesign
{
public partial class FrmDetailDesign : Form
{
public FrmDetailDesign()
{
InitializeComponent();
}
private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
{
if (e.Node.Text == "第1级轴串")
{
pictureBox1.Load(SystemConstants.StrProjectPath + SystemConstants.XmlProject.Element("第1级轴串").Element("轴串图").Value);
pictureBox2.Load(SystemConstants.StrProjectPath + SystemConstants.XmlProject.Element("第2级轴串").Element("轴串图").Value);
button1.Visible = false;
button3.Visible = false;
//SecondPartForm frm = new SecondPartForm();
//frm.Show();
//this.Hide();
}
if (e.Node.Text == "第2级轴串")
{
pictureBox1.Load(SystemConstants.StrProjectPath + SystemConstants.XmlProject.Element("第2级轴串").Element("轴串图").Value);
pictureBox2.Load(SystemConstants.StrProjectPath + SystemConstants.XmlProject.Element("第4级轴串").Element("轴串图").Value);
button1.Visible = false;
button3.Visible = false;
//SecondPartForm frm = new SecondPartForm();
//frm.Show();
//this.Hide();
}
if (e.Node.Text == "第3级轴串")
{
pictureBox1.Load(SystemConstants.StrProjectPath + SystemConstants.XmlProject.Element("第3级轴串").Element("轴串图").Value);
button1.Visible = false;
button3.Visible = false;
//SecondPartForm frm = new SecondPartForm();
//frm.Show();
//this.Hide();
}
if (e.Node.Text == "第4级轴串")
{
pictureBox1.Load(SystemConstants.StrProjectPath + SystemConstants.XmlProject.Element("第4级轴串").Element("轴串图").Value);
button1.Visible = true;
button3.Visible = true;
//SecondPartForm frm = new SecondPartForm();
//frm.Show();
//this.Hide();
}
}
//递归调用,建立TreeView结构树
//private void ConvertXmlNodeToTreeNode(XmlNodeList xmlNodes, TreeNodeCollection treeNodes)
//{
// foreach (XmlNode xmlNode in xmlNodes)
// {
// string nodeText = xmlNode.Name.ToString();
// string nodeTreeNode = "";
// string nodeValue = "";
// if (xmlNode.ChildNodes.Count == 1)
// {
// nodeValue = xmlNode.InnerText.ToString();
// nodeTreeNode = nodeValue;
// }
// //if (xmlNode.Value == null)
// else
// {
// nodeTreeNode = nodeText;
// }
// TreeNode newTreeNode = new TreeNode(nodeTreeNode);
// newTreeNode.Tag = nodeValue;
// if (xmlNode.ChildNodes.Count != 1)
// {
// this.ConvertXmlNodeToTreeNode(xmlNode.ChildNodes, newTreeNode.Nodes);
// }
// treeNodes.Add(newTreeNode);
// }
//}
private void BuildAssemblyTreeNode()
{
treeView1.LabelEdit = true;//可编辑状态。
treeView1.Nodes.Clear();
//这个结点是根节点。
//TreeNode node = new TreeNode();
//node.Text = "hope";
//treeView1.Nodes.Add(node);
//TreeNode node1 = new TreeNode();
//node1.Text = "hopeone";
//TreeNode node11 = new TreeNode();
//node11.Text = "hopeoneone";
//TreeNode node2 = new TreeNode();
//node2.Text = "hopetwo";
//node1.Nodes.Add(node11);//在node1下面在添加一个结点。
//node.Nodes.Add(node1);//node下的两个子节点。
//node.Nodes.Add(node2);
//TreeNode t = new TreeNode("basil");
////作为根节点。
//treeView1.Nodes.Add(t);
//TreeNode t1 = new TreeNode("basilone");
//t.Nodes.Add(t1);
//TreeNode t2 = new TreeNode("basiltwo");
//t.Nodes.Add(t2);
int iGrade = 3;// = Convert.ToInt32(SystemConstants.XmlProject.Element("总体要求").Element("级数").Value);
//TreeNode newTreeNode = new TreeNode();
for (int i = 1; i <= iGrade + 1; i++)
{
TreeNode newTreeNode = new TreeNode();
newTreeNode.Text = "第" + i + "级轴串";
treeView1.Nodes.Add(newTreeNode);
TreeNode childTreeNode1 = new TreeNode();
childTreeNode1.Text = "齿轮轴";
newTreeNode.Nodes.Add(childTreeNode1);
if (i != 1)
{
TreeNode childTreeNode2 = new TreeNode();
childTreeNode2.Text = "齿轮";
newTreeNode.Nodes.Add(childTreeNode2);
}
}
//foreach (XmlNode xmlNode in xmlNodes)
//{
// string nodeText = xmlNode.Name.ToString();
// string nodeTreeNode = "";
// string nodeValue = "";
// if (xmlNode.ChildNodes.Count == 1)
// {
// nodeValue = xmlNode.InnerText.ToString();
// nodeTreeNode = nodeValue;
// }
// //if (xmlNode.Value == null)
// else
// {
// nodeTreeNode = nodeText;
// }
// newTreeNode.Tag = nodeValue;
// if (xmlNode.ChildNodes.Count != 1)
// {
// this.ConvertXmlNodeToTreeNode(xmlNode.ChildNodes, newTreeNode.Nodes);
// }
// treeNodes.Add(newTreeNode);
}
private void InputPartForm_Load(object sender, EventArgs e)
{
BuildAssemblyTreeNode();
}
private void InputPartForm_Load_1(object sender, EventArgs e)
{
BuildAssemblyTreeNode();
}
private void btForceForm_Click(object sender, EventArgs e)
{
string str = treeView1.SelectedNode.Text;
int i = Convert.ToInt32(str.Length == 5 ? str.Substring(1, 1) : str.Substring(1, 2));
if (i == 1)
{
FrmBearForceAnalysis1 childFrame = new FrmBearForceAnalysis1(i);
childFrame.Show();
}
if (i == 2)
{
FrmBearForceAnalysis2 childFrame = new FrmBearForceAnalysis2(i);
childFrame.Show();
}
if (i == 3)
{
FrmBearForceAnalysis3 childFrame = new FrmBearForceAnalysis3(i);
childFrame.Show();
}
if (i == 4)
{
Form11 childFrame = new Form11(i);
childFrame.Show();
}
}
private void button2_Click(object sender, EventArgs e)
{
string str = treeView1.SelectedNode.Text;
int i = Convert.ToInt32(str.Length == 5 ? str.Substring(1, 1) : str.Substring(1, 2));
if (i == 1)
{
FrmStrengthCalculation1 childFrame = new FrmStrengthCalculation1(i);
childFrame.Show();
}
if (i == 2)
{
FrmStrengthCalculation2 childFrame = new FrmStrengthCalculation2(i);
childFrame.Show();
}
if (i == 3)
{
FrmStrengthCalculation2 childFrame = new FrmStrengthCalculation2(i);
childFrame.Show();
}
if (i == 4)
{
Form19 childFrame = new Form19(i);
childFrame.Show();
}
}
private void btInterferenceForm_Click(object sender, EventArgs e)
{
string str = treeView1.SelectedNode.Text;
int i = Convert.ToInt32(str.Length == 5 ? str.Substring(1, 1) : str.Substring(1, 2));
double t = 0.0;
double d = 0.0;
if (i == 1)
{
t = double.Parse(SystemConstants.XmlProject.Element("第" + i + "级轴串").Element("动力参数").Element("扭矩").Value);
d = double.Parse(SystemConstants.XmlProject.Element("第" + i + "级轴串").Element("齿轮轴").Element("轴段6直径").Value);
FrmInterferenceConnection1 childFrame = new FrmInterferenceConnection1(i, t, d);
childFrame.Show();
}
if (i == 2)
{
t = double.Parse(SystemConstants.XmlProject.Element("第" + i + "级轴串").Element("动力参数").Element("扭矩").Value);
d = double.Parse(SystemConstants.XmlProject.Element("第" + i + "级轴串").Element("齿轮轴").Element("轴段5直径").Value);
FrmInterferenceConnection1 childFrame = new FrmInterferenceConnection1(i, t, d);
childFrame.Show();
}
if (i == 3)
{
t = double.Parse(SystemConstants.XmlProject.Element("第" + i + "级轴串").Element("动力参数").Element("扭矩").Value);
d = double.Parse(SystemConstants.XmlProject.Element("第" + i + "级轴串").Element("齿轮轴").Element("轴段5直径").Value);
FrmInterferenceConnection1 childFrame = new FrmInterferenceConnection1(i, t, d);
childFrame.Show();
}
if (i == 4)
{
t = double.Parse(SystemConstants.XmlProject.Element("第" + i + "级轴串").Element("受力计算参数").Element("T1").Value);
d = double.Parse(SystemConstants.XmlProject.Element("第" + i + "级轴串").Element("齿轮轴").Element("轴段1直径").Value);
FrmInterferenceConnection1 childFrame = new FrmInterferenceConnection1(i, t, d);
childFrame.Show();
}
}
private void btKeyForm_Click(object sender, EventArgs e)
{
string str = treeView1.SelectedNode.Text;
int i = Convert.ToInt32(str.Length == 5 ? str.Substring(1, 1) : str.Substring(1, 2));
double t = 0.0;
double d = 0.0;
double b = 0.0;
double h = 0.0;
double l = 0.0;
if (i == 1)
{
t = double.Parse(SystemConstants.XmlProject.Element("第" + i + "级轴串").Element("动力参数").Element("扭矩").Value);
b = double.Parse(SystemConstants.XmlProject.Element("第" + i + "级轴串").Element("齿轮轴").Element("键槽b").Value);
h = double.Parse(SystemConstants.XmlProject.Element("第" + i + "级轴串").Element("齿轮轴").Element("键槽h").Value); //键宽
l = double.Parse(SystemConstants.XmlProject.Element("第" + i + "级轴串").Element("齿轮轴").Element("键槽L").Value);//键长度
d = double.Parse(SystemConstants.XmlProject.Element("第" + i + "级轴串").Element("齿轮轴").Element("轴段6直径").Value);
FrmKeyStrength1 frm = new FrmKeyStrength1(i, t, d, b, h, l);
frm.Show();
}
if (i == 2)
{
t = double.Parse(SystemConstants.XmlProject.Element("第" + i + "级轴串").Element("动力参数").Element("扭矩").Value);
b = double.Parse(SystemConstants.XmlProject.Element("第" + i + "级轴串").Element("齿轮轴").Element("键槽b").Value);
h = double.Parse(SystemConstants.XmlProject.Element("第" + i + "级轴串").Element("齿轮轴").Element("键槽h").Value); //键宽
l = double.Parse(SystemConstants.XmlProject.Element("第" + i + "级轴串").Element("齿轮轴").Element("键槽L").Value);//键长度
d = double.Parse(SystemConstants.XmlProject.Element("第" + i + "级轴串").Element("齿轮轴").Element("轴段5直径").Value);
FrmKeyStrength1 frm = new FrmKeyStrength1(i, t, d, b, h, l);
frm.Show();
}
if (i == 3)
{
t = double.Parse(SystemConstants.XmlProject.Element("第" + i + "级轴串").Element("动力参数").Element("扭矩").Value);
b = double.Parse(SystemConstants.XmlProject.Element("第" + i + "级轴串").Element("齿轮轴").Element("键槽b").Value);
h = double.Parse(SystemConstants.XmlProject.Element("第" + i + "级轴串").Element("齿轮轴").Element("键槽h").Value); //键宽
l = double.Parse(SystemConstants.XmlProject.Element("第" + i + "级轴串").Element("齿轮轴").Element("键槽L").Value);//键长度
d = double.Parse(SystemConstants.XmlProject.Element("第" + i + "级轴串").Element("齿轮轴").Element("轴段5直径").Value);
FrmKeyStrength1 frm = new FrmKeyStrength1(i, t, d, b, h, l);
frm.Show();
}
if (i == 4)
{
KeyStrength4 frm = new KeyStrength4(i);
frm.Show();
}
}
private void button7_Click(object sender, EventArgs e)
{
string str = treeView1.SelectedNode.Text;
int i = Convert.ToInt32(str.Length == 5 ? str.Substring(1, 1) : str.Substring(1, 2));
FrmBearingLife frm = new FrmBearingLife(i);
frm.Show();
}
private void button1_Click(object sender, EventArgs e)
{
string str = treeView1.SelectedNode.Text;
int i = Convert.ToInt32(str.Length == 5 ? str.Substring(1, 1) : str.Substring(1, 2));
if (i == 4)
{
double t = double.Parse(SystemConstants.XmlProject.Element("第" + i + "级轴串").Element("动力参数").Element("扭矩").Value);
double d = double.Parse(SystemConstants.XmlProject.Element("第" + i + "级轴串").Element("齿轮轴").Element("轴段5直径").Value);
FrmInterferenceConnection1 childFrame = new FrmInterferenceConnection1(i, t, d);
childFrame.Show();
}
}
private void button3_Click(object sender, EventArgs e)
{
string str = treeView1.SelectedNode.Text;
int i = Convert.ToInt32(str.Length == 5 ? str.Substring(1, 1) : str.Substring(1, 2));
if (i == 4)
{
double t = double.Parse(SystemConstants.XmlProject.Element("第" + i + "级轴串").Element("受力计算参数").Element("T2").Value);
double d = double.Parse(SystemConstants.XmlProject.Element("第" + i + "级轴串").Element("齿轮轴").Element("轴段7直径").Value);
FrmInterferenceConnection1 childFrame = new FrmInterferenceConnection1(i, t, d);
childFrame.Show();
}
}
}
}