Exemplo n.º 1
0
        static void Main(string[] args)
        {
            Tools.TimingBase.TimeFromApplicationStartup();

            foreach (string arg in args)
            {
                GrblCore.WriteComLog = GrblCore.WriteComLog || arg == "comlog";
            }

            Logger.Start();
            GitHub.CleanupOldVersion();
            UsageStats.LoadFile();
            CustomButtons.LoadFile();
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            System.Globalization.CultureInfo ci = (System.Globalization.CultureInfo)Settings.GetObject("User Language", null);
            if (ci != null)
            {
                System.Threading.Thread.CurrentThread.CurrentUICulture = ci;
            }

            Tools.TaskScheduler.SetClockResolution(1);             //use a fast clock
            Application.Run(new MainForm());
            GrblEmulator.WebSocketEmulator.Stop();
            Autotrace.CleanupTmpFolder();
            Logger.Stop();
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            ExceptionManager.RegisterHandler();
            Tools.TimingBase.TimeFromApplicationStartup();

            Logger.Start();
            GitHub.InitUpdate();
            UsageStats.LoadFile();
            CustomButtons.LoadFile();
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            System.Globalization.CultureInfo ci = Settings.GetObject <System.Globalization.CultureInfo>("User Language", null);
            if (ci != null)
            {
                Thread.CurrentThread.CurrentUICulture = ci;
            }
            Tools.TaskScheduler.SetClockResolution(1);             //use a fast clock
            //Application.SetCompatibleTextRenderingDefault(false);

            Application.Run(new MainForm(args));

            GrblEmulator.WebSocketEmulator.Stop();
            Autotrace.CleanupTmpFolder();

            ComWrapper.ComLogger.StopLog();
            Logger.Stop();
        }
Exemplo n.º 3
0
        internal void LoadImageCenterline(Bitmap bmp, string filename, bool useCornerThreshold, int cornerThreshold, bool useLineThreshold, int lineThreshold, L2LConf conf, bool append)
        {
            RiseOnFileLoading(filename);

            DateTime start = DateTime.Now;

            if (!append)
            {
                list.Clear();
            }

            mRange.ResetRange();

            string content = "";

            // Should throw
            //try
            //{
            content = Autotrace.BitmapToSvgString(bmp, useCornerThreshold, cornerThreshold, useLineThreshold, lineThreshold);
            //}
            //catch (Exception ex) { Logger.LogException("Centerline", ex); }

            SvgConverter.GCodeFromSVG converter = new SvgConverter.GCodeFromSVG();
            converter.GCodeXYFeed   = Settings.GetObject("GrayScaleConversion.VectorizeOptions.BorderSpeed", 1000);
            converter.SvgScaleApply = true;
            converter.SvgMaxSize    = (float)Math.Max(bmp.Width / 10.0, bmp.Height / 10.0);
            converter.UserOffset.X  = Settings.GetObject("GrayScaleConversion.Gcode.Offset.X", 0F);
            converter.UserOffset.Y  = Settings.GetObject("GrayScaleConversion.Gcode.Offset.Y", 0F);

            string gcode = converter.convertFromText(content);

            string[] lines = gcode.Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
            foreach (string l in lines)
            {
                string line = l;
                if ((line = line.Trim()).Length > 0)
                {
                    GrblCommand cmd = new GrblCommand(line);
                    if (!cmd.IsEmpty)
                    {
                        list.Add(cmd);
                    }
                }
            }

            Analyze();
            long elapsed = (long)(DateTime.Now - start).TotalMilliseconds;

            RiseOnFileLoaded(filename, elapsed);
        }