yangyin
2025-02-11 da347c236d0471baef64848e5756e750c0fa0075
WinFrmUI/DPumpHydr.WinFrmUI.Volute/MainViewPage_ExportImport.cs
@@ -18,11 +18,33 @@
        /// </summary>
        public void ExportXmlFile()
        {
            //if (_hdrBaseInfo == null)
            //{
            //    MessageBox.Show("您还没有完成定义参数!请定义完成后在进行导出!(至少完成第三步)");
            //    return;
            //}
            if (_hdrBaseInfo == null)
            {
                MessageBox.Show("您还没有完成定义参数!请定义完成后在进行导出!(至少完成第三步)");
                return;
                var currentStepID = this._stepTreeDockPanel.CurrentStepID;
                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);
                    }
                }
            }
            SaveFileDialog dlg = new SaveFileDialog();
            dlg.Title = "导出蜗壳信息";
            dlg.FileName = "蜗壳信息.xml";
@@ -33,8 +55,7 @@
                dlg.FileName,
                _hdrBaseInfo, 
                _geomBaseInfo, 
                _sectionBundleInfo,
                _outflowType,
                _sectionBundleInfo,
                _outflowParas,
                this._bodyThickness); 
        }
@@ -54,38 +75,30 @@
                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 )
                {
                    if (_ctrlHdrBaseInfo == null)
                    {
                        _ctrlHdrBaseInfo = new ctrlHdrBaseInfo();
                        _ctrlHdrBaseInfo.Name = "ctrlHdrBaseInfo";
                    }
                    _ctrlHdrBaseInfo.SetBindingData(_hdrBaseInfo);
                    _ctrlHdrBaseInfo.SetBindingData(_hdrBaseInfo);
                    _ctrlHdrBaseInfo.SetBindingData(_geomBaseInfo);
                    _ctrlHdrBaseInfo.SaveHistoryParas(_hdrBaseInfo, _geomBaseInfo);
                }
                #endregion
                #region  第二步
                if (_ctrlGeomBaseInfo != null)
                {
                    if (_ctrlGeomBaseInfo == null)
                    {
                        _ctrlGeomBaseInfo = new ctrlGeomBaseInfo();
                        _ctrlGeomBaseInfo.Name = "ctrlGeomBaseInfo";
                    }
                    _ctrlGeomBaseInfo.SetBindingData(_geomBaseInfo);
                }
                #endregion
                #region  第三步 断面总览
                #region  第2步 断面总览
                if (_sectionBundleInfo != null)
                {
                    if (_ctrlSectionBundleInfo == null)
@@ -93,10 +106,12 @@
                        _ctrlSectionBundleInfo = new ctrlSectionBundleInfo();
                        _ctrlSectionBundleInfo.Name = "ctrlSectionBaseInfo";
                        _ctrlSectionBundleInfo.OnRefreshShape += RefreshSectShapeWhole18;
                        _ctrlSectionBundleInfo.OnHightLightSectCurve += HightLightSectCurve;
                    }
                    _ctrlSectionBundleInfo.InitialParas(_hdrBaseInfo, _geomBaseInfo);
                    _ctrlSectionBundleInfo.SetBindingData(_sectionBundleInfo);
                    _ctrlSectionBundleInfo.ShowPage(_hdrBaseInfo, _geomBaseInfo,
                        DPumpHydr.ViewModel.eWizardStepDiretion.前进);
                    _ctrlSectionBundleInfo.RefreshAllSectPara(_sectionBundleInfo);
                    RefreshSectShapeWhole18(_sectionBundleInfo);
                }
                #endregion
@@ -104,33 +119,33 @@
        
                #region  出水面类型选择
                if (_outflowType != ViewModel.eOutflowStyle.未知)
                {
                    if (_ctrlSetOutflowType == null)
                    {
                        _ctrlSetOutflowType = new ctrlSetOutflowType();
                        _ctrlSetOutflowType.Name = "ctrlSetOutflowDim";
                    }
                    this._ctrlSetOutflowType.SetBindingData(_outflowType);
                }
                //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)
                    if (_ctrlSetOutflowParas == null)
                    {
                        _ctrlSetOutflowStyle = new ctrlSetOutflowParas();
                        _ctrlSetOutflowStyle.Name = "ctrlSetOutflowStyle";
                        _ctrlSetOutflowStyle.OnRefreshShape2D += CreateWaterBody2D;
                        _ctrlSetOutflowStyle.OnRefreshShape3D += CreateWaterBody3D;
                        _ctrlSetOutflowStyle.InitialParas(_outflowType, _hdrBaseInfo, _geomBaseInfo, _sectionBundleInfo);
                        _ctrlSetOutflowParas = new ctrlSetOutflowParas();
                        _ctrlSetOutflowParas.Name = "ctrlSetOutflowStyle";
                        _ctrlSetOutflowParas.OnRefreshShape2D += RefreshWaterBody2D;
                        _ctrlSetOutflowParas.OnRefreshShape3D += RefreshWaterBody3D;
                        _ctrlSetOutflowParas.InitialParas( _hdrBaseInfo, _geomBaseInfo, _sectionBundleInfo);
                    }
                    //CreateWaterBody2D(_outflowParas);
                    CreateWaterBody3D(_outflowParas);
                    RefreshWaterBody3D(_outflowParas);
                    
                    _ctrlSetOutflowStyle.SetBindingData(_outflowType,_outflowParas);
                    _ctrlSetOutflowParas.SetBindingData( _outflowParas);
                    #region  加厚
                    if (_bodyThickness>0)
@@ -144,10 +159,10 @@
                            _ctrlThicknessParas.Name = "ctrlThicknessParas";
                            _ctrlThicknessParas.OnRefreshShape += (houdu) => {
                                this._bodyThickness = houdu;
                                this._occDesign3dCtrl.CreateOutletBody3d(houdu);
                                this._occDesign3dCtrl.BuildThicknessBody(houdu);
                            };
                             _ctrlThicknessParas.InitialParas(_bodyThickness);
                            this._occDesign3dCtrl.CreateOutletBody3d(_bodyThickness);
                            this._occDesign3dCtrl.BuildThicknessBody(_bodyThickness);
                        }
 
                    }
@@ -176,7 +191,19 @@
            dlg.FileName = "蜗壳.stp";
            dlg.Filter = "stp文件 (*.stp)|*.stp";
            if (dlg.ShowDialog() == DialogResult.OK)
                this._occDesign3dCtrl.ExportWaterBodyFile(dlg.FileName, FileType.ESTEPFILE);
            {
                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);
            }
        }
      
        
@@ -197,7 +224,18 @@
            dlg.FileName = "蜗壳.igs";
            dlg.Filter = "igs文件 (*.igs)|*.igs";
            if (dlg.ShowDialog() == DialogResult.OK)
                this._occDesign3dCtrl.ExportWaterBodyFile(dlg.FileName, FileType.EIGESFILE);
            {
                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);
            }
        }
    }