I ended up using
(while (> Dist (vlax-curve-getdistatparam Pobj (vlax-curve-getendparam Pobj)))
(initget 5)
(setq Dist (getreal "\nPlease enter distance))
)
which seemed to solve my problem.
Ah hah, I think I finally understand what you're asking! That bit of code did it.
Sounds like you want the user to be able to enter a number that should indicate a distance along an object, right? Therefore, you're checking to see if the number indicated is a valid point on the object. Is this right?
If so, you still might run into the problem from time to time the way you're doing it, just much less frequently. The culprit is still the rounding error, it's just been obscured.
You might try:
(if (vlax-curve-paramAtDist Pobj Dist)
(princ "Got a point on the item!")
)
This is more straightforward than the way you're doing things, and (depending on how Autocad did the implementation) may even take a built-in fuzz-factor into account for you (at least enough to account for the 16/32 bit rounding problem that exists between Autocad and Windows). Probably not, but it should work at least as well as your getEndParam version (both versions do pretty much the same exact thing), except in a more direct and readable form.
If you still have problems, then the correct way of going about your task so that you're SURE you'll never have a problem is something along these lines:
(setq
*FUZZ* .00001
objLen (vla-get-length obj)
) ;_ setq
(while
(progn
(setq dist (getreal "\nPlease enter distance: "))
(and (> dist objLen)
(not (equal dist objLen *FUZZ*))
) ;_ and
) ;_ progn
) ;_ while
Keep in mind that you have to use (equal) and a fuzz factor EVERY time you check lengths... It's a pain, I know, but it's the only way to GUARANTEE that you'll never have a problem.
Note that, whenever possible, it's better to use vla-get-length because its intent is clearer to others than something like (distAtParam obj (endParam obj)).