Author Topic: Greater Than is_NOT_equal_to  (Read 6639 times)

0 Members and 1 Guest are viewing this topic.

sinc

  • Guest
Greater Than is_NOT_equal_to
« Reply #15 on: August 01, 2004, 01:39:01 AM »
Actually, I don't really know what's going on.  Someone had said something about Autocad still running internally with 16-bits while Windows was at 32, or something or other.  It was all muddled.  I don't really know what's going on.  It's been so long since I've done much with PCs/Windows that I don't really know what the state of the internals is these days.  (I've been using mostly Suns and Macs for the last decade...)

I just had some background thoughts along the lines that there might be instances where, for example, things might work if the user entered "100" at the prompt, but not if the user entered "200/2", or something like that.  If I seemed to be saying something else, it was probably late-night rambling...  :)

But yeah, once you have a real, it shouldn't change.  It's just that, before you get it, you can't really be sure what it's going to be.  Therefore, it's unwise to write any code that makes assumptions like "if there's any rounding error, it's going to be in this direction, so if I call functions in this way, I avoid the error...".

sinc

  • Guest
Greater Than is_NOT_equal_to
« Reply #16 on: August 07, 2004, 12:03:48 PM »
Quote from: hendie
Quote from: sinc
Sounds like you want the user to be able to enter a number that should indicate a distance along an object, right?

spot on.
thanks for the info.I'll look into that. I'm also thinking of adding a default "endpoint" just to help eliminate that problem

I ran into the identical problem, and came up with the following routine that always works (I hope... :D ).  It returns nil if the distance is outside the "fuzz factor".

Code: [Select]
(setq *ZYZ:FUZZ* 0.00001) ; fuzz factor

(defun ZYZ:getPointAtDist (entName dist / pt d)
  (cond ((vlax-curve-getPointAtDist entName dist))
((setq d (vlax-curve-getDistAtParam
  entName
  (vlax-curve-getEndParam entName)
) ;_ vlax-curve-getDistAtParam
) ;_ setq
(cond ((equal dist 0 *ZYZ:FUZZ*) (vlax-curve-getStartPoint entName))
      ((equal dist d *ZYZ:FUZZ*) (vlax-curve-getEndPoint entName))
) ;_ cond
)
  ) ;_ cond
) ;_ defun

I've started using ZYZ as an informal namespace for my utility routines, because it's unlikely to be used by anything else (and it's my dog Zyzzyx's nickname).  Feel free to change/eliminate it as you desire.