手动测试轴

This commit is contained in:
Admin 2026-11-09 13:02:24 +08:00
parent f0dd0d9832
commit f936ac9de6
5 changed files with 168 additions and 9 deletions

View File

@ -35,6 +35,7 @@
<MenuItem Background="AliceBlue" Visibility="{Binding AllVis}" Command="{Binding ManulTest}" CommandParameter="手动贴右" Foreground="Black" Header="手动贴右" />
<MenuItem Background="AliceBlue" Visibility="{Binding AllVis}" Command="{Binding ManulTest}" CommandParameter="手动检右" Foreground="Black" Header="手动检右" />
<MenuItem Background="AliceBlue" Visibility="{Binding AllVis}" Command="{Binding ManulTest}" CommandParameter="手动压合" Foreground="Black" Header="手动压合" />
<MenuItem Background="AliceBlue" Visibility="{Binding AllVis}" Command="{Binding ManulTest}" CommandParameter="手动测试轴" Foreground="Black" Header="手动测试轴" />
<CheckBox Content="启用安全门" FontFamily="楷体" IsChecked="{Binding EnableAnquanmen}" Visibility="{Binding AllVis}" />

View File

@ -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
}
}

View File

@ -4258,7 +4258,7 @@ namespace ViewModel.Vision
/// <param name="ImageName">保存图像的名称</param>
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);
}

View File

@ -74,7 +74,8 @@
</DataGrid>
</GroupBox>
<GroupBox Grid.Row="1" Padding="0" Header="{Binding SelectTrajectory.TraName}">
<DataGrid AutoGenerateColumns="False" CanUserAddRows="False" ItemsSource="{Binding SelectTrajectory.PointList}" SelectedItem="{Binding SelectMotionPoint}">
<DataGrid CanUserSortColumns="False"
AutoGenerateColumns="False" CanUserAddRows="False" ItemsSource="{Binding SelectTrajectory.PointList}" SelectedItem="{Binding SelectMotionPoint}">
<DataGrid.ContextMenu>
<ContextMenu Name="dgmenu2" IsEnabled="True" StaysOpen="False">
<MenuItem Command="{Binding EditorPointCommand}"
@ -101,14 +102,20 @@
</TextBlock>
</DataGridTextColumn.Header>
</DataGridTextColumn>
<DataGridTextColumn Binding="{Binding PointType}" IsReadOnly="True">
<DataGridTextColumn.Header>
<TextBlock Text="序号">
</TextBlock>
</DataGridTextColumn.Header>
</DataGridTextColumn>
<DataGridTextColumn Width="*" IsReadOnly="True" Binding="{Binding PointName, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" ElementStyle="{StaticResource DataGridTextColumnCenterSytle}" Header="点名称">
</DataGridTextColumn>
<DataGridComboBoxColumn x:Name="pointType" Width="*" DisplayMemberPath="CommonName"
<DataGridComboBoxColumn x:Name="pointType" Width="*" DisplayMemberPath="CommonName"
Header="类型"
SelectedValueBinding="{Binding PointType, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
SelectedValuePath="ID"
Visibility="{Binding DataContext.DisplayLevel, Source={x:Reference SPTabitem}}">
</DataGridComboBoxColumn>
</DataGridComboBoxColumn>
<DataGridTextColumn Width="*"
Binding="{Binding ShaftPoint_X}"
ElementStyle="{StaticResource DataGridTextColumnCenterSytle}"

View File

@ -32,12 +32,12 @@ namespace Views.Motion
this.shaftY.ItemsSource = shaftlist;
this.shaftZ.ItemsSource = shaftlist;
this.shaftU.ItemsSource = shaftlist;
this.pointType.ItemsSource= new List<CommonClass>() { new CommonClass() { ID=1, CommonName="取料点"},
this.pointType.ItemsSource = new List<CommonClass>() { 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;