public override void del() { if (linehandl != null) { Axis6.removeLine(linehandl); } }
public override void line() { if (drawhandle != null) { Axis6.removeLine(drawhandle); } drawhandle = Axis6.DrawLine(sour, dest); }
public override void line() { if (drawhandle != null) { Axis6.removeLine(drawhandle); } drawhandle = Axis6.DrawArcLine(sour.angle, dest.angle); }
public G0(Axis6.AxisStruct stop) { message = "快速定位到点"; sour = LastStruct; dest = stop; drawhandle = Axis6.DrawArcLine(sour.angle, dest.angle); LastStruct = dest; redraw = true; }
public override void remove() { if (linehandl != null) { Axis6.removeLine(linehandl); } if (drawhandle != null) { Axis6.removeLine(drawhandle); } linehandl = drawhandle = null; }
public G1(Axis6.AxisStruct stop) { message = "直线插补到点"; sour = LastStruct; dest = stop; drawhandle = Axis6.DrawLine(sour, dest); LastStruct = dest; count = docount = 0; bcount = -1; redraw = true; this.r = rg; }
void sumdata(bool ext) { docount = 0; if (count == 0) { getdata(); } if (bcount < count) { getdata(); Line.Setup(startpos, stoppos, count - 1); bcount = 0; AngleList = new double[count + inoutcount * 2][]; Axis6.AxisStruct LastG = LastStruct; double[] lastag = LastStruct.angle; new Task(() => { Parallel.For(0, count - 1, (int index) => { if (!ext) { if (!isRun) { return; } } Axis6.AxisStruct G = new Axis6.AxisStruct(); G.X = Line.pls[0] + Line.inc[0] * index; G.Y = Line.pls[1] + Line.inc[1] * index; G.Z = Line.pls[2] + Line.inc[2] * index; G.N = Line.pls[3] + Line.inc[3] * index; G.O = Line.pls[4] + Line.inc[4] * index; G.A = Line.pls[5] + Line.inc[5] * index; AngleList[index] = Axis6.PosToAngle(LastG, G); }); AngleList[count - 1] = dest.angle; bcount = count; }).Start(); } if (ext) { while (bcount < count) { Thread.Sleep(1); } } }
public static bool Init() { try { Axis = new Class1(); Axis.show_init(0.01); double[] pos = Axis6.AngleToPosArray(Axis6.StartAngle); DefStruct.X = pos[0]; DefStruct.Y = pos[1]; DefStruct.Z = pos[2]; DefStruct.N = 0; DefStruct.O = 90; DefStruct.A = 0; return(true); } catch { } return(false); }
public GList(double[] Xl, double[] Yl, double[] Zl, Axis6.AxisStruct last) { poslist = new double[3][]; poslist[0] = Xl; poslist[1] = Yl; poslist[2] = Zl; count = Xl.Length; bcount = 1; docount = 0; N = last.N; O = last.O; A = last.A; destangle = new double[count][]; destangle[0] = Axis6.PosToAngle(LastStruct.angle, last.X, last.Y, last.Z, N, O, A); if (destangle[0] != null) { LastStruct.angle = destangle[0]; } linehandl = Axis6.DrawLineList(Xl, Yl, Zl); }
public override void run() { new Task(() => { while (isRun) { if (bcount < count) { double[] value; destangle[bcount] = value = Axis6.PosToAngle(LastStruct.angle, poslist[0][bcount], poslist[1][bcount], poslist[2][bcount], N, O, A); if (value == null) { destangle[bcount] = destangle[bcount - 1]; } bcount++; } else { break; } } }).Start(); while (isRun) { if (Motor.IsReady || !Motor.Enable) { if (docount < bcount) { Motor.MotorRun(destangle[docount]); Axis6.MoveToAngle(destangle[docount]); docount++; } } Thread.Sleep(1); } LastStruct.angle = destangle[count - 1]; //Axis6.AxisStruct last = new Axis6.AxisStruct(); }
public override void run() { if (!isRun) { return; } //while (isRun && !Motor.IsReady) Thread.Sleep(1); if (Motor.Enable) { Motor.MotorRun(dest.angle); } if (sumlot) { if (First) { linehandl = Axis6.MoveArc(sour.angle, dest.angle, 'b', 2, 15, true); } else { Axis6.MoveArc(LastStruct.angle, dest.angle, 'b', 2, 15, false); } } if (Motor.Enable) { while (isRun && !Motor.IsReady) { Thread.Sleep(1); } } LastStruct = dest; //while (isRun && !Motor.IsReady) //{ // Thread.Sleep(1); //} //Thread.Sleep(DefDelay); }
public override void run() { int f, s, d; if (rg != r) { r = rg; bcount = 0; } f = Motor.Frequency; s = Motor.StartSpeed; d = Motor.SpeedTime; Motor.Frequency = (Motor.Frequency > 5000) ? 5000 : Motor.Frequency; Motor.SetInfo(Motor.Frequency, Motor.Frequency, 1); sumdata(false); if (sumlot) { if (First) { linehandl = Axis6.DrawLine(sour, dest, 'b', 2); } } LastStruct = dest; if (bcount < count) { while (isRun) { if (Motor.IsReady || !Motor.Enable) { if (docount < count) { if (AngleList[docount] == null) { continue; } if (AngleList[docount] == LastStruct.angle) { docount++; if (docount >= count) { if (inoutcount != 0) { StartInOut(); } } continue; } Axis6.MoveToAngle(AngleList[docount]); //Motor.MotorRun(AngleList[docount]); docount++; if (docount >= count) { if (inoutcount != 0) { StartInOut(); } } } else { break; } } Thread.Sleep(1); } } else { Axis6.PointToPointMove(AngleList); } if (!isRun) { return; } Motor.MotorRunList(AngleList); while (isRun && !Motor.IsReady) { Thread.Sleep(1); } if (!isRun) { return; } Motor.SetInfo(s, f, d); while (isRun && !Motor.IsReady) { Thread.Sleep(1); } //Axis6.AxisStruct last = new Axis6.AxisStruct(); //if(AngleList==null) //{ // AngleList = Axis6.PointToPointLineAngle(sour, dest, rg); // lineObj = Axis6.AngleListToObject(AngleList); //} //Motor.MotorRunList(AngleList); //Thread.Sleep(DefDelay); }