TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: dubb on February 10, 2017, 12:12:02 PM
-
Using this snippet script to calculate the distance. The result is 1 unit less than what I expected :tickedoff:. The unexpected calculated results only occurs on parallel lines that are angled. Horizontal parallel lines seem to calculate as expected. Screenshot included.
Script used to pick points.
(setq pt1 (getpoint "\nSelect first point"))
(setq pt2 (getpoint pt1 "\nSelect second point"))
Script used to calculate the distance.
(fix (distance pt1 pt2))
Select first point
Select second point_per to
Command:
Command: (fix (distance pt1 pt2))
7
-
HERE (https://www.theswamp.org/index.php?topic=52552.msg574643#msg574643) is a thread with a similar problem.
Maybe try: (fix (+ 1e-8 (distance pt1 pt2)))
-
Ahhh! Thanks Ron! :smitten:
I kinda remember that post. I guess I was using the wrong search query. Though its weird we have to use scientific notation to obtain these results.
-
Ahhh! Thanks Ron! :smitten:
I kinda remember that post. I guess I was using the wrong search query. Though its weird we have to use scientific notation to obtain these results.
Glad to help :)
-
I would suggest using a rounding function in lieu of ( fix ). -David
-
I would suggest using a rounding function in lieu of ( fix ). -David
Something like : http://www.lee-mac.com/round.html (http://www.lee-mac.com/round.html)