Example #1
0
        public GeneratePass(CodeBlock code, List<Polar> offsets)
        {
            this.code = code;
            this.offsets = offsets;
            lowerLimit = 0;
            upperLimit = offsets.Count - 1;

            if (Data.sRotaryDirection.Equals("I"))
            {
                if (Data.dBacklash != 0) { backlashCompensation = -Data.dBacklash; }
            }
            else
            {
                offsets.Reverse();
                if (Data.dBacklash != 0) { backlashCompensation = Data.dBacklash; }
            }
        }
Example #2
0
        // These are the roughing passes where we work down to the base circle
        private void buildManyPasses()
        {
            Data.sWarning = "";
            CodeBlock code = new CodeBlock();
            GeneratePass gen = new GeneratePass(code, BuildPasses.buildRawOffsets());

            PathMetrics pm = new PathMetrics();
            pm.compute();
            int passes = pm.getNumberRoughPasses();
            double depthPerPass = pm.getDepthRoughPasses();
            double currentDepth = 0;
            double maxOffset = 0;
            double maxOffsetAngle = 0;
            int maxOffsetPass = 0;

            code.add(doPreCode());

            for (int pass = 1; pass <= passes; pass++)
            {
                code.add("(============= Pass " + pass.ToString() + " of " + passes.ToString() + " =============)");
                currentDepth -= depthPerPass;

                gen.generateNextPass(currentDepth, 0);

                Polar max = gen.getMaxOffset();
                if(max.r > maxOffset)
                {
                    maxOffset = max.r;
                    maxOffsetAngle = max.a;
                    maxOffsetPass = pass;
                }
            }

            code.retract();
            code.rotate(0);

            code.add(doPostCode());
            Data.sGCode = code.getCode();

            if(maxOffset > 0) { doOffsetWarning(maxOffset, maxOffsetAngle, maxOffsetPass); }
        }
Example #3
0
        // This is the final pass with compensation for grinder wear
        public void buildFinalPass()
        {
            Data.sWarning = "";
            CodeBlock code = new CodeBlock();
            GeneratePass gen = new GeneratePass(code, BuildPasses.buildRawOffsets());

            code.add(doPreCode());
            code.add("(============= Single finish pass =============)");

            // Adjust for grinder wear
            double grinderAdjust = Data.dActualBaseDiameter / 2 - Data.dBaseRadius;

            gen.generateNextPass(0, grinderAdjust);

            code.retract();
            code.rotate(0);

            code.add(doPostCode());

            Data.sGCode = code.getCode();
        }
Example #4
0
        private void buildOnePass()
        {
            Data.sWarning = "";
            CodeBlock code = new CodeBlock();
            GeneratePass gen = new GeneratePass(code, BuildPasses.buildRawOffsets());

            code.add(doPreCode());
            code.add("(============= Single pass =============)");

            gen.generateNextPass(0, 0);

            code.retract();
            code.rotate(0);
            code.add(doPostCode());

            Data.sGCode = code.getCode();
        }