Skip to content

Commit

Permalink
cmd/uv3dp: Fix check (layer index off-by-one error)
Browse files Browse the repository at this point in the history
  • Loading branch information
ezrec committed Jan 26, 2021
1 parent 6567a2e commit 6663915
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions cmd/uv3dp/check.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,18 @@ func (mod *checkModifier) LayerZ(index int) (z float32) {
panic(fmt.Sprintf("Layer %d: Z value of %.02fmm is too close to the screen", index, z))
}

if index > 0 {
prev_z := mod.Printable.LayerZ(index - 1)
if z < prev_z {
panic(fmt.Sprintf("Layer %d: Z value of %.02fmm is below the previous layer at %.02fmm", index, z, prev_z))
}

nominal_dz := mod.Printable.Size().LayerHeight

if (z - prev_z) > nominal_dz*1.5 {
panic(fmt.Sprintf("Layer %d: Layer height of %.02fmm is too far from nominal of %.02fmm", index, z-prev_z, nominal_dz))
}
}
if index > 0 {
prev_z := mod.Printable.LayerZ(index - 1)
if z < prev_z {
panic(fmt.Sprintf("Layer %d: Z value of %.02fmm is below the previous layer at %.02fmm", index, z, prev_z))
}

nominal_dz := mod.Printable.Size().LayerHeight

if (z - prev_z) > nominal_dz*1.5 {
panic(fmt.Sprintf("Layer %d: Layer height of %.02fmm is too far from nominal of %.02fmm", index, z-prev_z, nominal_dz))
}
}

return
}
Expand Down

0 comments on commit 6663915

Please sign in to comment.