tangxu
2025-02-18 9009527f6b64587376f3901596005ae57287af78
WinFrmUI/DPumpHydr.WinFrmUI.Volute/MainViewPage_ExportImport.cs
@@ -4,10 +4,7 @@
using System.IO;
using System.Text;
using System.Drawing;
using HydrEngineCSharp;
using DPumpHydr.WinFrmUI.RLT.Native;
using DPumpHydr.WinFrmUI.RLT.Docking.Crown;
using DPumpHydr.WinFrmUI.Volute.TempCtrl;
using HydrEngineCSharp;
namespace DPumpHydr.WinFrmUI.Volute
{
@@ -18,11 +15,49 @@
        /// </summary>
        public void ExportXmlFile()
        {
            //if (_hdrBaseInfo == null)
            //{
            //    MessageBox.Show("您还没有完成定义参数!请定义完成后在进行导出!(至少完成第三步)");
            //    return;
            //}
            var currentStepID = this._stepTreeDockPanel.CurrentStepID;
            if (_hdrBaseInfo == null)
            {
                MessageBox.Show("您还没有完成定义参数!请定义完成后在进行导出!(至少完成第三步)");
                return;
                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";
@@ -33,8 +68,7 @@
                dlg.FileName,
                _hdrBaseInfo, 
                _geomBaseInfo, 
                _sectionBundleInfo,
                _outflowType,
                _sectionBundleInfo,
                _outflowParas,
                this._bodyThickness); 
        }
@@ -54,15 +88,18 @@
                dlg.FileName,
                out  _hdrBaseInfo,
                out _geomBaseInfo,
                out _sectionBundleInfo,
                out _outflowType,
                out _sectionBundleInfo,
                out _outflowParas,
                out this._bodyThickness);
            if(ret)
            {
                this._occDesign2dCtrl.ClearAll();
                this._occDesign3dCtrl.ClearAll();
                #region  第一步 
                if(_hdrBaseInfo != null )
                {
                if (_hdrBaseInfo == null)
                    return;
                    if (_ctrlHdrBaseInfo == null)
                    {
                        _ctrlHdrBaseInfo = new ctrlHdrBaseInfo();
@@ -71,85 +108,74 @@
                    _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)
                {
                    if (_ctrlSectionBundleInfo == null)
                    {
                        _ctrlSectionBundleInfo = new ctrlSectionBundleInfo();
                        _ctrlSectionBundleInfo.Name = "ctrlSectionBaseInfo";
                        _ctrlSectionBundleInfo.OnRefreshShape += RefreshSectShapeWhole18;
                    }
                    _ctrlSectionBundleInfo.ShowPage(_hdrBaseInfo, _geomBaseInfo,
                        DPumpHydr.ViewModel.eWizardStepDiretion.前进);
                    _ctrlSectionBundleInfo.RefreshAllSectPara(_sectionBundleInfo);
                    RefreshSectShapeWhole18(_sectionBundleInfo);
                }
                if (_sectionBundleInfo == null)
                    return;
                CreateSectionStepCtrl();
                DockStepParaCtrl(_ctrlSectionBundleInfo);
                _ctrlSectionBundleInfo.ShowPage(_hdrBaseInfo, _geomBaseInfo,
                        DPumpHydr.ViewModel.eWizardStepDiretion.前进, true);
                _ctrlSectionBundleInfo.RefreshAllSectPara(_sectionBundleInfo);
                RefreshSectShapeWhole18(_sectionBundleInfo);
                _stepTreeDockPanel.SetFocusedNode(this._stepTreeDockPanel.Step_ID_Section18_Full);
                #endregion
                #region  出水面类型选择
                if (_outflowType != ViewModel.eOutflowStyle.未知)
                {
                    if (_ctrlSetOutflowType == null)
                    {
                        _ctrlSetOutflowType = new ctrlSetOutflowType();
                        _ctrlSetOutflowType.Name = "ctrlSetOutflowDim";
                    }
                    this._ctrlSetOutflowType.SetBindingData(_outflowType);
                }
                #endregion
                #region  出水面参数
                if (_outflowParas != null)
                {
                    if (_ctrlSetOutflowStyle == null)
                    {
                        _ctrlSetOutflowStyle = new ctrlSetOutflowParas();
                        _ctrlSetOutflowStyle.Name = "ctrlSetOutflowStyle";
                        _ctrlSetOutflowStyle.OnRefreshShape2D += CreateWaterBody2D;
                        _ctrlSetOutflowStyle.OnRefreshShape3D += CreateWaterBody3D;
                        _ctrlSetOutflowStyle.InitialParas(_outflowType, _hdrBaseInfo, _geomBaseInfo, _sectionBundleInfo);
                    }
                    //CreateWaterBody2D(_outflowParas);
                    CreateWaterBody3D(_outflowParas);
                if (_outflowParas == null)
                    return;
                CreateOutflowStepCtrl();
                    _ctrlSetOutflowStyle.SetBindingData(_outflowType,_outflowParas);
                DockStepParaCtrl(_ctrlSetOutflowParas);
                    #region  加厚
                    if (_bodyThickness>0)
                    {
                        Rbtn数据导出STP.Visible = true;
                        Rbtn数据导出IGS.Visible = true;
                InitilOutflowStepCtrl(this._stepTreeDockPanel.Step_ID_Section18_Full);
                        if (_ctrlThicknessParas == null)
                        {
                            _ctrlThicknessParas = new ctrlThicknessParas();
                            _ctrlThicknessParas.Name = "ctrlThicknessParas";
                            _ctrlThicknessParas.OnRefreshShape += (houdu) => {
                                this._bodyThickness = houdu;
                                this._occDesign3dCtrl.BuildThicknessBody(houdu);
                            };
                             _ctrlThicknessParas.InitialParas(_bodyThickness);
                            this._occDesign3dCtrl.BuildThicknessBody(_bodyThickness);
                        }
                    }
                    #endregion
                }
                this._occDesign2dCtrl.SetAllSectionCurveVisible(false);
                this._occDesign3dCtrl.SetAllSectionCurveVisible(false);
                _stepTreeDockPanel.SetFocusedNode(this._stepTreeDockPanel.Step_ID_Outflow_Paras);
                #endregion
                #region  加厚
                if (_bodyThickness < 1)
                    return;
                CreateThicknessStepCtrl();
                InitilThicknessStepCtrl(this._stepTreeDockPanel.Step_ID_Outflow_Paras);
                DockStepParaCtrl(_ctrlThicknessParas);
                _stepTreeDockPanel.SetFocusedNode(this._stepTreeDockPanel.Step_ID_jiahout);
                //{
                //    Rbtn数据导出STP.Visible = true;
                //    Rbtn数据导出IGS.Visible = true;
                //    if (_ctrlThicknessParas == null)
                //    {
                //        _ctrlThicknessParas = new ctrlThicknessParas();
                //        _ctrlThicknessParas.Name = "ctrlThicknessParas";
                //        _ctrlThicknessParas.OnRefreshShape += (houdu) =>
                //        {
                //            this._bodyThickness = houdu;
                //            this._occDesign3dCtrl.BuildThicknessBody(houdu);
                //        };
                //        _ctrlThicknessParas.InitialParas(_bodyThickness);
                //        this._occDesign3dCtrl.BuildThicknessBody(_bodyThickness);
                //    }
                //}
                #endregion
            }
        }
        /// <summary>
@@ -175,8 +201,7 @@
    dlg.FileName.Replace(".stp", ".xml"),
    _hdrBaseInfo,
    _geomBaseInfo,
    _sectionBundleInfo,
    _outflowType,
    _sectionBundleInfo,
    _outflowParas,
    this._bodyThickness);
            }
@@ -209,8 +234,7 @@
    dlg.FileName.Replace(".stp", ".igs"),
    _hdrBaseInfo,
    _geomBaseInfo,
    _sectionBundleInfo,
    _outflowType,
    _sectionBundleInfo,
    _outflowParas,
    this._bodyThickness);
            }