Пример #1
0
        public override void restoreData()
        {
            pm = new PathMetrics();
            pm.compute();

            lblSetup.Text = "Move the grinding wheel to just touch the blank and zero the " + Data.sRotaryAxis + " and " + Data.sOffsetAxis + " axis.<br /><br />" +
                            "If cutting several cams on the same blank the part of the bank that will become the nose should be pointing directly at the centre of the grinding wheel.";

            if (pm.getNumberRoughPasses() == 1)
            {
                lblBuildRough.Text = "Build code for one pass of " + Change.toString(pm.getDepthRoughPasses()) + " " +
                                      Data.sUnits;
            }
            else
            {
                lblBuildRough.Text = "Build code for " + pm.getNumberRoughPasses().ToString() + " passes of " + Change.toString(pm.getDepthRoughPasses()) + " " +
                                      Data.sUnits + " each leaving " + Change.toString(Data.dFinishPass) + " to finish.";
            }

            double actualBase = (Data.dBaseRadius + Data.dFinishPass) * 2;

            lblFinishNote.Text = "<p>Your cam should now have a base diameter of " + Change.toString(actualBase) +
                                     " (twice base radius + finish allowance).  In practice it will likely be more than that due to wear on the grinding wheel. </p>" +
                                     "<p>Measure the current base diameter and enter it below.  The finish pass will be calculated to compensate for this wear.<p>" +
                                     "<p>If you have to change the setup go back to the mill screen and enter the new grinding wheel diameter and set both rough pass and finish pass to zero.  This will finish the job in a single pass.</p>";

            txtNewBaseRadius.Text = Change.toString(actualBase);
        }
Пример #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); }
        }