Skip to content

Commit a94a771

Browse files
author
Parent Jerome
committed
Update tangential-knife.cps
1 parent e7598dd commit a94a771

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

tangential-knife.cps

+5-3
Original file line numberDiff line numberDiff line change
@@ -89,20 +89,21 @@ var offset = 0
8989
*/
9090
function updateC(target_rad) {
9191
//check if we should rotate the head
92-
var delta_rad = (target_rad-c_rad) % (2*Math.PI)
92+
var delta_rad = (target_rad-c_rad) //% (2*Math.PI)
9393
//writeComment(String.concat('delta ',delta_rad))
9494
if (Math.abs(delta_rad) > liftAtCorner_rad) { //angle between segments is larger than max_angle : lift the knife, rotate and plunge back in material
9595
moveUp()
9696
gMotionModal.reset()
9797
writeBlock(gMotionModal.format(0), cOutput.format(toDeg(target_rad)+offset));
9898
moveDown()
99+
c_rad = target_rad
99100
}
100-
else if (delta_rad == 0){ //next segment is colinear with current segment : do nothing
101+
else if (delta_rad % (2*Math.PI) == 0){ //next segment is colinear with current segment : do nothing
101102
}
102103
else { //angle between segments is smaller than max_angle : rotate knife in material
103104
writeBlock(gMotionModal.format(1), cOutput.format(toDeg(target_rad)+offset));
105+
c_rad = target_rad
104106
}
105-
c_rad += delta_rad
106107
}
107108

108109
function moveUp() {
@@ -310,6 +311,7 @@ function onCircular(clockwise, cx, cy, cz, x, y, z, feed) {
310311
else {
311312
c_rad += angle
312313
}
314+
writeComment(String.concat(toDeg(start_dir),' ',toDeg(angle),' ',toDeg(c_rad)))
313315
writeBlock(gMotionModal.format(clockwise ? 2 : 3), xOutput.format(x), yOutput.format(y), cOutput.format(toDeg(c_rad)+offset), iOutput.format(cx - start.x, 0), jOutput.format(cy - start.y, 0), feedOutput.format(feed));
314316
/*
315317
var start = getCurrentPosition();

0 commit comments

Comments
 (0)