Skip to content

Commit

Permalink
Use rapid movement when drilling on up (#2698)
Browse files Browse the repository at this point in the history
  • Loading branch information
breiler authored Feb 15, 2025
1 parent 260ac54 commit 57a1233
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ private void addDepthSegment(GcodePath gcodePath, double depth) {
.build());
}

private void addUpSegment(GcodePath gcodePath) {
gcodePath.addSegment(SegmentType.MOVE, PartialPosition.builder(UnitUtils.Units.MM)
.setZ(0d)
.build());
}

private PartialPosition getCenterPosition() {
Point2D center = source.getCenter();
return PartialPosition.builder(UnitUtils.Units.MM)
Expand Down Expand Up @@ -75,7 +81,7 @@ public void appendGcodePath(GcodePath gcodePath, Settings settings) {
addDepthSegment(gcodePath, depth);

if (currentDepth != 0) {
addDepthSegment(gcodePath, 0d);
addUpSegment(gcodePath);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public void drillCenterShouldDrillInCenterOfShape() {
assertEquals(-5, gcodePath.getSegments().get(4).point.getZ(), 0.01);

// Clear material
assertEquals(SegmentType.POINT, gcodePath.getSegments().get(5).type);
assertEquals(SegmentType.MOVE, gcodePath.getSegments().get(5).type);
assertFalse(gcodePath.getSegments().get(5).point.hasX());
assertFalse(gcodePath.getSegments().get(5).point.hasY());
assertEquals(-0, gcodePath.getSegments().get(5).point.getZ(), 0.01);
Expand All @@ -72,7 +72,7 @@ public void drillCenterShouldDrillInCenterOfShape() {
assertEquals(-10, gcodePath.getSegments().get(6).point.getZ(), 0.01);

// Clear material
assertEquals(SegmentType.POINT, gcodePath.getSegments().get(7).type);
assertEquals(SegmentType.MOVE, gcodePath.getSegments().get(7).type);
assertFalse(gcodePath.getSegments().get(7).point.hasX());
assertFalse(gcodePath.getSegments().get(7).point.hasY());
assertEquals(0, gcodePath.getSegments().get(7).point.getZ(), 0.01);
Expand Down

0 comments on commit 57a1233

Please sign in to comment.