Esempio n. 1
0
        private void CreateHeart(double x, double y, double hsizeX2, double hsizeY2, bool mirror)
        {
            if (hsizeX2 < 0.000001) return;     // true black do nothing
            if (hsizeX2 * 2 < LaserSize)
            {
                CreateToSmallShape(x, y);
                return;
            }

            hsizeX2 *= 0.9;
            hsizeY2 = hsizeX2;
            double mr = mirror ? -1.0 : 1.0;

            Command c = new G00Command();
            c.AddVariable('X', ToGCode(x));
            c.AddVariable('Y', ToGCode(y + (hsizeY2 - StartLaserDist) * mr));
            Commands.Add(c);
            LaserOn();

            c = new G01Command();
            c.AddVariable('X', ToGCode(x));
            c.AddVariable('Y', ToGCode(y + hsizeY2*mr));
            Commands.Add(c);

            if (mirror)
                c = new G03Command();
            else
                 c= new G02Command();
            c.AddVariable('X', ToGCode(x+ hsizeX2));
            c.AddVariable('Y', ToGCode(y));
            c.AddVariable('I', ToGCode( hsizeX2 / 2.0));
            c.AddVariable('J', ToGCode(-hsizeY2 / 2.0 * mr));
            Commands.Add(c);

            c = new G01Command();
            c.AddVariable('X', ToGCode(x));
            c.AddVariable('Y', ToGCode(y-hsizeY2 * mr));
            Commands.Add(c);

            c = new G01Command();
            c.AddVariable('X', ToGCode(x - hsizeX2));
            c.AddVariable('Y', ToGCode(y));
            Commands.Add(c);

            if (mirror)
                c = new G03Command();
            else
                c = new G02Command();
            c.AddVariable('X', ToGCode(x));
            c.AddVariable('Y', ToGCode(y + hsizeY2 * mr));
            c.AddVariable('I', ToGCode(hsizeX2 / 2.0));
            c.AddVariable('J', ToGCode(hsizeY2 / 2.0 * mr));
            Commands.Add(c);
        }
Esempio n. 2
0
        private void CreateCircle(double x, double y, double radius)
        {
            if (radius < 0.000001) return;     // true black do nothing
            if (radius * 2 < LaserSize)
            {
                CreateToSmallShape(x, y);
                return;
            }

            Command c = new G00Command();
            c.AddVariable('X', ToGCode(x + radius - StartLaserDist));
            c.AddVariable('Y', ToGCode(y));
            Commands.Add(c);
            LaserOn();
            c = new G01Command();
            c.AddVariable('X', ToGCode(x + radius));
            Commands.Add(c);

            c = new G03Command();
            c.AddVariable('I', ToGCode(-radius));
            Commands.Add(c);
        }