LinuxCNC / linuxcnc

LinuxCNC controls CNC machines. It can drive milling machines, lathes, 3d printers, laser cutters, plasma cutters, robot arms, hexapods, and more.
http://linuxcnc.org/
GNU General Public License v2.0
1.74k stars 1.14k forks source link

tooledit Rounding issue on tool offset #2593

Open robharp opened 12 months ago

robharp commented 12 months ago

Here are the steps I follow to reproduce the issue:

  1. open tooledit to edit a tool length
  2. make a tool 3 digital number proceeded with more than 3 decimals 123.1596
  3. the number is rounded up when using a 3 digit proceeding number to 3 decimal places,
    • but with less than 3 proceeding length number its rounded to deciaml 8 places

This is what I expected to happen:

all numbers should be rounded to 8 Decimal or better regarding what the proceeding number is.
*note have not comfirmed this on an imperial setup only metric

This is what happened instead:

see forum post for more info, also confirmed by andy https://forum.linuxcnc.org/38-general-linuxcnc-questions/49558-tooledit-rounding-issue-on-tool-offset

It worked properly before this:

unknown assuming its always been like this, but users with long tool lengths would only see this issue..

Information about my hardware and software:

Linuxcnc 2.8.4 Metric Mode set in ini Diamiter programing on Gui : Axis mode : Lathe

d2inventory commented 11 months ago

The issue is the %g formatting used.

This has other "issues", f.e. 0.000054 would be written as 5.6e-05

Using %.9g would limit the number of digits to 9 (instead of 6 as is the default for %g) and fix this issue, but the other issue I mentioned would still be there.

Code line: https://github.com/LinuxCNC/linuxcnc/blob/ab8778c16e4ff069e41ef647b3326e0c109191b3/tcl/tooledit.tcl#L99