-
Notifications
You must be signed in to change notification settings - Fork 240
Incorrect aligned dimension extension lines and measurment text for slightly non-vertical segments #1300
Copy link
Copy link
Open
Description
For certain segments, rendering an aligned dimension results in incorrect extension lines and wrong measurement text. Depending on the point coordinates, it might be correct or wrong, while the dimension.get_measurement() returns the correct value.
Here is the reproducer example:
import ezdxf
print(f"Using ezdxf version: {ezdxf.__version__}")
points = [
(250235.3373553778, 99368),
(250235.3373553779, 99412),
]
output_filename = "polyline_example.dxf"
doc = ezdxf.new()
doc.modelspace().add_lwpolyline(points)
p1, p2 = points[0], points[1]
doc.modelspace().add_aligned_dim(p1, p2, distance=20).render()
print(f"Polyline points: {points}")
dim = list(doc.modelspace().query("DIMENSION"))[0]
print(f"Dimension text: {dim.dxf.text}")
print(f"Dimension measurement: {dim.get_measurement()}")
for e in dim.virtual_entities():
if e.dxftype() == "MTEXT":
print(f"MTEXT text: {e.dxf.text}")
doc.saveas(output_filename)
print(f"DXF file '{output_filename}' created successfully!")Note that the distance between the points is ~44 units.
I use python version 3.12.9
Output:
Using ezdxf version: 1.4.2
Polyline points: [(250235.3373553778, 99368), (250235.3373553779, 99412)]
Dimension text: <>
Dimension measurement: 44.0
MTEXT text: 32
DXF file 'polyline_example.dxf' created successfully!
If I change the numeric values ever so slightly, I get the expected parallel lines and correct measurement text:
Using ezdxf version: 1.4.2
Polyline points: [(250235.337355377, 99368), (250235.337355377, 99412)]
Dimension text: <>
Dimension measurement: 44.0
MTEXT text: 44
DXF file 'polyline_example.dxf' created successfully!
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels

