Skip to content

Commit

Permalink
Merge pull request #27 from Ultimaker/fix-layer-radius
Browse files Browse the repository at this point in the history
Improve extrusion radius calculation in parser
  • Loading branch information
aligator authored Dec 3, 2024
2 parents b41428b + f608837 commit 453d2db
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -348,16 +348,17 @@ export class GCodeParser {
const length = getLength(lastPoint, newPoint);

if (length !== 0) {
let radius = ((e - lastE) / length) * 10;
let radiusSquared = ((e - lastE) / length);

let radius = 0;
// Hide negative extrusions as only move-extrusions
if (radius < 0) {
if (radiusSquared < 0) {
radius = 0;
}

if (radius == 0) {
if (radiusSquared === 0) {
radius = travelWidth;
} else {
radius = Math.sqrt(radiusSquared);
// Update the bounding box.
const { min: newMin, max: newMax } = calcMinMax(
min,
Expand Down

0 comments on commit 453d2db

Please sign in to comment.