Closed mozman closed 2 years ago
This is already fixed in issue #557 and will be included in the next release v0.17.1.
Thanks a lot Manfred. I really appreciate it.
This is really strange: I received 2 bug reports on a long existing error within a very short time - unfortunately in the wrong order. Your bug report would have saved me a lot of time.
For your info - I've just tried it out with code from the current master branch and the result is the same as previously reported (still with trimmed 0).
Can't reproduce this issue, this script creates the expected measurement text and does not remove the trailing "0":
from pathlib import Path
import ezdxf
DIR = Path("~/Desktop/Outbox").expanduser()
doc = ezdxf.new(setup=True)
msp = doc.modelspace()
def add_dims(x1, x2):
msp.add_aligned_dim((x1, 0), (x2, 0), 2).render() # default dimdec=2
msp.add_aligned_dim((x1, 0), (x2, 0), 4, override={"dimdec": 1}).render()
msp.add_aligned_dim((x1, 0), (x2, 0), 6, override={"dimdec": 0}).render()
add_dims(0, 9.55555)
add_dims(10, 20.5)
doc.saveas(DIR / "issue566.dxf")
This is interesting, I just copy&pasted the provided script and I get different result:
I'm on Fedora 32 (5.10.19-100.fc32.x86_64) and opening the file in BricsCAD v18.
Check if you really pulled from "master".
Please exec following lines:
"." in str(3.14) # should be True
print(ord(".")) # should be 46
I've now double-checked I have the code from master. The used version was master@3a649b9 from today's morning.
Now on current master@67bdec0 the behaviour is the same.
Here the test exec:
Python 3.8.7 (default, Jan 20 2021, 00:00:00)
[GCC 10.2.1 20201125 (Red Hat 10.2.1-9)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> "." in str(3.14)
True
>>> print(ord("."))
46
Running the code on WSL2 (Windows Subsystem for Linux) creates the same correct result:
Maybe remove ezdxf
complete and reinstall it or run it in a virtual environment to check how a fresh install behaves.
Finally, I'm getting the same result as you! Sorry for this, I only removed and installed the package before, now after installing it inside of a fresh venv both my app and your test example script are producing correct output.
Discussed in https://github.com/mozman/ezdxf/discussions/565