private IEnumerable <BaseGCode> Process()
        {
            var processor = new Engine.ImageProcessor(_Bitmap, Width, Height, LineResolution, PointResolution, Angle, SelectedInterpolator);
            var presenter = processor.CreatePresenter();

            var strokeGenerator = new Engine.GCodeGeneration.ImageProcessor.StrokesFromImageLinesGenerator(presenter.Lines, UseFreeZone, FreeZone, EngraveBothDirection);

            strokeGenerator.GenerateStrokes();

            var gcGen = new Engine.GCodeGeneration.ImageProcessor.GCodeGenerator(strokeGenerator.Strokes, (int)MinFeed, (int)MaxFeed, MaxPower, MinPower);
            var gcode = gcGen.GenerateCode();

            yield return(new BaseGCode("G21"));

            yield return(new BaseGCode("G90"));

            yield return(new BaseGCode("M3 S0"));

            foreach (var str in gcode)
            {
                yield return(str);
            }

            yield return(new BaseGCode("M5"));

            yield return(new BaseGCode("%"));

            yield return(new BaseGCode("(----ImageGenerator----)"));

            yield return(new BaseGCode(string.Format("(FileName: {0})", _PathToFile)));

            yield return(new BaseGCode(string.Format("(Width: {0} mm, Height: {1} mm)", Width, Height)));

            yield return(new BaseGCode(string.Format("(Resolution line: {0} mm, point: {1} mm)", LineResolution, PointResolution)));

            yield return(new BaseGCode(string.Format("(Feed max: {0} mm/min, min: {1} mm/min)", MaxFeed, MinFeed)));

            yield return(new BaseGCode(string.Format("(Power max: {0}, min: {1})", MaxPower, MinPower)));

            yield return(new BaseGCode(string.Format("(Angle: {0})", Angle)));

            yield return(new BaseGCode(string.Format("(Idle zones: {0})", UseFreeZone ? FreeZone : 0.0)));

            yield return(new BaseGCode(string.Format("(Engrave both directions: {0})", EngraveBothDirection)));
        }
Пример #2
0
        private IEnumerable<BaseGCode> Process()
        {
            var processor = new Engine.ImageProcessor(_Bitmap, Width, Height, LineResolution, PointResolution, Angle, SelectedInterpolator);
            var presenter = processor.CreatePresenter();

            var strokeGenerator = new Engine.GCodeGeneration.ImageProcessor.StrokesFromImageLinesGenerator(presenter.Lines, UseFreeZone, FreeZone, EngraveBothDirection);
            strokeGenerator.GenerateStrokes();

            var gcGen = new Engine.GCodeGeneration.ImageProcessor.GCodeGenerator(strokeGenerator.Strokes, (int)MinFeed, (int)MaxFeed, MaxPower, MinPower);
            var gcode = gcGen.GenerateCode();

            yield return new BaseGCode("G21");
            yield return new BaseGCode("G90");
            yield return new BaseGCode("M3 S0");

            foreach (var str in gcode)
                yield return str;

            yield return new BaseGCode("M5");
            yield return new BaseGCode("%");

            yield return new BaseGCode("(----ImageGenerator----)");
            yield return new BaseGCode(string.Format("(FileName: {0})", _PathToFile));
            yield return new BaseGCode(string.Format("(Width: {0} mm, Height: {1} mm)", Width, Height));
            yield return new BaseGCode(string.Format("(Resolution line: {0} mm, point: {1} mm)", LineResolution, PointResolution));
            yield return new BaseGCode(string.Format("(Feed max: {0} mm/min, min: {1} mm/min)", MaxFeed, MinFeed));
            yield return new BaseGCode(string.Format("(Power max: {0}, min: {1})", MaxPower, MinPower));
            yield return new BaseGCode(string.Format("(Angle: {0})", Angle));
            yield return new BaseGCode(string.Format("(Idle zones: {0})", UseFreeZone ? FreeZone : 0.0));
            yield return new BaseGCode(string.Format("(Engrave both directions: {0})", EngraveBothDirection));
        }