#0015: 修复etalon 运动到下一代的显示问题
This commit is contained in:
@@ -13,6 +13,7 @@ using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Timers;
|
||||
using System.Windows.Forms;
|
||||
using System.Windows.Media;
|
||||
using ACS.SPiiPlusNET;
|
||||
using HexcalMC.Base;
|
||||
using Plot3D;
|
||||
@@ -78,8 +79,8 @@ namespace HexcalMC
|
||||
private eDemo me_Demo;
|
||||
private eColorScheme me_ColorScheme;
|
||||
private System.Windows.Forms.Timer mi_StatusTimer = new System.Windows.Forms.Timer();
|
||||
private cMessgData mi_MesgTop = new cMessgData("", -7, 7, Color.Blue); // For special hint
|
||||
private cMessgData mi_MesgBottom = new cMessgData("", -7, -7, Color.Gray); // For selection mode
|
||||
private cMessgData mi_MesgTop = new cMessgData("", -7, 7, System.Drawing.Color.Blue); // For special hint
|
||||
private cMessgData mi_MesgBottom = new cMessgData("", -7, -7, System.Drawing.Color.Gray); // For selection mode
|
||||
|
||||
// Only for demo "Animation"
|
||||
private System.Windows.Forms.Timer mi_AnimationTimer = new System.Windows.Forms.Timer();
|
||||
@@ -99,6 +100,7 @@ namespace HexcalMC
|
||||
|
||||
private readonly MainFrom mainFrom;
|
||||
private readonly Api _acs; //ACS控制器
|
||||
private double dwellTime = 2000; //停顿时间
|
||||
|
||||
public Axis[] axes =
|
||||
{
|
||||
@@ -217,7 +219,7 @@ namespace HexcalMC
|
||||
editor3D.Normalize = eNormalize.Separate;
|
||||
editor3D.AddRenderData(i_ShapeData, i_LineData);
|
||||
|
||||
editor3D.Selection.HighlightColor = Color.FromArgb(90, 90, 90);
|
||||
editor3D.Selection.HighlightColor = System.Drawing.Color.FromArgb(90, 90, 90);
|
||||
editor3D.Selection.Callback = OnSelectEvent;
|
||||
editor3D.Selection.MultiSelect = true;
|
||||
editor3D.Selection.Enabled = true;
|
||||
@@ -407,7 +409,7 @@ namespace HexcalMC
|
||||
}
|
||||
|
||||
// 创建多点运动
|
||||
double dwellTime = dwellTimes.Average() * 1000; //将秒转换为毫秒
|
||||
dwellTime = dwellTimes.Average() * 1000; //将秒转换为毫秒
|
||||
DebugDfn.AddLogText("平均停顿时间(毫秒):" + dwellTime);
|
||||
_acs.MultiPointM(MotionFlags.ACSC_NONE, axes, dwellTime);
|
||||
|
||||
@@ -500,12 +502,10 @@ namespace HexcalMC
|
||||
mainFrom.StopCounting();
|
||||
refresh_time.Stop();
|
||||
timer_move.Stop();
|
||||
currentIndex = 0;
|
||||
currentIndex = 0;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void btn_etalon_import_Click(object sender, EventArgs e) //解析Etalon文件
|
||||
private void btn_etalon_import_Click(object sender, EventArgs e) //解析Etalon文件
|
||||
{
|
||||
//打开文件对号框,选择 mpf格式文件
|
||||
OpenFileDialog i_Dlg = new OpenFileDialog();
|
||||
@@ -561,6 +561,7 @@ namespace HexcalMC
|
||||
etalon_points.Clear();
|
||||
filteredPoints.Clear();
|
||||
dwellTimes.Clear();
|
||||
currentIndex = 0; //重置当前点
|
||||
|
||||
//读取文件
|
||||
string[] lines = File.ReadAllLines(mpf_file_path);
|
||||
@@ -661,7 +662,7 @@ namespace HexcalMC
|
||||
editor3D.Normalize = eNormalize.Separate;
|
||||
editor3D.AddRenderData(i_ShapeData, i_LineData);
|
||||
|
||||
editor3D.Selection.HighlightColor = Color.FromArgb(90, 90, 90);
|
||||
editor3D.Selection.HighlightColor = System.Drawing.Color.FromArgb(90, 90, 90);
|
||||
editor3D.Selection.Callback = OnSelectEvent;
|
||||
editor3D.Selection.MultiSelect = true;
|
||||
editor3D.Selection.Enabled = true;
|
||||
@@ -686,19 +687,16 @@ namespace HexcalMC
|
||||
cScatterData i_ShapeData = new cScatterData();
|
||||
//currentIndex = mainFrom.GetInPosCount();//获取当前点的数量
|
||||
|
||||
if (currentIndex < filteredPoints.Count)
|
||||
for (int i = 0; i < filteredPoints.Count; i++) //遍历所有点
|
||||
{
|
||||
|
||||
|
||||
// 更新点的颜色
|
||||
for (int i = 0; i <= currentIndex; i++)
|
||||
if (i < currentIndex-1) //小于的部分,已跑完 为绿色
|
||||
{
|
||||
double d_X = filteredPoints[i].X;
|
||||
double d_Y = filteredPoints[i].Y;
|
||||
double d_Z = filteredPoints[i].Z;
|
||||
|
||||
cPoint3D i_Point = new cPoint3D(d_X, d_Y, d_Z, "Scatter Point");
|
||||
SolidBrush i_brush = new SolidBrush(Color.Red);
|
||||
SolidBrush i_brush = new SolidBrush(System.Drawing.Color.Green);
|
||||
// You can store the returned shape in a variable and later modify it's properties
|
||||
cShape3D i_Shape = i_ShapeData.AddShape(
|
||||
i_Point,
|
||||
@@ -708,16 +706,31 @@ namespace HexcalMC
|
||||
null
|
||||
);
|
||||
}
|
||||
|
||||
// 对于剩余部分的点,不做颜色更新
|
||||
for (int i = currentIndex; i < filteredPoints.Count; i++)
|
||||
else if (i == currentIndex-1) //当前点为橙黄色
|
||||
{
|
||||
double d_X = filteredPoints[i].X;
|
||||
double d_Y = filteredPoints[i].Y;
|
||||
double d_Z = filteredPoints[i].Z;
|
||||
|
||||
cPoint3D i_Point = new cPoint3D(d_X, d_Y, d_Z, "Scatter Point");
|
||||
SolidBrush i_brush = new SolidBrush(Color.Gray);
|
||||
SolidBrush i_brush = new SolidBrush(System.Drawing.Color.OrangeRed);
|
||||
// You can store the returned shape in a variable and later modify it's properties
|
||||
cShape3D i_Shape = i_ShapeData.AddShape(
|
||||
i_Point,
|
||||
eScatterShape.Circle,
|
||||
5,
|
||||
i_brush,
|
||||
null
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
double d_X = filteredPoints[i].X;
|
||||
double d_Y = filteredPoints[i].Y;
|
||||
double d_Z = filteredPoints[i].Z;
|
||||
|
||||
cPoint3D i_Point = new cPoint3D(d_X, d_Y, d_Z, "Scatter Point");
|
||||
SolidBrush i_brush = new SolidBrush(System.Drawing.Color.Gray);
|
||||
// You can store the returned shape in a variable and later modify it's properties
|
||||
cShape3D i_Shape = i_ShapeData.AddShape(
|
||||
i_Point,
|
||||
@@ -728,11 +741,11 @@ namespace HexcalMC
|
||||
);
|
||||
}
|
||||
|
||||
editor3D.Clear();
|
||||
editor3D.Normalize = eNormalize.Separate;
|
||||
editor3D.AddRenderData(i_ShapeData);
|
||||
editor3D.Invalidate();
|
||||
}
|
||||
editor3D.Clear();
|
||||
editor3D.Normalize = eNormalize.Separate;
|
||||
editor3D.AddRenderData(i_ShapeData);
|
||||
editor3D.Invalidate();
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
@@ -751,21 +764,29 @@ namespace HexcalMC
|
||||
{
|
||||
if (filteredPoints.Count > 0 && currentIndex < filteredPoints.Count)
|
||||
{
|
||||
//增加2秒延时
|
||||
Thread.Sleep(2000);
|
||||
//增加2秒延时
|
||||
Thread.Sleep((int)dwellTime);
|
||||
|
||||
Point nextPoint = filteredPoints[currentIndex];
|
||||
Point nextPoint = filteredPoints[currentIndex];
|
||||
//打印 nextPoint
|
||||
DebugDfn.AddLogText("下发指令:" + currentIndex + " 点:" + nextPoint.X + " " + nextPoint.Y + " " + nextPoint.Z );
|
||||
|
||||
mainFrom.SetPositionXyz(Point.FromPoint(nextPoint)); //移动到下一个点
|
||||
|
||||
DebugDfn.AddLogText(
|
||||
"下发指令:"
|
||||
+ currentIndex
|
||||
+ " 点:"
|
||||
+ nextPoint.X
|
||||
+ " "
|
||||
+ nextPoint.Y
|
||||
+ " "
|
||||
+ nextPoint.Z
|
||||
);
|
||||
currentIndex++;
|
||||
mainFrom.SetPositionXyz(Point.FromPoint(nextPoint)); //移动到下一个点
|
||||
}
|
||||
else
|
||||
{
|
||||
DebugDfn.AddLogText("All points have been visited.");
|
||||
timer_move.Stop();
|
||||
currentIndex = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
|
||||
</dsig:Transforms>
|
||||
<dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" />
|
||||
<dsig:DigestValue>5BAu5mmkGH6UcqUDfkL6WCaAYDZ3v+HSBDiHWDwiFF0=</dsig:DigestValue>
|
||||
<dsig:DigestValue>z2mLqy08XuUV8hlnpHyZ0pykJWrtzR1mUJK4Iyn9kS4=</dsig:DigestValue>
|
||||
</hash>
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
|
||||
Binary file not shown.
@@ -62,7 +62,7 @@
|
||||
<dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
|
||||
</dsig:Transforms>
|
||||
<dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" />
|
||||
<dsig:DigestValue>cGpoIhg/anGo/O6Lnll6V35Q+gP3ExIYb7ltMw03hpA=</dsig:DigestValue>
|
||||
<dsig:DigestValue>4DR1ksKlokf+OktGK8d+8M0auawSIh8axvkUM7xdmUc=</dsig:DigestValue>
|
||||
</hash>
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user