예제 #1
0
 public G0(Axis6.AxisStruct stop)
 {
     message    = "快速定位到点";
     sour       = LastStruct;
     dest       = stop;
     drawhandle = Axis6.DrawArcLine(sour.angle, dest.angle);
     LastStruct = dest;
     redraw     = true;
 }
예제 #2
0
 static public void Clear()
 {
     LastStruct = Axis6.DefStruct;
     foreach (ModeObject m in LogicList)
     {
         m.remove();
     }
     LogicList.Clear();
 }
예제 #3
0
 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;
 }
예제 #4
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);
                    }
                }
            }
예제 #5
0
        static public void Start()
        {
            if (isRun)
            {
                return;
            }
            Index = 0;
            First = true;
            //ModeObject start=null;

            RunLastStruct = Axis6.DefStruct;
            if (!isRun)
            {
                isRun = true;
                new Task(() =>
                {
                    while (isRun)
                    {
                        //Thread.Sleep(100);
                        if (Index >= LogicList.Count)
                        {
                            if (looprun)
                            {
                                Index = 0;
                                Thread.Sleep(200);
                            }
                            else
                            {
                                Stop();
                            }
                            First = false;
                            //TaskThread = true;
                            continue;
                        }
                        try
                        {
                            LogicList[Index++].run();
                        }
                        catch (Exception ex)
                        {
                            System.Windows.Forms.MessageBox.Show("运行错误:\r\n" + ex.ToString());
                            StopLogic();
                            return;
                        }
                    }
                }).Start();
            }
        }
예제 #6
0
            void getdata()
            {
                Axis6.AxisStruct G         = dest;
                Axis6.AxisStruct LastG     = sour;
                double[]         v         = new double[6];
                double[]         d         = new double[6];
                double[]         lastag    = G.angle;
                List <double[]>  anglelist = new List <double[]>();

                v[0] = LastG.X;
                v[1] = LastG.Y;
                v[2] = LastG.Z;
                v[3] = v[4] = v[5] = 0;
                d[0] = G.X;
                d[1] = G.Y;
                d[2] = G.Z;
                d[3] = d[4] = d[5] = 0;
                Line.Setup(v, d, rg);
                if (Line.Count == 1)
                {
                    v[0] = v[1] = v[2] = 0;
                    d[0] = d[1] = d[2] = 0;
                    v[3] = LastG.N;
                    v[4] = LastG.O;
                    v[5] = LastG.A;
                    d[3] = G.N;
                    d[4] = G.O;
                    d[5] = G.A;
                    Line.Setup(v, d, 1.0);
                    v[0] = LastG.X;
                    v[1] = LastG.Y;
                    v[2] = LastG.Z;
                    d[0] = G.X;
                    d[1] = G.Y;
                    d[2] = G.Z;
                }
                v[3]     = LastG.N;
                v[4]     = LastG.O;
                v[5]     = LastG.A;
                d[3]     = G.N;
                d[4]     = G.O;
                d[5]     = G.A;
                count    = Line.Count + 1;
                startpos = v;
                stoppos  = d;
            }
예제 #7
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);
 }
예제 #8
0
 public static void UpdateLine(List <ModeObject> Modules = null)
 {
     if (Modules == null)
     {
         Modules = LogicList;
     }
     LastStruct = Axis6.DefStruct;
     foreach (ModeObject o in Modules)
     {
         if (o is G0)
         {
             ((G0)o).sour = LastStruct;
             LastStruct   = ((G0)o).dest;
             o.line();
         }
         else if (o is G1)
         {
             ((G1)o).sour = LastStruct;
             LastStruct   = ((G1)o).dest;
             o.line();
         }
     }
 }
예제 #9
0
 static public void Add(ModeObject obj)
 {
     LastStruct = (obj is G0) ? ((G0)obj).dest : (obj is G1) ? ((G1)obj).dest : LastStruct;
     LogicList.Add(obj);
 }