chenn
2025-04-11 ce0cdf82989d5fead5618d1988a7d1aba9746d57
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
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using System.IO;
using System.Text;
using System.Drawing;
using HydrEngineCSharp; 
 
namespace DPumpHydr.WinFrmUI.Volute
{
    public partial class MainViewPage : System.Windows.Forms.UserControl
    {
        /// <summary>
        /// 蜗壳参数导出
        /// </summary>
        public void ExportXmlFile()
        {
            //if (_hdrBaseInfo == null)
            //{
            //    MessageBox.Show("您还没有完成定义参数!请定义完成后在进行导出!(至少完成第三步)");
            //    return;
            //}
            var currentStepID = this._stepTreeDockPanel.CurrentStepID;
            if (_hdrBaseInfo == null)
            {
                if (currentStepID == this._stepTreeDockPanel.Step_ID_Hdr_Base_Info)
                {
                    if (!SaveParaStep1())
                    {
                        MessageBox.Show("您还没有完成定义参数!请该界面全部输入完成后在进行导出!");
                        return;
                    }
                    if (_sectionBundleInfo == null)
                    {
                        _sectionBundleInfo = new ViewModel.SectionBundleInfo();
 
                        _sectionBundleInfo.BaseWidth = _geomBaseInfo.B3;
                        _sectionBundleInfo.BaseCircleRadius = _geomBaseInfo.D3 / 2;
 
                        _sectionBundleInfo.ResetAllParas(_hdrBaseInfo, _geomBaseInfo);
                    }
                }
            }
            #region 暂时需要导出目前页面的值,并没有进行判断,测试使用
            if (currentStepID == this._stepTreeDockPanel.Step_ID_Hdr_Base_Info)
            {
                if (!SaveParaStep1())
                    return ;
            }
            else if (currentStepID == this._stepTreeDockPanel.Step_ID_Section18_Full)
            {
                if (!SaveParaStep2())
                    return ;
            }
            else if (currentStepID == this._stepTreeDockPanel.Step_ID_Outflow_Paras)
            {
                if (!SaveParaStep3())
                    return ;
            }
            #endregion
            SaveFileDialog dlg = new SaveFileDialog();
            dlg.Title = "导出蜗壳信息";
            dlg.FileName = "蜗壳信息.xml";
            dlg.Filter = "xml文件 (*.xml)|*.xml";
            if (dlg.ShowDialog() != DialogResult.OK)
                return;
            new DPumpHydr.WinFrmUI.VoluteXmlParasTranHelper().Save(
                dlg.FileName,
                _hdrBaseInfo, 
                _geomBaseInfo, 
                _sectionBundleInfo, 
                _outflowParas,
                this._bodyThickness); 
        }
 
        /// <summary>
        /// 蜗壳参数导入
        /// </summary>
        public void ImportXmlFile()
        { 
            OpenFileDialog dlg = new OpenFileDialog();
            dlg.Title = "导入蜗壳信息";
            dlg.FileName = "蜗壳信息.xml";
            dlg.Filter = "xml文件 (*.xml)|*.xml";
            if (dlg.ShowDialog() != DialogResult.OK)
                return;
            var ret = new DPumpHydr.WinFrmUI.VoluteXmlParasTranHelper().Read(
                dlg.FileName,
                out  _hdrBaseInfo,
                out _geomBaseInfo,
                out _sectionBundleInfo, 
                out _outflowParas,
                out this._bodyThickness);
            if(ret)
            {
                this._occDesign2dCtrl.ClearAll();
                this._occDesign3dCtrl.ClearAll();
 
                #region  第一步 
                if (_hdrBaseInfo == null)
                    return;
                
                    if (_ctrlHdrBaseInfo == null)
                    {
                        _ctrlHdrBaseInfo = new ctrlHdrBaseInfo();
                        _ctrlHdrBaseInfo.Name = "ctrlHdrBaseInfo";
                    }
                    _ctrlHdrBaseInfo.SetBindingData(_hdrBaseInfo);
                    _ctrlHdrBaseInfo.SetBindingData(_geomBaseInfo);
                    _ctrlHdrBaseInfo.SaveHistoryParas(_hdrBaseInfo, _geomBaseInfo);
                _stepTreeDockPanel.SetFocusedNode(this._stepTreeDockPanel.Step_ID_Hdr_Base_Info);
                #endregion
 
 
                #region  第2步 断面总览
                if (_sectionBundleInfo == null)
                    return;
                CreateSectionStepCtrl();
                _isHaveCreateWaterBody3d = false;
                DockStepParaCtrl(_ctrlSectionBundleInfo);
                if(_ctrlSectionBundleInfo != null)
                {
                    _ctrlSectionBundleInfo.SetBindingData(_sectionBundleInfo);
                }
                _ctrlSectionBundleInfo.ShowPage(_hdrBaseInfo, _geomBaseInfo,
                        DPumpHydr.ViewModel.eWizardStepDiretion.前进, false);
                _ctrlSectionBundleInfo.RefreshAllSectPara(_sectionBundleInfo);
                RefreshSectShapeWhole18(_sectionBundleInfo);
                _stepTreeDockPanel.SetFocusedNode(this._stepTreeDockPanel.Step_ID_Section18_Full);
                #endregion
 
 
                #region  出水面参数
                if (_outflowParas == null)
                    return;
                CreateOutflowStepCtrl();
                _isHaveCreateWaterBody3d = false;
                DockStepParaCtrl(_ctrlSetOutflowParas);
                _ctrlSetOutflowParas.Isxml = true;
                InitilOutflowStepCtrl(this._stepTreeDockPanel.Step_ID_Section18_Full);
 
                this._occDesign2dCtrl.SetAllSectionCurveVisible(false);
                this._occDesign3dCtrl.SetAllSectionCurveVisible(false);
 
                RbtnChk标注.Visible = true;
                _stepTreeDockPanel.SetFocusedNode(this._stepTreeDockPanel.Step_ID_Outflow_Paras);
 
                #endregion
 
 
                #region  加厚
                if (_bodyThickness < 1)
                    return;
                InitilThicknessStepCtrl(this._stepTreeDockPanel.Step_ID_Outflow_Paras,_bodyThickness);
 
                DockStepParaCtrl(_ctrlThicknessParas);
                _stepTreeDockPanel.SetFocusedNode(this._stepTreeDockPanel.Step_ID_Thickness);
                GoNextStep();
 
                RbtnChk标注.Visible = true;
                #endregion
            }
        }
        
 
 
        /// <summary>
        /// 蜗壳参数导出
        /// </summary>
        public void ExportStpFile()
        {
            if (_hdrBaseInfo == null)
            {
                MessageBox.Show("您还没有完成定义参数!请定义完成后在进行导出!(至少完成第三步)");
                return;
            }
            SaveFileDialog dlg = new SaveFileDialog();
            dlg.Title = "导出蜗壳";
            dlg.FileName = "蜗壳.stp";
            dlg.Filter = "stp文件 (*.stp)|*.stp";
            if (dlg.ShowDialog() == DialogResult.OK)
            {
                this._occDesign3dCtrl.ExportThicknessBody(dlg.FileName.Replace(".stp", "_body.stp"), FileType.ESTEPFILE);
                this._occDesign3dCtrl.ExportWaterBodyFile(dlg.FileName.Replace(".stp","_water.stp"), FileType.ESTEPFILE);
 
                new DPumpHydr.WinFrmUI.VoluteXmlParasTranHelper().Save(
    dlg.FileName.Replace(".stp", ".xml"),
    _hdrBaseInfo,
    _geomBaseInfo,
    _sectionBundleInfo, 
    _outflowParas,
    this._bodyThickness);
            }
                
        }
      
        
        
        /// <summary>
        /// 蜗壳参数导出
        /// </summary>
        public void ExportIgsFile()
        {
            if (_hdrBaseInfo == null)
            {
                MessageBox.Show("您还没有完成定义参数!请定义完成后在进行导出!(至少完成第三步)");
                return;
            }
 
            SaveFileDialog dlg = new SaveFileDialog();
            dlg.Title = "导出蜗壳";
            dlg.FileName = "蜗壳.igs";
            dlg.Filter = "igs文件 (*.igs)|*.igs";
            if (dlg.ShowDialog() == DialogResult.OK)
            {
                this._occDesign3dCtrl.ExportThicknessBody(dlg.FileName.Replace(".igs", "_body.igs"), FileType.EIGESFILE);
                this._occDesign3dCtrl.ExportWaterBodyFile(dlg.FileName.Replace(".igs", "_water.igs"), FileType.EIGESFILE);
 
                new DPumpHydr.WinFrmUI.VoluteXmlParasTranHelper().Save(
    dlg.FileName.Replace(".stp", ".igs"),
    _hdrBaseInfo,
    _geomBaseInfo,
    _sectionBundleInfo, 
    _outflowParas,
    this._bodyThickness);
            } 
 
        }
    }
}