Please consider a faster algorithm for the length of a polyline(-segment), example code in this forum topic.
It is totally not required to explode a polyline to its individual segments first.
And discard all these shapes afterwards.
The required data can be extracted directly from the vertex data as explained.
Chord length and sweep angle for bulging segments is readily available.
The segment length is then nothing more than:
- =A * sin(B) / B
- =A when it is straight.
Results are systematically the same apart form the last or the last few floating point digits.
With such an accuracy error, it is impossible to determine which of the routes is more accurate.
In the end it is a running sum and that suffers from accuracy loss in floating point.
Except with 3D data ... But then QCAD can not render a 3D polyline with bulging segments correctly in the first place.
And it will not save such data.
For that we have to agree that a bulging segment ... a so-called 'Arc' in top view with 3D data is part of a Helix (G2/G3).
With a pitch of zero, it is again a flat, arc-shaped segment.
Regards,
CVH