From f936ac9de6f272e6d3fd43ae6605218e3e45ccff Mon Sep 17 00:00:00 2001 From: Admin Date: Mon, 9 Nov 2026 13:02:24 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=8B=E5=8A=A8=E6=B5=8B=E8=AF=95=E8=BD=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- FeiYu/MainWindow.xaml | 1 + ViewModel/MainWindowVM.cs | 151 +++++++++++++++++++++++- ViewModel/Vision/HalconVisual.cs | 4 +- Views/Motion/MotionControWindow.xaml | 13 +- Views/Motion/MotionControWindow.xaml.cs | 8 +- 5 files changed, 168 insertions(+), 9 deletions(-) diff --git a/FeiYu/MainWindow.xaml b/FeiYu/MainWindow.xaml index 02104ac..8020706 100644 --- a/FeiYu/MainWindow.xaml +++ b/FeiYu/MainWindow.xaml @@ -35,6 +35,7 @@ + diff --git a/ViewModel/MainWindowVM.cs b/ViewModel/MainWindowVM.cs index 7f5ac39..67c976f 100644 --- a/ViewModel/MainWindowVM.cs +++ b/ViewModel/MainWindowVM.cs @@ -19,6 +19,7 @@ using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Media; +using System.Windows.Media.Media3D; using System.Windows.Threading; using ViewModel.MotionControl; using ViewModel.Robots; @@ -229,7 +230,10 @@ namespace ViewModel ManulFlow.Step = 0; ZhuanPanList[4].State.StatusForeground = ColorStr.Blue; ZhuanPanList[4].State.StatusBackground = ColorStr.Yellow; - + break; + case "手动测试轴": + ManulFlow.Step = 0; + break; } Task.Run(() => @@ -266,6 +270,20 @@ namespace ViewModel { testing = false; } + break; + + case "手动测试轴": + try + { + TestAxisRun(ManulFlow); + } + catch (Exception) + { + + testing = false; + } + + break; } @@ -294,6 +312,27 @@ namespace ViewModel return tempPoint; + } + private MotionPointModel GetMotionPoint(int pointType, bool copy = false) + { + var tempPoint = CurrentMachine.MotionPointList.Where(w => w.PointType == pointType).FirstOrDefault(); + + if (tempPoint != null) + { + + if (copy) + { + + tempPoint = Coper(tempPoint); + } + + tempPoint.PointRunStep = GengralProcessEnum.Start; + } + + + return tempPoint; + + } bool testing; private string gridWidth; @@ -6887,6 +6926,116 @@ namespace ViewModel } #endregion + + #region 手动测试轴 + + public int TestPos { get; set; } + public void TestAxisRun(FlowModel MyFlow) + { + + switch (MyFlow.Step) + { + case 0: + TestPos = 1; + MyFlow.Step++; + + + + break; + + case 1: + PressPointTemp = GetMotionPoint(TestPos); + MyFlow.Step++; + + + + break; + case 2: + if (PressPointTemp.PointRun(MCVM.AllShaftList)) + { + + MyFlow.Step++; + + + } + else if (MyFlow.RunTime.AddMilliseconds(10000) < DateTime.Now) + { + PressPointTemp.PointRunStep = GengralProcessEnum.Start; + MyFlow.RunTime = DateTime.Now; + + } + break; + case 3: + + if (TestPos % 2 == 0) { + + if (TestPos < 8) + { + + TestPos++; + } + else + { + + TestPos = 1; + } + + MyFlow.Step = 1; + MyFlow.RunTime = DateTime.Now; + } + + else if (MyFlow.RunTime.AddMilliseconds(1000) < DateTime.Now ) + { + MyFlow.Step++; + MyFlow.RunTime = DateTime.Now; + + } + break; + + case 4: + VisualA.GetImage(); + VisualA.SaveImage2(TestPos.ToString()); + MyFlow.Step++; + MyFlow.RunTime = DateTime.Now; + break; + case 5: + + if (MyFlow.RunTime.AddMilliseconds(1000) < DateTime.Now) + { + + + MyFlow.Step = 1; + MyFlow.RunTime = DateTime.Now; + + if (TestPos < 8) + { + + TestPos++; + } + else { + + TestPos = 1; + } + + } + break; + + } + + + + + + + + + + + + + } + + #endregion } } diff --git a/ViewModel/Vision/HalconVisual.cs b/ViewModel/Vision/HalconVisual.cs index b118d54..aec1773 100644 --- a/ViewModel/Vision/HalconVisual.cs +++ b/ViewModel/Vision/HalconVisual.cs @@ -4258,7 +4258,7 @@ namespace ViewModel.Vision /// 保存图像的名称 public void SaveImage2(string ImageName) { - string path = @"D:/MotorInfo/" + Camera.CamName + "/" + DateTime.Now.ToString("D") + "/"; + string path = @"D:/MotorInfo/" + ImageName + "/"; //创建文件夹 if (!Directory.Exists(path)) @@ -4266,7 +4266,7 @@ namespace ViewModel.Vision Directory.CreateDirectory(path); } - string filePath = path + ImageName + ".jpeg"; //图片存放路径 //保存模板图片 + string filePath = path + DateTime.Now.ToString("ddMMss") + ".jpeg"; //图片存放路径 //保存模板图片 HOperatorSet.WriteImage(Ho_Image, "jpeg 60", 0, filePath); } diff --git a/Views/Motion/MotionControWindow.xaml b/Views/Motion/MotionControWindow.xaml index d9f3bde..98ffe2d 100644 --- a/Views/Motion/MotionControWindow.xaml +++ b/Views/Motion/MotionControWindow.xaml @@ -74,7 +74,8 @@ - + + + + + + + - - + () { new CommonClass() { ID=1, CommonName="取料点"}, + + this.pointType.ItemsSource = new List() { new CommonClass() { ID=1, CommonName="取料点"}, new CommonClass() { ID=2, CommonName="作用点"}, new CommonClass() { ID=3, CommonName="视觉点"}, new CommonClass() { ID=4, CommonName="待机点"}}; - + //运动控制卡连接类型 @@ -120,6 +120,8 @@ namespace Views.Motion new CommonClass() { UID=31, CommonName="负向31"}, new CommonClass() { UID=32, CommonName="负向32"}, new CommonClass() { UID=33, CommonName="Z 33"}, + new CommonClass() { UID=34, CommonName="Z 34"}, + new CommonClass() { UID=35, CommonName="就地设原点"}, }; this.Logic.ItemsSource = LogicMode;