private static void AlternatingCuttingCurve(ProcessObject processObject, Curve curve, double d) { var par = processObject.ProcessingParams; // s - текущее смещение от кривой контура детали curve // d - заданная величина смещения var s = par.Depth > 0 ? (par.DepthAll > d ? par.DepthAll : d) : d; s -= par.Depth; if (s < d) { s = d; } var direction = processObject.Direction; var isFirstPass = true; do { if (!IsCalculation) { return; } if (!isFirstPass) { s -= par.Depth; if (s < d) { s = d; } direction = -direction; } var s1 = Settings.WithCompensation ? s : s + processObject.Tool.Diameter.Value / 2; Curve toolpathCurve = AutocadUtils.GetOffsetCopy(curve, processObject.Curve.OutsideSign * s1); ObjectId toolObjectId = AutocadUtils.CreateToolCurve(s, toolpathCurve.StartPoint.Z, processObject.Tool.Thickness); Feed(toolpathCurve, direction, processObject.Curve.OutsideSign, par, isFirstPass); List <ProcessingAction> actions = new List <ProcessingAction>(); if (processObject.Curve.Type == CurveType.Polyline || processObject.Curve.Type == CurveType.Circle) { actions = Machine.Cutting(AutocadUtils.Explode(toolpathCurve, direction == -1), par.GreatSpeed); } else { actions.Add(Machine.Cutting(toolpathCurve, par.GreatSpeed)); } actions.ForEach(p => p.ToolObjectId = toolObjectId); Retract(toolpathCurve, direction, processObject.Curve.OutsideSign, par); isFirstPass = false; }while (s > d); }
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); }