From 9dba1b6adc0bbb4aa8cc531f4e6d822bf1a56be3 Mon Sep 17 00:00:00 2001
From: chenn <gu.beic@qq.com>
Date: 星期五, 28 三月 2025 17:45:48 +0800
Subject: [PATCH] 添加例子

---
 WinFrmUI/DPumpHydr.WinFrmUI.Volute/断面设计/ctrlSectionBundleInfo.cs |   86 +++++++++++++++++++++++++++++++++----------
 1 files changed, 66 insertions(+), 20 deletions(-)

diff --git "a/WinFrmUI/DPumpHydr.WinFrmUI.Volute/\346\226\255\351\235\242\350\256\276\350\256\241/ctrlSectionBundleInfo.cs" "b/WinFrmUI/DPumpHydr.WinFrmUI.Volute/\346\226\255\351\235\242\350\256\276\350\256\241/ctrlSectionBundleInfo.cs"
index cd79529..83b7c4a 100644
--- "a/WinFrmUI/DPumpHydr.WinFrmUI.Volute/\346\226\255\351\235\242\350\256\276\350\256\241/ctrlSectionBundleInfo.cs"
+++ "b/WinFrmUI/DPumpHydr.WinFrmUI.Volute/\346\226\255\351\235\242\350\256\276\350\256\241/ctrlSectionBundleInfo.cs"
@@ -171,25 +171,31 @@
         ViewModel.GeomBaseInfo _geomBaseInfo = null;
         public void SetBindingData(ViewModel.SectionBundleInfo sectionBundle_info)
         {
-            _sectionBundleInfo= sectionBundle_info;
+            _sectionBundleInfo = sectionBundle_info;
         }
 
-
+        /// <summary>
+        /// 鏄剧ず鐣岄潰
+        /// </summary>
+        /// <param name="base_info">鍩烘湰鍙傛暟</param>
+        /// <param name="geom_info">鍩哄渾鍙傛暟</param>
+        /// <param name="step_direction">鍓嶈繘/鍚庨��</param>
+        /// <param name="isRefreshModel">鏄惁闇�瑕佽鐩栨柇闈㈠弬鏁�</param>
         public void ShowPage(
             ViewModel.HdrBaseInfo base_info,
             ViewModel.GeomBaseInfo geom_info,
-            DPumpHydr.ViewModel.eWizardStepDiretion step_direction, bool isRefreshModel = true)
+            DPumpHydr.ViewModel.eWizardStepDiretion step_direction, bool isRefreshModel = false)
         {
             if (step_direction == DPumpHydr.ViewModel.eWizardStepDiretion.鍚庨��)
             {
                 return;
             }
-            if(_hdrBaseInfo == null && _geomBaseInfo == null)
+            if (_hdrBaseInfo == null && _geomBaseInfo == null)
             {
                 _hdrBaseInfo = base_info;
                 _geomBaseInfo = geom_info;
             }
-            if (isRefreshModel )
+            if (!isRefreshModel)
             {
                 return;
             }
@@ -207,7 +213,7 @@
             else
             {
                 if (Math.Abs(_sectionBundleInfo.BaseWidth - _geomBaseInfo.B3) < 1 &&
-                    Math.Abs(_sectionBundleInfo.BaseCircleRadius - _geomBaseInfo.D3 / 2) < 1 )
+                    Math.Abs(_sectionBundleInfo.BaseCircleRadius - _geomBaseInfo.D3 / 2) < 1)
                 {
 
                     _sectionBundleInfo.BaseWidth = _geomBaseInfo.B3;
@@ -245,8 +251,6 @@
             }
 
             RefreshAllSectPara(_sectionBundleInfo);
-
-            
 
             RefreshShape(_sectionBundleInfo);
         }
@@ -370,13 +374,13 @@
                 error = "璇疯緭鍏ュ繀濉」锛�";
                 isOk = false;
             }
-            if (string.IsNullOrEmpty(skyTextBox鏂潰y18.Text) || (!RBtn鐭╁舰.Checked && double.Parse(skyTextBox鏂潰y18.Text) == 0)|| double.Parse(skyTextBox鏂潰y18.Text) < 0)
+            if (string.IsNullOrEmpty(skyTextBox鏂潰y18.Text) || (!RBtn鐭╁舰.Checked && double.Parse(skyTextBox鏂潰y18.Text) == 0) || double.Parse(skyTextBox鏂潰y18.Text) < 0)
             {
                 error = "璇疯緭鍏ュ繀濉」锛�";
                 isOk = false;
 
             }
-            if (string.IsNullOrEmpty(skyTextBox鏂潰r18.Text) || (!RBtn鐭╁舰.Checked && double.Parse(skyTextBox鏂潰r18.Text) == 0)|| double.Parse(skyTextBox鏂潰y18.Text) < 0)
+            if (string.IsNullOrEmpty(skyTextBox鏂潰r18.Text) || (!RBtn鐭╁舰.Checked && double.Parse(skyTextBox鏂潰r18.Text) == 0) || double.Parse(skyTextBox鏂潰y18.Text) < 0)
             {
                 error = "璇疯緭鍏ュ繀濉」锛�";
                 isOk = false;
@@ -463,7 +467,22 @@
                 int index = Convert.ToInt32(lastChar);
                 if (!double.TryParse(skytextBox.Text, out double result) && !string.IsNullOrEmpty(skytextBox.Text))
                 {
+                    result = _sectionBundleInfo.GaMa_Left[index];
                     skytextBox.Text = _sectionBundleInfo.GaMa_Left[index].ToString();
+                }else if(result>45)
+                {
+                    MessageBox.Show("璇疯緭鍏ュ皬浜�45搴︾殑瑙掑害");
+                    skytextBox.Text = _sectionBundleInfo.GaMa_Left[index].ToString();
+                }
+                else
+                {
+                    //var initialR = _sectionBundleInfo.CalInitialR(_hdrBaseInfo, _geomBaseInfo);
+                    var height = _sectionBundleInfo.CalcHeight(_geomBaseInfo, index, result, _sectionBundleInfo.R_Left[index]);
+                    var R = _sectionBundleInfo.CheckChamferR(height, index, result, _sectionBundleInfo.R_Left[index]);
+                    SkyTextBox controlh1 = this.Controls.Find($"skyTextBox鏂潰H1{index}", true).FirstOrDefault() as SkyTextBox;
+                    SkyTextBox controlr1 = this.Controls.Find($"skyTextBox鏂潰r1{index}", true).FirstOrDefault() as SkyTextBox;
+                    controlh1.Text = height.ToString();
+                    controlr1.Text = R.ToString();
                 }
             }
         }
@@ -478,7 +497,7 @@
                 {
                     skytextBox.Text = _sectionBundleInfo.GaMa_Right[index].ToString();
                 }
-                if (string.IsNullOrEmpty(skytextBox.Text))
+                if (string.IsNullOrEmpty(skytextBox.Text) || Convert.ToDouble(skytextBox.Text) == 0)
                 {
                     MessageBox.Show("r涓嶅悎鐞嗭紒璇烽噸鏂拌緭鍏�");
                 }
@@ -507,7 +526,7 @@
             SkyTextBox controlGaMa1 = this.Controls.Find($"skyTextBox鏂潰y1{index}", true).FirstOrDefault() as SkyTextBox;
             SkyTextBox controlh1 = this.Controls.Find($"skyTextBox鏂潰H1{index}", true).FirstOrDefault() as SkyTextBox;
             if (string.IsNullOrEmpty(controlr1.Text))
-                return true ;
+                return true;
             if (string.IsNullOrEmpty(controlGaMa1.Text))
                 return true;
             if (string.IsNullOrEmpty(controlh1.Text))
@@ -515,7 +534,7 @@
 
             if (RBtn鐭╁舰.Checked)
             {
-                if (Convert.ToDouble(controlh1.Text) - Convert.ToDouble(controlr1.Text) < 1|| _sectionBundleInfo.BaseWidth- (Convert.ToDouble(controlr1.Text)*2) < 1)
+                if (Convert.ToDouble(controlh1.Text) - Convert.ToDouble(controlr1.Text) < 1 || _sectionBundleInfo.BaseWidth - (Convert.ToDouble(controlr1.Text) * 2) < 1)
                 {
                     controlr1.BackColor = Color.OrangeRed;
                     MessageBox.Show("r涓嶅悎鐞嗭紒璇烽噸鏂拌緭鍏�");
@@ -534,7 +553,7 @@
                 var c = _sectionBundleInfo.R_out / 1000;
                 var TopWidth = _sectionBundleInfo.BaseWidth + (2 * x);
                 var Slash = (Convert.ToDouble(controlh1.Text) - Convert.ToDouble(controlr1.Text) - (Math.Sin(Convert.ToDouble(controlGaMa1.Text) * Math.PI / 180) * Convert.ToDouble(controlr1.Text))) / Math.Cos(Convert.ToDouble(controlGaMa1.Text) * Math.PI / 180);
-                if ((!RBtn鐭╁舰.Checked && (TopWidth < c || Slash < c)) || Convert.ToDouble(controlr1.Text) == 0)
+                if ((!RBtn鐭╁舰.Checked && (TopWidth < c || Slash < c - 0.1))) // 
                 {
                     controlr1.BackColor = Color.OrangeRed;
                     MessageBox.Show("r涓嶅悎鐞嗭紒璇烽噸鏂拌緭鍏�");
@@ -544,7 +563,7 @@
                     controlr1.BackColor = Color.White;
                 }
             }
-            
+
 
             return isreasonable;
         }
@@ -703,14 +722,14 @@
                 SkyTextBox controH1 = this.Controls.Find(controlnameHeight, true).FirstOrDefault() as SkyTextBox;
 
                 controly1.Enabled = true;
-                if (controly1 != null)
-                    controly1.Text = Math.Round(_sectionBundleInfo.GaMa_Left[sect_index], 1).ToString();
-                if (controly2 != null)
-                    controly2.Text = Math.Round( _sectionBundleInfo.R_Left[sect_index],1).ToString();
                 if (control鏂潰闈㈢Н != null)
                     control鏂潰闈㈢Н.Text = Math.Round(_sectionBundleInfo.Area[sect_index], 1).ToString();
                 if (controH1 != null)
                     controH1.Text = Math.Round(_sectionBundleInfo.H[sect_index], 1).ToString();
+                if (controly2 != null)
+                    controly2.Text = Math.Round(_sectionBundleInfo.R_Left[sect_index], 1).ToString();
+                if (controly1 != null)
+                    controly1.Text = Math.Round(_sectionBundleInfo.GaMa_Left[sect_index], 1).ToString();
             }
         }
 
@@ -757,7 +776,7 @@
                         SkyTextBox controly1 = this.Controls.Find(controlnameGama1, true).FirstOrDefault() as SkyTextBox;
                         controly1.Enabled = false;
                     }
-                        return;
+                    return;
                 }
                 //for (var sect_index = 1; sect_index <= 8; sect_index++)
                 //{
@@ -793,5 +812,32 @@
                 RefreshShape(Rec_sectionBundleInfo);
             }
         }
+
+        private void skyTextBox鏂潰H11_TextChanged(object sender, EventArgs e)
+        {
+            if (sender is SkyTextBox skytextBox)
+            {
+                string lastChar = skytextBox.Name[skytextBox.Name.Length - 1].ToString();
+                int index = Convert.ToInt32(lastChar);
+                if (!double.TryParse(skytextBox.Text, out double resultH) && !string.IsNullOrEmpty(skytextBox.Text))
+                {
+                    resultH = _sectionBundleInfo.H[index];
+                    skytextBox.Text = _sectionBundleInfo.H[index].ToString();
+                }
+                else
+                {
+                    SkyTextBox controlGaMa1 = this.Controls.Find($"skyTextBox鏂潰y1{index}", true).FirstOrDefault() as SkyTextBox;
+                    SkyTextBox controlr1 = this.Controls.Find($"skyTextBox鏂潰r1{index}", true).FirstOrDefault() as SkyTextBox;
+                    if (!double.TryParse(controlGaMa1.Text, out double resultGame) && !string.IsNullOrEmpty(controlGaMa1.Text))
+                    {
+                        resultH = _sectionBundleInfo.GaMa_Left[index];
+                    }
+                    var R = _sectionBundleInfo.HCalR(_geomBaseInfo, index, resultGame, resultH);
+                    R = _sectionBundleInfo.CheckChamferR(resultH, index, resultH, R);
+                    skytextBox.Text = resultH.ToString();
+                    controlr1.Text = R.ToString();
+                }
+            }
+        }
     }
 }

--
Gitblit v1.9.3