From db33bc6d9a30db6be4b40e45097c9a87a67cc845 Mon Sep 17 00:00:00 2001
From: yangyin <1850366751@qq.com>
Date: 星期二, 25 三月 2025 09:28:50 +0800
Subject: [PATCH] 直线圆弧

---
 WinFrmUI/DPumpHydr.WinFrmUI.Volute/断面设计/ctrlSectionBundleInfo.cs |   80 ++++++++++++++++++++++++++++++++-------
 1 files changed, 65 insertions(+), 15 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 7aca438..7d666a3 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,7 +171,7 @@
         ViewModel.GeomBaseInfo _geomBaseInfo = null;
         public void SetBindingData(ViewModel.SectionBundleInfo sectionBundle_info)
         {
-            _sectionBundleInfo= sectionBundle_info;
+            _sectionBundleInfo = sectionBundle_info;
         }
 
 
@@ -184,12 +184,12 @@
             {
                 return;
             }
-            if(_hdrBaseInfo == null && _geomBaseInfo == null)
+            if (_hdrBaseInfo == null && _geomBaseInfo == null)
             {
                 _hdrBaseInfo = base_info;
                 _geomBaseInfo = geom_info;
             }
-            if (isRefreshModel )
+            if (isRefreshModel)
             {
                 return;
             }
@@ -207,7 +207,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;
@@ -246,7 +246,7 @@
 
             RefreshAllSectPara(_sectionBundleInfo);
 
-            
+
 
             RefreshShape(_sectionBundleInfo);
         }
@@ -352,6 +352,7 @@
 
                 if (control鏂潰闈㈢Н != null)
                     _sectionBundleInfo.Area[argument] = Convert.ToDouble(control鏂潰闈㈢Н.Text);
+
                 if (controlH != null)
                     _sectionBundleInfo.H[argument] = Convert.ToDouble(controlH.Text);
             }
@@ -369,13 +370,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;
@@ -462,7 +463,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, initialR[index]);
+                    var R = _sectionBundleInfo.CheckChamferR(height, index, result, initialR[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();
                 }
             }
         }
@@ -499,15 +515,22 @@
 
         }
 
-        public bool Judgment_R(int index)
+        private bool Judgment_R(int index)
         {
             bool isreasonable = true;
             SkyTextBox controlr1 = this.Controls.Find($"skyTextBox鏂潰r1{index}", true).FirstOrDefault() as SkyTextBox;
             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;
+            if (string.IsNullOrEmpty(controlGaMa1.Text))
+                return true;
+            if (string.IsNullOrEmpty(controlh1.Text))
+                return true;
+
             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涓嶅悎鐞嗭紒璇烽噸鏂拌緭鍏�");
@@ -536,7 +559,7 @@
                     controlr1.BackColor = Color.White;
                 }
             }
-            
+
 
             return isreasonable;
         }
@@ -696,13 +719,13 @@
 
                 controly1.Enabled = true;
                 if (controly1 != null)
-                    controly1.Text = _sectionBundleInfo.GaMa_Left[sect_index].ToString();
+                    controly1.Text = Math.Round(_sectionBundleInfo.GaMa_Left[sect_index], 1).ToString();
                 if (controly2 != null)
-                    controly2.Text = _sectionBundleInfo.R_Left[sect_index].ToString();
+                    controly2.Text = Math.Round(_sectionBundleInfo.R_Left[sect_index], 1).ToString();
                 if (control鏂潰闈㈢Н != null)
-                    control鏂潰闈㈢Н.Text = _sectionBundleInfo.Area[sect_index].ToString();
+                    control鏂潰闈㈢Н.Text = Math.Round(_sectionBundleInfo.Area[sect_index], 1).ToString();
                 if (controH1 != null)
-                    controH1.Text = _sectionBundleInfo.H[sect_index].ToString();
+                    controH1.Text = Math.Round(_sectionBundleInfo.H[sect_index], 1).ToString();
             }
         }
 
@@ -749,7 +772,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++)
                 //{
@@ -785,5 +808,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