TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: hunterxyz on March 11, 2008, 09:42:10 AM
-
I in calculate two point angles,
angle return to 0.0,
but angle return to 3.77208e-015,
how should solve this problem ?
Whether has the formula computation ?
Please help to explain,Thank you.
(SETQ ename (CAR (ENTSEL "\n SELECT OBJECT:")))
(SETQ n (1+ (FIX (VLAX-CURVE-GETENDPARAM ename)))
i -1 ) ;_ setq
(REPEAT n
(SETQ ptl (CONS (VLAX-CURVE-GETPOINTATPARAM ename (SETQ i (1+ i))) ptl)) ;_ 結束
setq
) ;_ repeat
(REVERSE ptl)
(SETQ LST#PT (APPEND ptl (LIST (NTH 0 ptl))))
(SETQ LST#AG NIL)
(SETQ I -1)
(REPEAT (LENGTH ptl)
(SETQ I (1+ I))
(SETQ LST#AG (APPEND LST#AG
(LIST (ANGLE (NTH I LST#PT) (NTH (1+ I) LST#PT)))
)) ;_ SETQ
) ;_ REPEAT
[\code]
-
Try this:
(LIST
(if (equal 0. (setq ang (ANGLE (NTH I LST#PT) (NTH (1+ I) LST#PT))) 0.00001)
(setq ang 0.0)
ang
)
)