I left part of it out the pt is the point you select so it will not be polar with the endpoints and the intersection always is there a way like (= ang1 ang2) but make it so it can be 0.05 degrees off
(setq obj (entsel "\nSelect object:"))
(setq pol (car obj))
(setq pt (cadr obj))
(setq end1 (cdr (assoc 10 (entget pol))))
(setq end2 (cdr (assoc 11 (entget pol))))
(setq int1 (list (car int) (cadr int) (caddr int))) ;intersection 1 of objects
(setq int2 (cdddr int)) ;intersections 2 of objects
(setq ang1 (angle pt int1))
(setq ang2 (angle int1 end1))
cadking2k5 wrote:is there a way like (= ang1 ang2) but make it so it can be 0.05 degrees off
You could use the equal function with an appropriate tolerance, e.g.:
(equal ang1 ang2 (* 0.05 (/ pi 180.0)))
However, since radians are 2-pi periodic, be careful when the supplied angles are around 0.0; for example, if ang1 = 0.0 and ang2 = 6.282312642553589 these angles are 0.05 degrees apart, however, the above equal expression will return nil. For these cases it may be more appropriate to compare the cosine of the angles to a given tolerance.
Lee