Anuncios

The Autodesk Community Forums has a new look. Read more about what's changed on the Community Announcements board.

Kent1Cooper
en respuesta a: Anonymous

My guess is that this happens only with lines that are horizontal  within your tolerance value.  Some [considering those drawn from left to right] are going to be just barely over  0, at angles such as 0.OOOOOOOOOOO371 radians, and some are going to be just barely under  2pi, at angles such as 6.283185307179426 radians [instead of 2pi to the same number of decimal places = 6.283185307179587].  Those just barely under are going to remain just barely under pi after your

  (rem (vla-get-angle vlaEnt...) pi)

functions, so the comparison to barely over 0 will fail.

 

I think you need some kind of  (or)  situation to cover that possibility.  EDIT:  There may be a more concise way, but this should do it [untested]:

 

 

;if angle is equal to reference, turn to color red
  (if
    (or
      (equal refangle comangle 1e-12); basic same-direction check
      (and ; straddling horizontal?
        (or (equal refangle 0 1e-12) (equal refangle pi 1e-12))
        (or (equal comangle 0 1e-12) (equal comangle pi 1e-12))
      ); and
    ); or
    (vlax-put-property vlaEntcom 'Color 1); then
    (vlax-put-property vlaEntcom 'Color 2); else
  ); if

 

Kent Cooper, AIA