Line Length Accuracy

Line Length Accuracy

Anonymous
Not applicable
410 Views
2 Replies
Message 1 of 3

Line Length Accuracy

Anonymous
Not applicable

Is it possible for a lisp routine to measure line length accuracy more/less precise than AutoCAD itself when the precision in AutoCAD is set to its highest? The reason I am asking, we have a lisp routine that exports line lengths to an Excel spreadsheet and separates into differing categories based primarily upon line length (as far as I know). Although I am sure line entities have specific qualities other than length that could cause them to list differently (i.e. - handle, start/end point, etc.), are there any other aspects of a line entity in AutoCAD, other than length, that could cause it to somehow affect the listing of the lines length through a lisp that would cause this anomaly?

 

Many thanks!

0 Likes
411 Views
2 Replies
Replies (2)
Message 2 of 3

stevor
Collaborator
Collaborator

This URL is detailed, maybe more than you want, yet

 good to know if you need to use the word 'precision:"

 

 http://blog.jtbworld.com/2008/04/understanding-floating-point-precision.html

 

I would use strings, by the function RTOS, ie:

 (rtos YourRealNumber 2 15)

to see tha actual decimal value employed.

S
0 Likes
Message 3 of 3

dgorsman
Consultant
Consultant

Lines don't have a fixed property for length; rather, it is calculated from the coordinates of the end points.  And regardless of the precision of the AutoCAD display the precision of the actual values stays the same (and always in WCS values).

 

As noted by the other poster you could get into trouble with floating point precision with extremely large numbers and precise numbers.  Depending on how you get the numbers from AutoCAD to Excel there may be rounding/precision errors.  And depending on the actual model contents there may be some very, very small precision errors when lengths are calculated internally.  For all of those reasons its usually best to do a fuzzy comparison rather than a direct comparison when checking equality on coordinates and lengths.

----------------------------------
If you are going to fly by the seat of your pants, expect friction burns.
"I don't know" is the beginning of knowledge, not the end.


0 Likes