(defun dtr (deg /) (* (/ deg 180.0) pi)) (setq piu (/ pi 2.0)) (setq pid (* pi 1.5)) (defun cm_inch (cm /) (/ cm 2.54) ) (setq Text_Size 0.5) (setvar "cmdecho" 1) (DEFUN c:learn () (setq p1 (getpoint "ENTER ORIGIN POINT")) (if (= P1 nil) (setq P1 '(30 0)) ) (setq Height 80.0) (SETQ f_0 (POLAR P1 (dtr 0.0) 10.0)) (SETQ f_0 (POLAR f_0 PIU (/ Height 8.0))) (SETQ f_1 (POLAR f_0 PID (/ Height 8.0))) (SETQ f_2 (POLAR f_1 PID (/ Height 8.0))) (SETQ f_3 (POLAR f_2 PID (/ Height 8.0))) (SETQ f_4 (POLAR f_3 PID (/ Height 8.0))) (SETQ f_5 (POLAR f_4 PID (/ Height 8.0))) (SETQ f_6 (POLAR f_5 PID (/ Height 8.0))) (SETQ f_7 (POLAR f_6 PID (/ Height 8.0))) (SETQ f_8 (POLAR f_7 PID (/ Height 8.0))) (COMMAND "TEXT" "J" "_BL" f_0 0.5 0 " f_0") (COMMAND "TEXT" "J" "_BL" f_1 0.5 0 " f_1") (COMMAND "TEXT" "J" "_BL" f_2 0.5 0 " f_2") (COMMAND "TEXT" "J" "_BL" f_3 0.5 0 " f_3") (COMMAND "TEXT" "J" "_BL" f_4 0.5 0 " f_4") (COMMAND "TEXT" "J" "_BL" f_5 0.5 0 " f_5") (COMMAND "TEXT" "J" "_BL" f_6 0.5 0 " f_6") (COMMAND "TEXT" "J" "_BL" f_7 0.5 0 " f_7") (COMMAND "TEXT" "J" "_BL" f_8 0.5 0 " f_8") (COMMAND "LINE" f_0 f_8 "") (COMMAND "LINE" f_0 "@-36,0.0" "") (COMMAND "LINE" f_1 "@-36,0.0" "") (COMMAND "LINE" f_2 "@-36,0.0" "") (COMMAND "LINE" f_3 "@-36,0.0" "") (COMMAND "LINE" f_4 "@-36,0.0" "") (COMMAND "LINE" f_5 "@-36,0.0" "") (COMMAND "LINE" f_6 "@-36,0.0" "") (COMMAND "LINE" f_7 "@-36,0.0" "") (COMMAND "LINE" f_8 "@-36,0.0" "") (command "zoom" "ALL") )
Solved! Go to Solution.
Solved by smaher12. Go to Solution.
Saying "something wrong" is not enough information. What is wrong? Does it not do anything? Does it do something different from what you expect? In what way should it be better? Etc.
In the meantime, a few of things I notice:
The (dtr) function is not needed if you use it only for (dtr 0.0) -- you don't need to bother with (dtr) but can just use 0.0 directly.
The (cm_inch) function does not appear to be used at all.
I would think you would want to turn command echoing off rather than on, i.e. (setvar "cmdecho" 0).
Hi,
Kent is right, "something wrong" is not enough information. Just a guess:Try setting OSMODE to 0 *Before* anything (setvar "osmode" 0).
Gaston Nunez
@Kent1Cooper wrote:
Saying "something wrong" is not enough information. What is wrong? Does it not do anything? Does it do something different from what you expect? In what way should it be better? Etc.
In the meantime, a few of things I notice:
The (dtr) function is not needed if you use it only for (dtr 0.0) -- you don't need to bother with (dtr) but can just use 0.0 directly.
The (cm_inch) function does not appear to be used at all.
I would think you would want to turn command echoing off rather than on, i.e. (setvar "cmdecho" 0).
In addition, you're turning of cmdecho OUTSIDE of the lisp routine (that line of code will only run when you initially load the file). Turn it OFF at the beginning of the routine and then back on at the end of the routine.
Don Ireland
Engineering Design Technician
I saw one other thing to note.
(SETQ f_0 (POLAR P1 (dtr 0.0) 10.0)) (SETQ f_0 (POLAR f_0 PIU (/ Height 8.0))) ; <-- all the other lines spec a PID variable. But this one is PIU. (SETQ f_1 (POLAR f_0 PID (/ Height 8.0))) (SETQ f_2 (POLAR f_1 PID (/ Height 8.0))) (SETQ f_3 (POLAR f_2 PID (/ Height 8.0))) (SETQ f_4 (POLAR f_3 PID (/ Height 8.0))) (SETQ f_5 (POLAR f_4 PID (/ Height 8.0))) (SETQ f_6 (POLAR f_5 PID (/ Height 8.0))) (SETQ f_7 (POLAR f_6 PID (/ Height 8.0))) (SETQ f_8 (POLAR f_7 PID (/ Height 8.0)))
Don Ireland
Engineering Design Technician
If you want a short version...
(defun c:test (/ p1 p2 p3 cnt p4) (setvar 'cmdecho 0) (setq p1 (getpoint "\nSpecify origin point" ) p2 (polar p1 (/ pi 2) 64) ); setq (command "_.line" "_none" p2 "_none" p1 "_none" (polar p1 pi 36) "" "_.text" "bl" "_none" p1 0.5 0 " f_0" ) (setq p3 p1) (setq cnt 1) (while (< 7 (distance p3 p2)) (setq p4 (polar p3 (/ pi 2) 8)) (command "_.line" "_none" p4 "_none" (polar p4 pi 36) "" "_.text" "bl" "_none" p4 0.5 0 (strcat " f_" (rtos cnt 2 0)) ) (setq p3 p4) (setq cnt (1+ cnt)) ); while (princ) )