I'm trying to get an avarage height between 2 z-values. However in the calculation part i get a 'error: bad function: "11.30"' error (height of first point in this case).
As far as i can tell my calculation part seems to be right, but it won't seem to accept the value.
(Defun c:zavg (/ punta puntb za zb tot avg)(setq punta (getpoint "\nKies het eerste punt"))(setq puntb (getpoint "\nKies het tweede punt"))(setq za (caddr (trans punta 1 0)) za (rtos za 2 2))(setq zb (caddr (trans puntb 1 0)) zb (rtos zb 2 2))(setq tot (+ za zb))(setq avg (/ tot 2))(princ avg))
(Defun c:zavg (/ punta puntb za zb tot avg)(setq punta (getpoint "\nKies het eerste punt:"))(setq puntb (getpoint "\nKies het tweede punt:\n"))(setq za (caddr (trans punta 1 0)))(setq zb (caddr (trans puntb 1 0)))(setq tot (+ za zb))(setq avg (/ tot 2))(acet-ui-status (strcat "Hoogte 1e punt: "(rtos za)"\nHoogte 2e punt: "(rtos zb)"\nDe gemiddelden hoogte is: " (rtos avg 2 2)) "Gemiddelde hoogte")(princ))
Hi,
You did convert the variables (za & zb) to strings then you are trying to sum the two values and that is the error message that the program indicating to.
Like others you used getpoint which is xyz and you want it as numbers so no Rtos, end result may need a rtos to make the (princ (strcat "average is " (rtos avg 2 2)))