// [TODO] no reason we couldn't start on edge midpoint?? public virtual void AppendPolygon2d(FillPolygon2d poly) { Vector3d currentPos = Builder.Position; Vector2d currentPos2 = currentPos.xy; int N = poly.VertexCount; if (N < 2) { throw new Exception("PathScheduler.AppendPolygon2d: degenerate curve!"); } int iNearest = CurveUtils2.FindNearestVertex(currentPos2, poly.Vertices); Vector2d startPt = poly[iNearest]; Builder.AppendTravel(startPt, Settings.RapidTravelSpeed); List <Vector2d> loopV = new List <Vector2d>(N + 1); for (int i = 0; i <= N; i++) { int k = (iNearest + i) % N; loopV.Add(poly[k]); } double useSpeed = select_speed(poly); Builder.AppendExtrude(loopV, useSpeed, poly.TypeFlags, null); }
private void AppendTravel(Vector2d startPt, Vector2d endPt) { double travelDistance = startPt.Distance(endPt); // a travel may require a retract, which we might want to skip if (ExtrudeOnShortTravels && travelDistance < ShortTravelDistance) { Builder.AppendExtrude(endPt, Settings.RapidTravelSpeed); } else if (Settings.TravelLiftEnabled && travelDistance > Settings.TravelLiftDistanceThreshold) { Builder.AppendZChange(Settings.TravelLiftHeight, Settings.ZTravelSpeed, ToolpathTypes.Travel); Builder.AppendTravel(endPt, Settings.RapidTravelSpeed); Builder.AppendZChange(-Settings.TravelLiftHeight, Settings.ZTravelSpeed, ToolpathTypes.Travel); } else { Builder.AppendTravel(endPt, Settings.RapidTravelSpeed); } }
protected virtual void AppendTravel(Vector2d startPt, Vector2d endPt) { double travelDistance = startPt.Distance(endPt); // a travel may require a retract, which we might want to skip if (ExtrudeOnShortTravels && travelDistance < ShortTravelDistance) { // TODO: Add strategy for extrude move? Builder.AppendExtrude(endPt, Settings.Part.RapidTravelSpeed, new DefaultFillType()); } else if (Settings.Part.TravelLiftEnabled && travelDistance > Settings.Part.TravelLiftDistanceThreshold) { Builder.AppendMoveToZ(LayerZ + Settings.Part.TravelLiftHeight, Settings.Part.ZTravelSpeed, ToolpathTypes.Travel); Builder.AppendTravel(endPt, Settings.Part.RapidTravelSpeed); Builder.AppendMoveToZ(LayerZ, Settings.Part.ZTravelSpeed, ToolpathTypes.Travel); } else { Builder.AppendTravel(endPt, Settings.Part.RapidTravelSpeed); } }