private void generateToothTopMilling(IGeometryOutput sb) { double cDep = work.dimensions.stockThickness - work.dimensions.plateThickness - work.dimensions.toothThickness; if (cDep <= 0) { return; } sb.BeginGroup("generateToothTopMilling"); double iRad = work.calc.radius - work.calc.dedendum - work.dimensions.ridgeMargin + work.mainMill.diameter * 0.5f; double oRad = work.calc.radius + work.calc.addendum + work.dimensions.plateMargin + work.mainMill.diameter * 0.5f; if (oRad < iRad) { oRad = iRad; } sb.SetDepth(0.1f); sb.MoveTo(new PointF(0, (float)iRad)); double rDep = cDep - work.dimensions.ridgeThickness; sb.SetDepth((float)-rDep); for (double d = rDep; d < cDep;) { d += work.mainMill.passDepth; if (d > cDep) { d = cDep; } // plunge slowly sb.SetDepth((float)-d); bool running = true; bool first = true; for (double r = iRad; running; r += work.mainMill.stepOver) { if (r >= oRad) { r = oRad; running = false; } bool clockwise = true; if (first) { clockwise = false; first = false; } sb.LineTo(new PointF(0, (float)r)); sb.ArcTo(new PointF(0, (float)r), new PointF(0, 0), clockwise); } } sb.SetDepth(0); sb.SetDepth(0.1f); sb.EndGroup(); }
private void generatePrefix(IGeometryOutput sb, MillInfo mill) { sb.BeginGroup("generatePrefix"); sb.Comment(String.Format("Diameter {0} Cut Depth {1} Pass Depth {2} Feed {3} Speed {4}", mill.diameter, mill.cuttingDepth, mill.passDepth, mill.feed, mill.speed)); sb.SetFeed((float)mill.feed); sb.SetSpeed((float)mill.speed); sb.SetDepth(0.5f); sb.MoveTo(new PointF(0, 0)); sb.SetDepth(0.1f); sb.EndGroup(); }
private void generateHoleMilling(IGeometryOutput sb) { sb.BeginGroup("generateHoleMilling"); float dia = (float)(work.mainMill.diameter * 0.5); sb.MoveTo(new PointF(0, dia)); sb.SetDepth(0); double pd = 0; bool running = true; while (running) { pd += work.mainMill.passDepth; if (pd >= work.dimensions.stockThickness + cutThroughMargin) { pd = work.dimensions.stockThickness; running = false; } sb.SetDepth((float)-pd); sb.ArcTo(new PointF(0, dia), new PointF(0, 0), false); sb.SetDepth(0); } sb.SetDepth((float)-(work.dimensions.stockThickness + cutThroughMargin)); sb.ArcTo(new PointF(0, dia), new PointF(0, 0), false); sb.SetDepth(0); sb.SetDepth(0.1f); sb.EndGroup(); }
private void generateToothProfileMilling(IGeometryOutput sb, int teeth, MillInfo mill) { sb.BeginGroup("generateToothProfileMilling"); Outline nuProfile = GenerateOutline(work.profile, teeth, mill.diameter); PointF start = nuProfile.points[0]; double cDep = work.dimensions.stockThickness - work.dimensions.plateThickness; double rDep = cDep - work.dimensions.toothThickness; sb.MoveTo(start); sb.SetDepth((float)-rDep); PointF curPos = start; double endDepth = cDep; if (work.dimensions.plateThickness == 0) { endDepth += cutThroughMargin; } sb.Comment(String.Format("startDepth {0} endDepth {1} passDepth {2}", rDep, endDepth, mill.passDepth)); for (double d = rDep; d < endDepth;) { d += mill.passDepth; if (d > endDepth) { d = endDepth; } // plunge slowly sb.SetDepth((float)-d); foreach (PointF p in nuProfile.points) { curPos = LineOrArc(sb, p, curPos); } LineOrArc(sb, start, curPos); curPos = start; } sb.SetDepth(0); sb.SetDepth(0.1f); sb.EndGroup(); }
private void generateSuffix(IGeometryOutput sb) { sb.BeginGroup("generateSuffix"); sb.SetDepth(0.5f); sb.EndGroup(); }
private void generateToothProfileMilling(IGeometryOutput sb, int teeth, MillInfo mill) { sb.BeginGroup("generateToothProfileMilling"); Outline nuProfile = GenerateOutline(work.profile, teeth, mill.diameter); PointF start = nuProfile.points[0]; double cDep = work.dimensions.stockThickness - work.dimensions.plateThickness; double rDep = cDep - work.dimensions.toothThickness; sb.MoveTo(start); sb.SetDepth((float)-rDep); PointF curPos = start; double endDepth = cDep; if (work.dimensions.plateThickness == 0) { endDepth += cutThroughMargin; } sb.Comment(String.Format("startDepth {0} endDepth {1} passDepth {2}", rDep, endDepth, mill.passDepth)); for (double d = rDep; d < endDepth; ) { d += mill.passDepth; if (d > endDepth) { d = endDepth; } // plunge slowly sb.SetDepth((float)-d); foreach (PointF p in nuProfile.points) { curPos = LineOrArc(sb, p, curPos); } LineOrArc(sb, start, curPos); curPos = start; } sb.SetDepth(0); sb.SetDepth(0.1f); sb.EndGroup(); }
private void generatePlateMilling(IGeometryOutput sb) { if (work.dimensions.plateThickness <= 0) { return; } double cDep = work.dimensions.stockThickness; if (cDep <= 0) { return; } sb.BeginGroup("generatePlateMilling"); double iRad = work.calc.radius + work.calc.addendum + work.mainMill.diameter * 0.5f; double oRad = work.calc.radius + work.calc.addendum + work.dimensions.plateMargin + work.mainMill.diameter * 0.5f; if (oRad < iRad) { oRad = iRad; } sb.SetDepth(0.1f); sb.MoveTo(new PointF(0, (float)iRad)); double rDep = cDep - work.dimensions.plateThickness; sb.SetDepth((float)-rDep); for (double d = rDep; d < cDep; ) { d += work.mainMill.passDepth; if (d > cDep) { d = cDep; } // plunge slowly sb.SetDepth((float)-d); bool running = true; bool first = true; for (double r = iRad; running; r += work.mainMill.stepOver) { if (r >= oRad) { r = oRad; running = false; } bool clockwise = true; if (first) { clockwise = false; first = false; } if (work.dimensions.stockThickness - tabHeight < d && r > oRad - work.mainMill.stepOver) { // mill with tabs sb.Comment("todo: mill with tabs"); } sb.LineTo(new PointF(0, (float)r)); sb.ArcTo(new PointF(0, (float)r), new PointF(0, 0), clockwise); } } sb.SetDepth(0); sb.SetDepth(0.1f); sb.EndGroup(); }
private void generateRidgeTopMilling(IGeometryOutput sb) { double cDep = work.dimensions.stockThickness - work.dimensions.plateThickness - work.dimensions.toothThickness - work.dimensions.ridgeThickness; if (cDep <= 0) { return; } sb.BeginGroup("generateRidgeTopMilling"); double iRad = work.calc.radius - work.calc.dedendum - work.dimensions.ridgeMargin - work.dimensions.ridgeThickness + work.mainMill.diameter * 0.5f; double oRad = work.calc.radius + work.calc.addendum + work.dimensions.plateMargin + work.mainMill.diameter * 0.5f; if (oRad < iRad) { oRad = iRad; } sb.SetDepth(0.1f); sb.MoveTo(new PointF(0, (float)iRad)); sb.SetDepth(0); for (double d = 0; d < cDep;) { d += work.mainMill.passDepth; if (d > cDep) { d = cDep; } // plunge slowly sb.SetDepth((float)-d); bool running = true; bool first = true; for (double r = iRad; running; r += work.mainMill.stepOver) { if (r >= oRad) { r = oRad; running = false; } bool clockwise = true; if (first) { clockwise = false; first = false; } sb.LineTo(new PointF(0, (float)r)); sb.ArcTo(new PointF(0, (float)r), new PointF(0, 0), clockwise); } } sb.SetDepth(0); sb.SetDepth(0.1f); sb.EndGroup(); }