From 1ecfbbf8b56f6c18f41cc1eead763c7fa93624ce Mon Sep 17 00:00:00 2001 From: tangxu <tangxu76880903> Date: 星期一, 13 一月 2025 09:26:49 +0800 Subject: [PATCH] 222 --- WinFrmUI/DPumpHydr.WinFrmUI.Volute/Occ/OccDesignBaseCtrl.cs | 432 ++++++++++++++++++++++++++++++++++-------------------- 1 files changed, 272 insertions(+), 160 deletions(-) diff --git a/WinFrmUI/DPumpHydr.WinFrmUI.Volute/Occ/OccDesignBaseCtrl.cs b/WinFrmUI/DPumpHydr.WinFrmUI.Volute/Occ/OccDesignBaseCtrl.cs index ac4bf61..1df0a02 100644 --- a/WinFrmUI/DPumpHydr.WinFrmUI.Volute/Occ/OccDesignBaseCtrl.cs +++ b/WinFrmUI/DPumpHydr.WinFrmUI.Volute/Occ/OccDesignBaseCtrl.cs @@ -1,6 +1,8 @@ using System; using System.Collections.Generic; -using System.Windows.Forms; +using System.Reflection.Metadata; +using System.Windows.Forms; +using DPumpHydr.WinFrmUI.Volute.ViewModel; using HydrEngineCSharp; namespace DPumpHydr.WinFrmUI.Volute @@ -8,35 +10,17 @@ public partial class OccDesignBaseCtrl : UserControl { protected HydrEngineCSharp.CDisplayView pDisplayView; - protected string strTurbopumpTopoShapeName = "蜗壳设计x"; - - + + public OccDesignBaseCtrl() { - InitializeComponent(); - - //this.DefaultDockArea = RLT.Enum.Crown.DockArea.Document; - //this._isDispCloseIcon = false ;//不能关闭 - - + //InitializeComponent(); this.MouseDown += OnMouseDown; this.MouseMove += OnMouseMove; this.MouseUp += OnMouseUp; this.MouseWheel += OnMouseWheel; - - - //string strTurbopumpTopoShapeName = "蜗壳设计" + (m_nNum++).ToString(); - //bool bSucc = pDisplayView.addTurbopumpTopoShape(strTurbopumpTopoShapeName); - //if (bSucc) - //{ - // m_nCreateCurve = 1; - // //MessageBox.Show("开始蜗壳设计"); - //} - - - } @@ -148,14 +132,10 @@ } protected bool _is3D = true; - - public void ClearAll() + + + public virtual void Initial() { - //pDisplayView.DeleteObject(strTurbopumpTopoShapeName); - //pDisplayView.addTurbopumpTopoShape(strTurbopumpTopoShapeName); - } - public virtual void Initial( ) - { } #region 1-8 截面设计 @@ -165,26 +145,64 @@ /// </summary> /// <param name="sender"></param> /// <param name="e"></param> - public void RefreshAllSectShape18(ViewModel.SectionBundleInfo bundle) + public List<int> RefreshAllSectShape18(ViewModel.SectionBundleInfo bundle) { if (_isFirstSectShape18) { - CreateSectShape18(bundle); + _isFirstSectShape18 = false; + return CreateSectShape18(bundle); } else { - EditSectShape18(bundle); + return EditSectShape18(bundle); } - _isFirstSectShape18 = false; + } - protected void CreateSectShape18(ViewModel.SectionBundleInfo bundle) + + double GetSectStartAngle() { - //pDisplayView.Update3DViews(_is3D); + if (_stype == eOutflowStyle.未知 || _stype == eOutflowStyle.中心出口_垂直法兰面流出) + return -HydrDisplayEngineBridge.PI_4; + else + return 0; + } + eOutflowStyle _stype = eOutflowStyle.中心出口_垂直法兰面流出; + public bool SetOutflowStyle(eOutflowStyle style) + { + if (_stype == style) + return false ; + bool isNeedRebuild = false; + if(style == eOutflowStyle.侧面出口_直线连接) + { + if(_stype != eOutflowStyle.侧面出口_直线连接) + { + isNeedRebuild = true ; + } + } + if (style != eOutflowStyle.侧面出口_直线连接) + { + if (_stype == eOutflowStyle.侧面出口_直线连接) + { + isNeedRebuild = true; + } + } + _stype = style; - double dStartAngle = -HydrDisplayEngineBridge.PI_4; + return isNeedRebuild; + } + /// <summary> + /// + /// </summary> + /// <param name="bundle"></param> + protected List<int> CreateSectShape18(ViewModel.SectionBundleInfo bundle) + { + List<int> error_sect = new List<int>(); - double dDetAngle = 2 * HydrDisplayEngineBridge.PI / 8; - for (int i = 8; i >=1; i--) + + double dStartAngle = GetSectStartAngle(); + + double dDetAngle = HydrDisplayEngineBridge.PI / 4; + for (int i = 8; i >= 1; i--) { var theSectionParam = bundle.ToSectionShapePara(i); @@ -198,7 +216,7 @@ dBaseWidth = theSectionParam.BaseWidth; dBaseCircleRadius = theSectionParam.BaseCircleRadius; - string wstrShapeNameI = string.Format("SectShape_{0}", theSectionParam.Index); + HydrProperties theHydrProperties = new HydrProperties(); @@ -210,38 +228,38 @@ } - - theHydrProperties.SetShapeName(wstrShapeNameI); + double dAngle = (8 - theSectionParam.Index) * dDetAngle + dStartAngle; + theHydrProperties.SetShapeGuid(GlobalParas.BuildSectShapeName(theSectionParam.Index)); pHydrGeomCurve.SetHydrProperties(theHydrProperties); - pHydrGeomCurve.SetGeomSection(dGama_Left, dGama_Right, dH, dR_out, dR_Left, dR_Right, dBaseWidth, dBaseCircleRadius); - //if (_is3D) - { - double dAngle = ( 8 - theSectionParam.Index ) * dDetAngle + dStartAngle; - BcGeMatrix theMatrix = BcGeMatrix.translate(0, dBaseCircleRadius, 0); - BcGeMatrix theMatrix1 = BcGeMatrix.rotate(-dAngle, 1.0, 0.0, 0.0); - theMatrix.postMult(theMatrix1); - pHydrGeomCurve.SetMatrix(theMatrix); - } + pHydrGeomCurve.SetGeomSection(dGama_Left, dGama_Right, dH, dR_out, dR_Left, dR_Right, dBaseWidth); + pHydrGeomCurve.SetMatrix(dAngle, dBaseCircleRadius); - pDisplayView.addVoluteCurve( theSectionParam.Index, pHydrGeomCurve); + + ToolTips tt = pDisplayView.addVoluteCurve(theSectionParam.Index, pHydrGeomCurve); + if (tt == null || tt.GetTipsId() != 1) + { + error_sect.Add(theSectionParam.Index); + } } - - Invalidate(true); - pDisplayView.FitAll3DViews(true); - + + Invalidate(true); + pDisplayView.FitAll3DViews(true); + return error_sect; } - - - protected void EditSectShape18(ViewModel.SectionBundleInfo bundle) + /// <summary> + /// + /// </summary> + /// <param name="bundle"></param> + public List<int> EditSectShape18(ViewModel.SectionBundleInfo bundle) { - pDisplayView.Update3DViews(_is3D); + List<int> error_sect = new List<int>(); - double dStartAngle = -HydrDisplayEngineBridge.PI_4; + double dStartAngle = GetSectStartAngle(); - double dDetAngle = 2 * HydrDisplayEngineBridge.PI / 8; + double dDetAngle = HydrDisplayEngineBridge.PI / 4; for (int i = 1; i <= 8; i++) { var theSectionParam = bundle.ToSectionShapePara(i); @@ -266,38 +284,48 @@ { continue; } + double dAngle = (8 - theSectionParam.Index) * dDetAngle + dStartAngle; - - theHydrProperties.SetShapeName(wstrShapeNameI); + //theHydrProperties.SetShapeName(wstrShapeNameI); pHydrGeomCurve.SetHydrProperties(theHydrProperties); - pHydrGeomCurve.SetGeomSection(dGama_Left, dGama_Right, dH, dR_out, dR_Left, dR_Right, dBaseWidth, dBaseCircleRadius); + pHydrGeomCurve.SetGeomSection(dGama_Left, dGama_Right, dH, dR_out, dR_Left, dR_Right, dBaseWidth); + pHydrGeomCurve.SetMatrix(dAngle, dBaseCircleRadius); //if (_is3D) - { - double dAngle = (8 - theSectionParam.Index) * dDetAngle + dStartAngle; - BcGeMatrix theMatrix = BcGeMatrix.translate(0, dBaseCircleRadius, 0); - BcGeMatrix theMatrix1 = BcGeMatrix.rotate(-dAngle, 1.0, 0.0, 0.0); - theMatrix.postMult(theMatrix1); - pHydrGeomCurve.SetMatrix(theMatrix); - } + //{ - pDisplayView.editVoluteCurve(wstrShapeNameI, pHydrGeomCurve); + // BcGeMatrix theMatrix = BcGeMatrix.translate(0, dBaseCircleRadius, 0); + // BcGeMatrix theMatrix1 = BcGeMatrix.rotate(-dAngle, 1.0, 0.0, 0.0); + // theMatrix.postMult(theMatrix1); + // pHydrGeomCurve.SetMatrix(theMatrix); + //} + + ToolTips tt = pDisplayView.editVoluteCurve(wstrShapeNameI, pHydrGeomCurve); + //pDisplayView.addVoluteCurve(theSectionParam.Index, pHydrGeomCurve); + if (tt == null || tt.GetTipsId() != 1) + { + error_sect.Add(theSectionParam.Index); + } } Invalidate(true); - + return error_sect; } - + + /// <summary> + /// + /// </summary> + /// <param name="theSectionParam"></param> public void RefreshSingleSectShape18(ViewModel.SectionShapePara theSectionParam) { - pDisplayView.Update3DViews(true ); + pDisplayView.Update3DViews(true); - double dStartAngle = -HydrDisplayEngineBridge.PI_4; + double dStartAngle = GetSectStartAngle(); - double dDetAngle = 2 * HydrDisplayEngineBridge.PI / 8; + double dDetAngle = HydrDisplayEngineBridge.PI / 4; double dGama_Left, dGama_Right, dH, dR_out, dR_Left, dR_Right, dBaseWidth, dBaseCircleRadius; @@ -310,8 +338,6 @@ dBaseWidth = theSectionParam.BaseWidth; dBaseCircleRadius = theSectionParam.BaseCircleRadius; - string wstrShapeNameI = string.Format("SectShape_{0}", theSectionParam.Index); - HydrProperties theHydrProperties = new HydrProperties(); HydrGeomCurve theHydrGeomCurve = HydrDisplayEngineBridge.CreateGeomCurve(HydrCurveType.EHydrGeomSection); @@ -321,105 +347,191 @@ return; } + double dAngle = (8 - theSectionParam.Index) * dDetAngle + dStartAngle; - - theHydrProperties.SetShapeName(wstrShapeNameI); + theHydrProperties.SetShapeGuid(GlobalParas.BuildSectShapeName(theSectionParam.Index)); pHydrGeomCurve.SetHydrProperties(theHydrProperties); - pHydrGeomCurve.SetGeomSection(dGama_Left, dGama_Right, dH, dR_out, dR_Left, dR_Right, dBaseWidth, dBaseCircleRadius); - //if (_is3D) - { - double dAngle = (8 - theSectionParam.Index) * dDetAngle + dStartAngle; - BcGeMatrix theMatrix = BcGeMatrix.translate(0, dBaseCircleRadius, 0); - BcGeMatrix theMatrix1 = BcGeMatrix.rotate(-dAngle, 1.0, 0.0, 0.0); - theMatrix.postMult(theMatrix1); - pHydrGeomCurve.SetMatrix(theMatrix); - } + pHydrGeomCurve.SetGeomSection(dGama_Left, dGama_Right, dH, dR_out, dR_Left, dR_Right, dBaseWidth); + pHydrGeomCurve.SetMatrix(dAngle, dBaseCircleRadius); - pDisplayView.editVoluteCurve(wstrShapeNameI, pHydrGeomCurve); - + pDisplayView.editVoluteCurve(GlobalParas.BuildSectShapeName(theSectionParam.Index), pHydrGeomCurve); - Invalidate(true); + + Invalidate(true); } + /// <summary> + /// + /// </summary> + /// <param name="isVisible"></param> + public void SetAllSectionCurveVisible(bool isVisible) + { + for (int i = 8; i >= 1; i--) + { + string wstrShapeNameI = string.Format("SectShape_{0}", i); + if (isVisible) + pDisplayView.showVoluteCurve(wstrShapeNameI); + else + pDisplayView.hideVoluteCurve(wstrShapeNameI); + } + } + /// <summary> + /// + /// </summary> + /// <param name="sectIndex"></param> + public void HightLightSectCurve(int sectIndex) + { + for (int i = 1; i <= 8; i++) + { + if (i == sectIndex) + this.pDisplayView.setVoluteCurveClr(i, 255, 0, 255); + else + this.pDisplayView.setVoluteCurveClr(i, 100, 149, 237); + } - - + Invalidate(true); + } #endregion - protected double theRad = 70.0; - protected double theHigh = 300.0; - protected double theOffset = 0.0; - protected double m_dTopValue = 1.0; - protected double m_dBtmValue = 1.0; - protected string ShapeNameOutflowBody = "OutflowBody"; - protected double dAngle = 70; - - protected double m_dMPlnBasePtScaleValue = 2.0; - protected double m_dMPlnOuterPtScaleValue = 2.0; - protected bool CreateWaterBody(HydrEngineCSharp.BcGePoint theMPlnBasePt, HydrEngineCSharp.BcGePoint theMPlnOuterPt) + + #region 水体 + + public HydrGeomSplineParam Create2DWaterBody(DPumpHydr.WinFrmUI.Volute.ViewModel.OtuflowParas outflowParas) { - + if (this._is3D) + return null; + WaterBodyOuterParam theWaterBodyOuterParam = new WaterBodyOuterParam(); + theWaterBodyOuterParam.SetOuterOffset(outflowParas.Offset); + theWaterBodyOuterParam.SetOuterHigh(outflowParas.Heigh); + theWaterBodyOuterParam.SetOuterRad(outflowParas.Dia / 2); + theWaterBodyOuterParam.SetTopValue2(outflowParas.Tangent_Top_Right); + theWaterBodyOuterParam.SetBtmValue2(outflowParas.Tangent_Btm_Right); + theWaterBodyOuterParam.SetTopValue1(outflowParas.Tangent_Top_Left); + theWaterBodyOuterParam.SetBtmValue1(outflowParas.Tangent_Btm_Left); + theWaterBodyOuterParam.SetH1(outflowParas.H1); + theWaterBodyOuterParam.SetH2(outflowParas.H2); + theWaterBodyOuterParam.SetRadConner(outflowParas.Septalradius); - WaterBodyOuterParam m_theWaterBodyOuterParam = new WaterBodyOuterParam(); - //theWaterBodyOuterParam.SetOuterOffset(theOffset); - //theWaterBodyOuterParam.SetOuterHigh(theHigh); - //theWaterBodyOuterParam.SetOuterRad(theRad); - //theWaterBodyOuterParam.SetTopValue(m_dTopValue); - //theWaterBodyOuterParam.SetBtmValue(m_dBtmValue); - double dOuterOffset = 0.0; - double dOuterHigh = 520.0; - double dOuterRad = 80.0; - double dOuterTopValue = m_dTopValue; - double dOuterBtmValue = m_dBtmValue; - double dH1 = 10; - double dH2 = 0; - double m_dRadConner = 8; - m_theWaterBodyOuterParam.SetOuterOffset(dOuterOffset); - m_theWaterBodyOuterParam.SetOuterHigh(dOuterHigh); - m_theWaterBodyOuterParam.SetOuterRad(dOuterRad); - m_theWaterBodyOuterParam.SetTopValue1(dOuterTopValue); - m_theWaterBodyOuterParam.SetBtmValue1(dOuterBtmValue); - m_theWaterBodyOuterParam.SetTopValue2(dOuterTopValue); - m_theWaterBodyOuterParam.SetBtmValue2(dOuterBtmValue); - m_theWaterBodyOuterParam.SetH1(dH1); - m_theWaterBodyOuterParam.SetH2(dH2); - m_theWaterBodyOuterParam.SetRadConner(m_dRadConner); - var m_theHydrGeomSplineParam = this.Create2DWaterBody(m_theWaterBodyOuterParam); - //if (this._is3D) - //{ - // string wstrName = "水体"; - // string wstrShapeNameI = wstrName; - // HydrGeomCurve theHydrGeomCurve = HydrDisplayEngineBridge.CreateGeomCurve(HydrCurveType.EHydrGeomCircle); - // HydrProperties theHydrProperties = new HydrProperties(); - // theHydrProperties.SetShapeName(wstrShapeNameI); - // theHydrGeomCurve.SetHydrProperties(theHydrProperties); - // pDisplayView.buildWaterBody(wstrShapeNameI, m_dMPlnBasePtScaleValue, m_dMPlnOuterPtScaleValue, theMPlnBasePt, theMPlnOuterPt, m_theWaterBodyOuterParam); - // Invalidate(true); - // pDisplayView.FitAll3DViews(true); - //} - //else - //{ - // //pDisplayView.build2DMidCurve(theWaterBodyOuterParam); - // //pDisplayView.build2DMidCurveFillet(dAngle, m_dMPlnBasePtScaleValue, m_dMPlnOuterPtScaleValue); - // //Invalidate(true); - // //pDisplayView.FitAll3DViews(true); - //} - return true; - } - public HydrGeomSplineParam Create2DWaterBody(WaterBodyOuterParam theWaterBodyOuterParam) - { - if (!this._is3D) + ToolTips theToolTips = pDisplayView.build2DMidCurve(theWaterBodyOuterParam); + if (theToolTips == null) + return null; + Invalidate(true); + pDisplayView.FitAll3DViews(true); + + pDisplayView.set2DMidCurveClr( + DPumpHydr.WinFrmUI.Volute.GlobalParas.WaterBoudaryColor.R, + DPumpHydr.WinFrmUI.Volute.GlobalParas.WaterBoudaryColor.G, + DPumpHydr.WinFrmUI.Volute.GlobalParas.WaterBoudaryColor.B); + + if (theToolTips.GetTipsId() == 1) { - pDisplayView.build2DMidCurve(theWaterBodyOuterParam); - Invalidate(true); - pDisplayView.FitAll3DViews(true); return pDisplayView.getHydrGeomSplineParam(); } - return new HydrGeomSplineParam(); + else + { + return null; + } + } + + public ToolTips Create3DWaterBody(DPumpHydr.WinFrmUI.Volute.ViewModel.OtuflowParas outflowParas, HydrGeomSplineParam theHydrGeomSplineParam) + { + if (!this._is3D) + return null; + if (theHydrGeomSplineParam == null) + return null; + + WaterBodyOuterParam theWaterBodyOuterParam = new WaterBodyOuterParam(); + theWaterBodyOuterParam.SetOuterOffset(outflowParas.Offset); + theWaterBodyOuterParam.SetOuterHigh(outflowParas.Heigh); + theWaterBodyOuterParam.SetOuterRad(outflowParas.Dia / 2); + theWaterBodyOuterParam.SetTopValue2(outflowParas.Tangent_Top_Right); + theWaterBodyOuterParam.SetBtmValue2(outflowParas.Tangent_Btm_Right); + theWaterBodyOuterParam.SetTopValue1(outflowParas.Tangent_Top_Left); + theWaterBodyOuterParam.SetBtmValue1(outflowParas.Tangent_Btm_Left); + theWaterBodyOuterParam.SetH1(outflowParas.H1); + theWaterBodyOuterParam.SetH2(outflowParas.H2); + theWaterBodyOuterParam.SetRadConner(outflowParas.Septalradius); + + + + // HydrGeomCurve theHydrGeomCurve = HydrDisplayEngineBridge.CreateGeomCurve(HydrCurveType.EHydrGeomCircle); + HydrProperties theHydrProperties = new HydrProperties(); + theHydrProperties.SetShapeGuid(DPumpHydr.WinFrmUI.Volute.GlobalParas.WaterBodyShapeName); + theHydrProperties.SetShapeColor( + DPumpHydr.WinFrmUI.Volute.GlobalParas.WaterBodyColor.R, + DPumpHydr.WinFrmUI.Volute.GlobalParas.WaterBodyColor.G, + DPumpHydr.WinFrmUI.Volute.GlobalParas.WaterBodyColor.B, 256); + // theHydrGeomCurve.SetHydrProperties(theHydrProperties); + if (pDisplayView.hasBuildThicknessBody()) + pDisplayView.ClearTopoShape(TopoTypeDisplay.EThicknessBody); + var tt = pDisplayView.buildWaterBody(theHydrProperties, theHydrGeomSplineParam, theWaterBodyOuterParam); + Invalidate(true); + pDisplayView.FitAll3DViews(true); + + return tt; + } + + + + public ToolTips Edit3DWaterBody(DPumpHydr.WinFrmUI.Volute.ViewModel.OtuflowParas outflowParas, HydrGeomSplineParam theHydrGeomSplineParam) + { + if (!this._is3D) + return null; + + + if (theHydrGeomSplineParam != null) + { + WaterBodyOuterParam theWaterBodyOuterParam = new WaterBodyOuterParam(); + theWaterBodyOuterParam.SetOuterOffset(outflowParas.Offset); + theWaterBodyOuterParam.SetOuterHigh(outflowParas.Heigh); + theWaterBodyOuterParam.SetOuterRad(outflowParas.Dia / 2); + theWaterBodyOuterParam.SetTopValue2(outflowParas.Tangent_Top_Right); + theWaterBodyOuterParam.SetBtmValue2(outflowParas.Tangent_Btm_Right); + theWaterBodyOuterParam.SetTopValue1(outflowParas.Tangent_Top_Left); + theWaterBodyOuterParam.SetBtmValue1(outflowParas.Tangent_Btm_Left); + theWaterBodyOuterParam.SetH1(outflowParas.H1); + theWaterBodyOuterParam.SetH2(outflowParas.H2); + theWaterBodyOuterParam.SetRadConner(outflowParas.Septalradius); + + if (pDisplayView.hasBuildThicknessBody()) + pDisplayView.ClearTopoShape(TopoTypeDisplay.EThicknessBody);// + + var tt = pDisplayView.rebuildWaterBody(theHydrGeomSplineParam, theWaterBodyOuterParam); + if (tt == null) + return null; + if(tt.GetTipsId () != 1) + { + + } + Invalidate(true); + + return tt; + } + return null; + } + /// <summary> + /// 割舌的角度 + /// </summary> + /// <returns></returns> + public double Get2DMidCurveAngleParam() + { + return pDisplayView.get2DMidCurveAngleParam(); + } + #endregion + + + + public bool ClearAll() + { + _isFirstSectShape18 = true; + var ret = pDisplayView.ClearTopoShape(TopoTypeDisplay.EAllBody); + //bool bSucc = pDisplayView.BeginTurbopumpTopoShape(DPumpHydr.WinFrmUI.Volute.GlobalParas.RootTopoShapeName); + + return ret; } } } -- Gitblit v1.9.3