Exemple #1
0
 public Entity(Layer owner, string name)
 {
     this.Name = name;
     if (null != owner)
     {
         this.Owner = owner;
         owner.Add(this);
     }
 }
Exemple #2
0
        static void Main(string[] args)
        {
            #region initialize RTC
            IRtc   rtc     = new Rtc5(0);                            ///rtc 5 controller
            double fov     = 60.0;                                   /// scanner field of view : 60mm
            double kfactor = Math.Pow(2, 20) / fov;                  /// k factor (bits/mm) = 2^20 / fov
            rtc.Initialize(kfactor, LaserMode.Yag1, "cor_1to1.ct5"); ///default correction file
            rtc.CtlFrequency(50 * 1000, 2);                          ///laser frequency : 50KHz, pulse width : 2usec
            rtc.CtlSpeed(100, 100);                                  /// default jump and mark speed : 100mm/s
            rtc.CtlDelay(10, 100, 200, 200, 0);                      ///scanner and laser delays
            #endregion

            #region create entities for scanner field correction
            doc = new Doc("entities for field correction");
            Layer layer = doc.Layers.Active;    ///current active layer
            layer.Clear();
            /// 9 measured points (mm unit)
            layer.Add(new Spiral(doc.Layers.Active, -20.0f, 20.0f, 0.5, 2.0, 5, true));
            layer.Add(new Spiral(doc.Layers.Active, 0.0f, 20.0f, 0.5, 2.0, 5, true));
            layer.Add(new Spiral(doc.Layers.Active, 20.0f, 20.0f, 0.5, 2.0, 5, true));
            layer.Add(new Spiral(doc.Layers.Active, -20.0f, 0.0f, 0.5, 2.0, 5, true));
            layer.Add(new Spiral(doc.Layers.Active, 0.0f, 0.0f, 0.5, 2.0, 5, true));
            layer.Add(new Spiral(doc.Layers.Active, 20.0f, 0.0f, 0.5, 2.0, 5, true));
            layer.Add(new Spiral(doc.Layers.Active, -20.0f, -20.0f, 0.5, 2.0, 5, true));
            layer.Add(new Spiral(doc.Layers.Active, 0.0f, -20.0f, 0.5, 2.0, 5, true));
            layer.Add(new Spiral(doc.Layers.Active, 20.0f, -20.0f, 0.5, 2.0, 5, true));
            #endregion

            ConsoleKeyInfo key;
            do
            {
                Console.WriteLine("Testcase for rtclib. powered by [email protected] (https://sepwind.blogspot.com)");
                Console.WriteLine("");
                Console.WriteLine("'F' : draw field correction entities");
                Console.WriteLine("'C' : create new field correction for 2D");
                Console.WriteLine("'Q' : quit");
                Console.WriteLine("");
                Console.Write("select your target : ");
                key = Console.ReadKey(false);
                if (key.Key == ConsoleKey.Q)
                {
                    break;
                }
                switch (key.Key)
                {
                case ConsoleKey.F:
                    Console.WriteLine("\r\nWARNING !!! LASER IS BUSY ...");
                    var timer = new Stopwatch();
                    DrawForFieldCorrection(rtc, doc);
                    rtc.ListExecute(true);
                    Console.WriteLine($"processing time = {timer.ElapsedMilliseconds / 1000.0:F3}s");
                    break;

                case ConsoleKey.C:
                    string result = CreateFieldCorrection();
                    Console.WriteLine("");
                    Console.WriteLine(result);
                    break;
                }
            } while (true);

            rtc.Dispose();
        }