private static void Cutting(ProcessObject processObject, Curve curve) { var par = processObject.ProcessingParams; var s = par.DepthAll; var direction = processObject.Direction; var isFirstPass = true; do { if (!IsCalculation) { return; } if (!isFirstPass) { s -= par.Depth; if (s < 0) { s = 0; } if (!Settings.OneDirection) { direction = -direction; } } Curve toolpathCurve = Settings.ProcessMode == ProcessMode.StepByStepDescent ? AutocadUtils.GetDisplacementCopy(curve, Settings.Thickness - par.DepthAll + s) : AutocadUtils.GetOffsetCopy(curve, processObject.Curve.OutsideSign * s); if (!Settings.WithCompensation) { toolpathCurve = AutocadUtils.GetOffsetCopy(toolpathCurve, processObject.Curve.OutsideSign * processObject.Tool.Diameter.Value / 2); } Feed(toolpathCurve, direction, processObject.Curve.OutsideSign, par, isFirstPass || Settings.OneDirection); if (processObject.Curve.Type == CurveType.Polyline || processObject.Curve.Type == CurveType.Circle) { Machine.Cutting(AutocadUtils.Explode(toolpathCurve, direction == -1), par.GreatSpeed); } else { Machine.Cutting(toolpathCurve, par.GreatSpeed); } Retract(toolpathCurve, direction, processObject.Curve.OutsideSign, par); isFirstPass = false; } while (s > 0); }
private static void CuttingContinuousDescent(ProcessObject processObject, Curve curve) { var par = processObject.ProcessingParams; var toolpathCurve = AutocadUtils.GetOffsetCopy(curve, Settings.WithCompensation ? 0 : processObject.Curve.OutsideSign * processObject.Tool.Diameter.Value / 2); var toolpathCurves = AutocadUtils.Explode(toolpathCurve, processObject.Direction == -1); toolpathCurve = AutocadUtils.GetDisplacementCopy(toolpathCurve, Settings.Thickness); Feed(toolpathCurve, processObject.Direction, processObject.Curve.OutsideSign, par, true); var z0 = Settings.Thickness - par.DepthAll; var z = Settings.Thickness; var k = par.Depth / toolpathCurve.GetLength(); IEnumerator <Curve> enumerator = toolpathCurves.GetEnumerator(); enumerator.MoveNext(); do { if (!IsCalculation) { return; } z -= k * enumerator.Current.GetLength(); if (z - z0 < CalcUtils.Tolerance) { z = z0; } toolpathCurve = AutocadUtils.GetDisplacementCopy(enumerator.Current, z); Machine.Cutting(toolpathCurve, par.GreatSpeed); MoveCycle(enumerator); } while (z > z0); var startCurve = enumerator.Current; do { toolpathCurve = AutocadUtils.GetDisplacementCopy(enumerator.Current, z0); Machine.Cutting(toolpathCurve, par.GreatSpeed); MoveCycle(enumerator); } while (enumerator.Current != startCurve); enumerator.Dispose(); Retract(toolpathCurve, processObject.Direction, processObject.Curve.OutsideSign, par); }
private static void CuttingProfileDisc(ProcessObject processObject, Curve curve, List <Curve> sectionCurves) { if (sectionCurves.Count == 0) { AutocadUtils.ShowError("Не указано сечение"); return; } var par = processObject.ProcessingParams; var z = Settings.HeightMax; do { if (!IsCalculation) { return; } var d1 = CalcUtils.GetSectionDepth(sectionCurves, z); var d2 = CalcUtils.GetSectionDepth(sectionCurves, z - processObject.Tool.Thickness.GetValueOrDefault()); double d; if (d1.HasValue && d2.HasValue) { d = d1 > d2 ? d1.Value : d2.Value; } else if (d1.HasValue) { d = d1.Value; } else if (d2.HasValue) { d = d2.Value; } else { return; } var toolpathCurve = AutocadUtils.GetDisplacementCopy(curve, z); AlternatingCuttingCurve(processObject, toolpathCurve, d + Settings.Pripusk); z -= Settings.VerticalStep; }while (z >= Settings.HeightMin); }