示例#1
0
            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);
                    }
                }
            }
示例#2
0
 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);
 }
示例#3
0
 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();
 }