Ejemplo n.º 1
0
        /// <summary>
        /// Draws a square filled with diagonals - uses 45 degree acceleration methods
        /// </summary>
        public static PlanBuilder DrawSquareWithDiagonals()
        {
            var speed            = Constants.MaxPlaneSpeed;
            var acceleration     = Constants.MaxPlaneAcceleration; //new Acceleration(Constants.MaxPlaneAcceleration.Speed,Constants.MaxPlaneAcceleration.Ticks*10);
            var squareSize       = 6000;
            var diagonalDistance = 300;



            var builder = new PlanBuilder();

            //do a square border
            builder.AddRampedLineXY(squareSize, 0, acceleration, speed);
            builder.AddRampedLineXY(0, squareSize, acceleration, speed);
            builder.AddRampedLineXY(-squareSize, 0, acceleration, speed);
            builder.AddRampedLineXY(0, -squareSize, acceleration, speed);
            //left right diagonals
            var diagonalCount = squareSize / diagonalDistance;

            for (var i = 0; i < diagonalCount * 2; ++i)
            {
                var diagLength = (diagonalCount - Math.Abs(i - diagonalCount)) * diagonalDistance;

                if (i % 2 == 0)
                {
                    builder.AddRampedLineXY(-diagLength, diagLength, acceleration, speed);
                    if (i < diagonalCount)
                    {
                        builder.AddRampedLineXY(0, diagonalDistance, acceleration, speed);
                    }
                    else
                    {
                        builder.AddRampedLineXY(diagonalDistance, 0, acceleration, speed);
                    }
                }
                else
                {
                    builder.AddRampedLineXY(diagLength, -diagLength, acceleration, speed);
                    if (i < diagonalCount)
                    {
                        builder.AddRampedLineXY(diagonalDistance, 0, acceleration, speed);
                    }
                    else
                    {
                        builder.AddRampedLineXY(0, diagonalDistance, acceleration, speed);
                    }
                }
            }

            return(builder);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// A single revolution with a lot of forward/backward direction changes.
        /// </summary>
        /// <returns></returns>
        public static PlanBuilder BackAndForwardRevolution()
        {
            var plan         = new PlanBuilder();
            var overShoot    = 100;
            var segmentation = 4;

            for (var i = 0; i < 400 / segmentation; ++i)
            {
                plan.AddRampedLineXY(-overShoot, -overShoot, Constants.MaxPlaneAcceleration, Constants.MaxPlaneSpeed);
                plan.AddRampedLineXY(segmentation + overShoot, segmentation + overShoot, Constants.MaxPlaneAcceleration, Constants.MaxPlaneSpeed);
            }

            return(plan);
        }
Ejemplo n.º 3
0
        private void AlignHeads_Click(object sender, RoutedEventArgs e)
        {
            var state = Cnc.PlannedState;
            var xSteps = state.X - state.U;
            var ySteps = state.Y - state.V;

            var builder = new PlanBuilder();
            builder.AddRampedLineXY(-xSteps, -ySteps, Constants.MaxPlaneAcceleration, Constants.MaxPlaneSpeed);
            Cnc.SEND(builder.Build());
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Demo with a single revolution interrupted several times.
        /// </summary>
        public static PlanBuilder InterruptedRevolution()
        {
            var plan         = new PlanBuilder();
            var segmentation = 100;

            for (var i = 0; i < 400 / segmentation; ++i)
            {
                plan.AddRampedLineXY(segmentation, segmentation, Constants.MaxPlaneAcceleration, Constants.MaxPlaneSpeed);
            }

            return(plan);
        }