Search the Community
Showing results for tags 'equations in lisp'.
-
ok, so there's not 5 strcats, but i thought the title was catchy. so i've been making this NEW autolisp based off one i made last week of other people's code i cobbled together and personalized. everything works EXCEPT the little equation i put in. here is the working code BEFORE i updated it: (defun c:ptdif (/ p p1 p2 p3 x y z x1 y1 z1 x2 y2 z2 mdl pdiff ptcoord textloc cs_from cs_to) (while ;start while (setq cs_from 1) (setq cs_to 0) (setq p (getpoint "\nCHOOSE MODEL")) (setq p2 (getpoint "\nCHOOSE SHOT")) (setq textloc (getpoint p "\nPLACE TEXT")) (setq p1 (trans p cs_from cs_to 0)) (setq p3 (trans p2 cs_from cs_to 0)) (setq x (rtos (car p1))) (setq y (rtos (cadr p1))) (setq z (rtos (caddr P1))) (setq x2 (rtos (car p3))) (setq y2 (rtos (cadr p3))) (setq z2 (rtos (caddr p3))) (setq ptcoord (strcat "Model: X = "x" Y = "y" Z = " z)) (setq mdl (strcat "Sokkia: X = "x2" Y = "y" Z = " z2)) (command p2) (command "_leader" p textloc "" ptcoord mdl "") (princ) ) ;end while ) now that works nice and neat. The envelope i'm trying to push it just to add one more string into the text box with the differences between "x and x2" and the y's and the z's. i'll show you what i tried that didn't work. i think i was pretty close. (defun c:ptdif ( / p p1 p2 p3 p4 x y z x1 y1 z1 x2 y2 z2 x3 y3 z3 mdl ptd ptcoord textloc cs_from cs_to) (while ;start while (setq cs_from 1) ; these two keep it in world coords (setq cs_to 0) (setq p (getpoint "\nCHOOSE MODEL")) ; all my get points and prompts (setq p2 (getpoint "\nCHOOSE SHOT")) (setq textloc (getpoint p "\nPLACE TEXT")) (setq p1 (trans p cs_from cs_to 0)) ; the compliment to keeping it in world coords (setq p3 (trans p2 cs_from cs_to 0)) (setq x (rtos (car p1))) ; breaks up x, y, and z from 1st getpoint (setq y (rtos (cadr p1))) (setq z (rtos (caddr P1))) (setq x2 (rtos (car p3))) ; breaks up x, y, and z from 2nd getpoint (setq y2 (rtos (cadr p3))) (setq z2 (rtos (caddr p3))) [b](setq x3 (- x x2)) (setq y3 (- y y2)) (setq z3 (- z z2))[/b] (setq ptcoord (strcat "Model: X = "x" Y = "y" Z = " z)) (setq mdl (strcat "Sokkia: X = "x2" Y = "y2" Z = "z2)) [b](setq ptd (strcat x3 y3 z3))[/b] (command p2) (command "_leader" p textloc "" ptcoord mdl ptd "") (princ) ) ;end while ) i've been googling my ass off and all my research says that my "equation" is correct, but i keep getting "error: bad argument type: numberp: "20.0212" " now if i got "nil" back, i would revise things, but that tells me it stops at the equation, right? sorry for my ignorance, i've just started doing this last week. any help would be REALLY awesome. thanks for read this at least.
- 5 replies
-
- help with lisp
- equations in lisp
-
(and 1 more)
Tagged with: