maybe small LISP interpretation bug ??

#1
Hello,
I found IntelliCAD an excellent solution for reusing my very very old collection of LISP routines. Now I found, that a very simple one didn't work correct:
I called it (mee), simply a shortcut for middle between two endpoints). The plan was, that you can type at every coordiante input just (mee), click to two endpoints end the (mee) returns the middle between these two endpoints.
It works fine with the PLINE command, but not with the MOVE command, so the return coordinate will not accepted at the second input for the MOVE command:

: move
Select entities to move:
Entities in set: 1 Select
entities to move:

Vector/<Base point>: (mee)

Enter first [end]point :
Enter second [end]point :
Vector/<Base point>: (63.5000 27.5000)
Displacement point: (mee)

Enter first [end]point :
Enter second [end]point :
Displacement point: ()
Displacement point:

I just add the code, its very short for (mee). Maybe somebody could check it again - in the past, it works fine with hte very old one ACAD R12 releases in DOS environment.

(PROMPT "\nLoading int. LISP-C. (MEE)......")
(defun mee ( / osstore p1 p2)
(setq osstore (getvar "OSMODE"))
(setvar "OSMODE" 1)
(setq p1 (getpoint "\nEnter first [end]point : "))
(setq p2 (getpoint P1 "\nEnter second [end]point : "))
(setvar "OSMODE" osstore)
; polar <pt> <angle in rad> <distance>
(polar p1 (angle p1 p2) (* 0.5 (distance p1 p2)) )
(list (+
(car p1)
(/ (- (car p2) (car p1)) 2.0 ) )
(+ (cadr p1) (/ (- (cadr p2) (cadr p1)) 2.0 ) )
)
)
(prompt "loaded. (KH. ABT 11/93)")(prin1)


best regards Karlheinz

#2
Hi Karl. I'm not sure exactly how you use this little program, but I think that it does work better if you eliminate the list expression after the polar expression. There may be a good reason to have both these expressions in the program, but they really do the same thing, except that the polar gives a three value result (including the Z value) and the list gives a two value result (X and Y only). This may lead to identifying the bug, if we can call it that. The "displacement point" prompt in the MOVE command apparently prefers a complete XYZ point definition, instead of just the XY. By the way, I am using Cadopia Intellicad V4, and I am presuming that the CMS version of the MOVE command is identical. I hope this helps.

#3
Not sure, but it's more complicated than mine..
(Defun HALF (/ a b)
(SETQ A (GETPOINT "\nFirst Point ")
B (GETPOINT A "\nOther Point "))
(POLAR A (ANGLE A B)(/ (DISTANCE A B) 2)))

It is loaded in Icad.lsp then called transparently mid-command any time required - !(half). I have it as a menu item to avoid typing it.

#4
Hello Cad_B, hello John:
Thanks for feedback - yes, it was the missing z value, yes, CAD_B, you are right, there is a redundant calculation - with either expanding the return list with the z value or simply staying at the polar calculation, it works fine!
John, your simple half is nearly equal to my "mee", except that I
stored the object snap mod and switch temporarily to the Object
snap mode "END" (I also generated a "MII", which snaps to the
middle inbetween two intersections)

Thanks for your feedback and have a nice day!

regards from Germany - Karlheinz