home *** CD-ROM | disk | FTP | other *** search
/ Black Box 4 / BlackBox.cdr / autocad / acadtut.arj / LESS2.EXE / TEST2.LSP < prev   
Encoding:
Lisp/Scheme  |  1990-05-02  |  8.5 KB  |  254 lines

  1. ;lesson2 lisp routine to check answers to CAD lesson #2
  2.  
  3. (defun C:ANSWERS (/ set1 n na text blk an1 )
  4. (setq set1 (ssget '(2 5.6)))
  5. (if (= set1 nil)(command "insert" "bad" "8.08,6.5" "" "" "")(progn
  6. (setq n (sslength set1))
  7. (setq na (ssname set1 0))
  8. (setq text (cddr (entget na)))
  9. (setq blk (cdr (cadr(tblsearch "block" "square"))))
  10. (setq AN1 (strcase (cdr (assoc 2 text))))
  11. (IF (= blk an1)
  12.            (command "insert" "ok" "8.08,6.5" "" "" "");then
  13.            (command "insert" "bad" "8.08,6.5" "" "" ""))));else
  14. (redraw)
  15. (Q2)
  16. )
  17. (defun q2 ()
  18. (prompt "\nPLEASE READ QUESTION #2 BEFORE ANSWERING")
  19. (setq ans2 (strcase(getstring "\nENTER YOUR ANSWER TO QUESTION #2" )))
  20. (if (or(= ans2 "1")
  21.        (= ans2 "ONE") 
  22.     )
  23.     (PROGN(command "text" "1,4.5" "" ans2 )
  24.           (command "insert" "ok" "8.08,6" "" "" ""))   
  25.            (PROGN(command "text" "1,4.5" "" ans2 )
  26.            (command "insert" "bad" "8.08,6" "" "" "")))
  27. (REDRAW)
  28. (Q3)
  29. );end defunQ2
  30.  
  31. (defun q3 ()
  32. (prompt "\nPLEASE READ QUESTION #3 BEFORE ANSWERING")
  33. (setq ans3 (strcase(getstring "\nENTER YOUR ANSWER TO QUESTION #3 <T/F>")))
  34. (if (= ans3 "F") (PROGN(command "text" "1,4" "" "F" )
  35.           (command "insert" "ok" "8.08,5.5" "" "" ""))   
  36.            (PROGN(command "text" "1,4" "" "T" )
  37.            (command "insert" "bad" "8.08,5.5" "" "" "")))
  38. (REDRAW)
  39. (PROMPT "\nPLEASE COMPLETE TASK IN QUESTION #4")
  40. (PROMPT "\nTHEN TYPE <CONT4> WHEN INSTRUCTED TO DO SO IN THE INSTRUCTIONS")
  41. );end defunQ3
  42.  
  43. (defun C:CONT4 ()
  44. (prompt "\nPLEASE READ QUESTION #4 BEFORE ANSWERING")
  45. (setq ans4 (strcase(getstring "\nENTER YOUR ANSWER TO QUESTION #4 <T/F>")))
  46. (if (= ans4 "F") (PROGN(command "text" "1,2.5" "" "F" )
  47.           (command "insert" "right" "8.08,5" "" "" ""))   
  48.            (PROGN(command "text" "1,2.5" "" "T" )
  49.            (command "insert" "wrong" "8.08,5" "" "" "")))
  50. (REDRAW)
  51. (PROMPT "\nPLEASE COMPLETE TASK IN QUESTION #5")
  52. (PROMPT "\nTHEN TYPE <CONT5> WHEN INSTRUCTED TO DO SO IN THE INSTRUCTIONS")
  53. );end defunQ4
  54.  
  55.  
  56. (defun C:CONT5 ()
  57. (prompt "\nPLEASE READ QUESTION #5 BEFORE ANSWERING")
  58. (setq ans5 (strcase(getstring "\nENTER YOUR ANSWER TO QUESTION #5 <T/F>")))
  59. (if (= ans5 "T") (PROGN(command "text" "4.84,5" "" "T" )
  60.           (command "insert" "ok" "8.08,4.5" "" "" ""))   
  61.            (PROGN(command "text" "4.84,5" "" "F" )
  62.            (command "insert" "bad" "8.08,4.5" "" "" "")))
  63. (REDRAW)
  64. (q6)
  65. );end defunQ5
  66.  
  67. (defun q6 ()
  68. (prompt "\nPLEASE READ QUESTION #6 BEFORE ANSWERING")
  69. (setq ans6 (strcase(getstring "\nENTER YOUR ANSWER TO QUESTION #6 ")))
  70. (if (= ans6 "C") (PROGN(command "text" "4.8,4.3" "" ans6 )
  71.           (command "insert" "ok" "8.08,4" "" "" ""))   
  72.            (PROGN(command "text" "4.8,4.3" "" ans6 )
  73.            (command "insert" "bad" "8.08,4" "" "" "")))
  74. (REDRAW)
  75. (q7)
  76. );end defun6
  77.  
  78. (defun q7 ()
  79. (prompt "\nPLEASE READ QUESTION #7 BEFORE ANSWERING")
  80. (setq ans7 (strcase(getstring "\nENTER YOUR ANSWER TO QUESTION #7 <T/F>")))
  81. (if (= ans7 "T") (PROGN(command "text" "4.84,3.5" "" "T" )
  82.           (command "insert" "ok" "8.08,3.5" "" "" ""))   
  83.            (PROGN(command "text" "4.84,3.5" "" "F" )
  84.            (command "insert" "bad" "8.08,3.5" "" "" "")))
  85. (REDRAW)
  86. (PROMPT "\nPLEASE COMPLETE TASK IN QUESTION #8")
  87. (PROMPT "\nTHEN TYPE <CONT9> WHEN INSTRUCTED TO DO SO IN THE INSTRUCTIONS")
  88. );end defunQ7
  89.  
  90. (defun c:cont9 ()
  91. (prompt "\nPLEASE READ QUESTION #9 BEFORE ANSWERING")
  92. (setq ans11 (strcase(getstring "\nENTER YOUR ANSWER TO QUESTION #9" )))
  93. (if (OR (= ans11 "A")
  94.         (= ans11 "B")
  95.         (= ans11 "C")
  96.     )    
  97. (command "insert" "closing" "5.23,1.47" "" "" ""))   
  98. (REDRAW)
  99. (command "end" )
  100. );end defun9
  101. ;______________________________________________________
  102.  
  103. (defun an2 ()
  104. ;first answer
  105. (defun a1 (/ seta n na tp tp1 mtl1)
  106. (setq seta (ssget '(1 6)))
  107. (setq n (sslength seta))
  108. (setq na (ssname seta 0))
  109. (setq tp (car(cdr(entget na))));next three lines check for no answer
  110. (setq tp1(cdr tp))
  111. (if (= tp1 "LINE") 
  112. (command "insert" "bad" "8.08,6" "" "" "");then
  113. (progn(setq text (cddr (entget na)));else
  114.       (setq mtl1 (list (strcase (cdr (assoc 1 text)))))
  115.       (if (or(= (car mtl1) "ABSOLUTE")
  116.              (= (car mtl1) "POLAR")
  117.              (= (car mtl1) "RELATIVE")
  118.             )
  119.           (command "insert" "ok" "8.08,6" "" "" "")   
  120.            (command "insert" "bad" "8.08,6" "" "" ""));else
  121.       ))
  122. )
  123. ;next answer
  124. (defun a2 (/ setb n na tp tp1)
  125. (setq setb (ssget '(1 5.8)))
  126. (setq n (sslength setb))
  127. (setq na (ssname setb 0))
  128. (setq tp (car(cdr(entget na))));next three lines check for no answer
  129. (setq tp1(cdr tp))
  130. (if (= tp1 "LINE") 
  131. (command "insert" "bad" "8.65,6" "" "" "");then
  132. (progn(setq text (cddr (entget na)));else
  133.       (setq mtl2 (list (strcase (cdr (assoc 1 text)))))
  134.       (if (or(= (car mtl2) "ABSOLUTE")
  135.              (= (car mtl2) "POLAR")
  136.              (= (car mtl2) "RELATIVE")
  137.             )
  138.           (command "insert" "ok" "8.65,6" "" "" "")   
  139.            (command "insert" "bad" "8.65,6" "" "" ""));else
  140.       ))
  141. )
  142. ; last answer
  143. (defun a3 (/ setc n na tp tp1)
  144. (setq setc (ssget '(1 5.6)))
  145. (setq n (sslength setc))
  146. (setq na (ssname setc 0))
  147. (setq tp (car(cdr(entget na))));next three lines check for no answer
  148. (setq tp1(cdr tp))
  149. (if (= tp1 "LINE") 
  150. (command "insert" "bad" "9.2,6" "" "" "");then
  151. (progn(setq text (cddr (entget na)));else
  152.       (setq mtl3 (list (strcase (cdr (assoc 1 text)))))
  153.       (if (or(= (car mtl3) "ABSOLUTE")
  154.              (= (car mtl3) "POLAR")
  155.              (= (car mtl3) "RELATIVE")
  156.             )
  157.           (command "insert" "ok" "9.2,6" "" "" "")   
  158.            (command "insert" "bad" "9.2,6" "" "" ""));else
  159.       ))
  160. )
  161. (a1)
  162. (a2)
  163. (a3)
  164. (REDRAW)
  165. (Q3)
  166. )             
  167.  
  168. (defun TQ3 ()
  169. (setq ans3 (strcase(getstring "\nENTER YOUR ANSWER TO QUESTION #3 <T/F>")))
  170. (if (= ans3 "T") (PROGN(command "text" "1,4.5" "" "T" )
  171.           (command "insert" "ok" "8.08,5.5" "" "" ""))   
  172.            (PROGN(command "text" "1,4.5" "" "F" )
  173.            (command "insert" "bad" "8.08,5.5" "" "" "")))
  174. (REDRAW)
  175. (q4)
  176. );end defun3
  177.  
  178. (defun Tq4 ()
  179. (prompt "\nPLEASE READ QUESTION #4 BEFORE ANSWERING")
  180. (setq ans4 (strcase(getstring "\nENTER YOUR ANSWER TO QUESTION #4 <T/F>")))
  181. (if (= ans4 "T") (PROGN(command "text" "1,4" "" "T" )
  182.           (command "insert" "ok" "8.08,5" "" "" ""))   
  183.            (PROGN(command "text" "1,4" "" "F" )
  184.            (command "insert" "bad" "8.08,5" "" "" "")))
  185. (REDRAW)
  186. (q5)
  187. );end defun4
  188.  
  189. (defun Tq5 ()
  190. (prompt "\nPLEASE READ QUESTION #5 BEFORE ANSWERING")
  191. (setq ans5 (strcase(getstring "\nENTER YOUR ANSWER TO QUESTION #5" )))
  192. (if (= ans5 "LAYER") (PROGN(command "text" "1,3.5" "" ans5 )
  193.           (command "insert" "ok" "8.08,4.5" "" "" ""))   
  194.            (PROGN(command "text" "1,3.5" "" ans5 )
  195.            (command "insert" "bad" "8.08,4.5" "" "" "")))
  196. (REDRAW)
  197. (q6)
  198. );end defun5
  199.  
  200. (defun tq6 ()
  201. (prompt "\nPLEASE READ QUESTION #6 BEFORE ANSWERING")
  202. (setq ans6 (strcase(getstring "\nENTER YOUR ANSWER TO QUESTION #6 <T/F>")))
  203. (if (= ans6 "F") (PROGN(command "text" "4.8,6" "" "F" )
  204.           (command "insert" "ok" "8.08,4" "" "" ""))   
  205.            (PROGN(command "text" "4.8,6" "" "T" )
  206.            (command "insert" "bad" "8.08,4" "" "" "")))
  207. (REDRAW)
  208. (q7)
  209. );end defun6
  210.  
  211.  
  212.  
  213. (defun q8 ()
  214. (prompt "\nPLEASE READ QUESTION #8 BEFORE ANSWERING")
  215. (setq ans8 (strcase(getstring "\nENTER YOUR ANSWER TO QUESTION #8 <T/F>")))
  216. (if (= ans8 "F") (PROGN(command "text" "4.8,4.5" "" "F" )
  217.           (command "insert" "ok" "8.08,3" "" "" ""))   
  218.            (PROGN(command "text" "4.8,4.5" "" "T" )
  219.            (command "insert" "bad" "8.08,3" "" "" "")))
  220. (REDRAW)
  221. (q9)
  222. );end defun8
  223.  
  224. (defun q9 ()
  225. (prompt "\nPLEASE READ QUESTION #9 BEFORE ANSWERING")
  226. (setq ans9 (strcase(getstring "\nENTER YOUR ANSWER TO QUESTION #9" )))
  227. (if (= ans9 "B") (PROGN(command "text" "4.8,3.9" "" ans9 )
  228.           (command "insert" "ok" "8.08,2.5" "" "" ""))   
  229.            (PROGN(command "text" "4.8,3.9" "" ans9 )
  230.            (command "insert" "bad" "8.08,2.5" "" "" "")))
  231. (REDRAW)
  232. (q10)
  233. );end defun9
  234.  
  235. (defun q10 ()
  236. (prompt "\nPLEASE READ QUESTION #10 BEFORE ANSWERING")
  237. (setq ans10 (strcase(getstring "\nENTER YOUR ANSWER TO QUESTION #10 <T/F>")))
  238. (if (= ans10 "F") (PROGN(command "text" "4.8,3.1" "" "F" )
  239.           (command "insert" "ok" "8.08,2" "" "" ""))   
  240.            (PROGN(command "text" "4.8,3.1" "" "T" )
  241.            (command "insert" "bad" "8.08,2" "" "" "")))
  242. (REDRAW)
  243. (Q11)
  244. );end defun10
  245.  
  246.  
  247.  
  248. (defun c:ldl ()
  249. (load"lesson2")
  250. )
  251. (defun c:el ()
  252. (command "blue" "lesson2.lsp" )
  253. )
  254.