home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 13 / 13.iso / p / p024 / 6.img / SUPPORT4.LIB / DDPTYPE.LSP < prev    next >
Encoding:
Text File  |  1992-09-09  |  5.7 KB  |  213 lines

  1. ;;;   DDPTYPE.LSP
  2. ;;;   ¬⌐┼v (C) 1992  Autodesk ñ╜Ñq
  3. ;;;
  4. ;;;   Ñ╗│n┼ΘºK╢O¿╤▒z╢iªµÑ⌠ª≤Ñ╬│~╗▌¿D¬║½■¿⌐íB¡╫º∩ñ╬╡oªµ, ª²¼O░╚╜╨┐φ┤`ñU¡z
  5. ;;;   ¡∞½h :
  6. ;;;
  7. ;;;   1)  ñWªC¬║¬⌐┼v│qºi░╚╗▌ÑX▓{ªb¿Cñ@Ñ≈½■¿⌐∙╪íC
  8. ;;;   2)  ¼█├÷¬║╗í⌐·ñσÑ≤ñ]Ñ▓╢╖⌐·╕ⁿ¬⌐┼v│qºiñ╬Ñ╗╢╡│\Ñi│qºiíC
  9. ;;;
  10. ;;;   Ñ╗│n┼Θ╢╚┤ú¿╤º@¼░└│Ñ╬ñW¬║░╤ª╥, ª╙Ñ╝┴n⌐·⌐╬┴⌠ºtÑ⌠ª≤½O├╥; ╣∩⌐≤Ñ⌠ª≤»S«φ
  11. ;;;   Ñ╬│~ñº╛A║┘⌐╩, ÑHñ╬░╙╖~╛P░Γ⌐╥┴⌠ºtÑX¿π¬║½O├╥, ªbª╣ñ@╖ºñ⌐ÑHº_╗{íC
  12. ;;;
  13. ;;;
  14. ;;;   C:DDPTYPE - set point style and size dialogue for use with
  15. ;;;               the AutoCAD Release 12 Standard Menu.
  16. ;;;
  17. ;;;               Uses ddptype.dcl for the dialogue definition.  The
  18. ;;;               slide images are in acad.slb.
  19. ;;;
  20. ;;; ===========================================================================
  21. ;;; ===================== load-time error checking ============================
  22. ;;;
  23.  
  24.   (defun ai_abort (app msg)
  25.      (defun *error* (s)
  26.         (if old_error (setq *error* old_error))
  27.         (princ)
  28.      )
  29.      (if msg
  30.        (alert (strcat " └│Ñ╬╡{ªí┐∙╗~: "
  31.                       app
  32.                       " \n\n  "
  33.                       msg
  34.                       "  \n"
  35.               )
  36.        )
  37.      )
  38.      (exit)
  39.   )
  40.  
  41. ;;; Check to see if AI_UTILS is loaded, If not, try to find it,
  42. ;;; and then try to load it.
  43. ;;;
  44. ;;; If it can't be found or it can't be loaded, then abort the
  45. ;;; loading of this file immediately, preserving the (autoload)
  46. ;;; stub function.
  47.  
  48.   (cond
  49.      (  (and ai_dcl (listp ai_dcl)))          ; it's already loaded.
  50.  
  51.      (  (not (findfile "ai_utils.lsp"))                     ; find it
  52.         (ai_abort "DDPTYPE"
  53.                   (strcat "ºΣñú¿∞íuAI_UTILS.LSPív└╔«╫;"
  54.                           "\n  ╜╨└╦¼díusupportívÑ╪┐²íC")))
  55.  
  56.      (  (eq "failed" (load "ai_utils" "failed"))            ; load it
  57.         (ai_abort "DDPTYPE" "╡L¬k╕ⁿñJíuAI_UTILS.LSPív└╔«╫"))
  58.   )
  59.  
  60.   (if (not (ai_acadapp))               ; defined in AI_UTILS.LSP
  61.       (ai_abort "DDPTYPE" nil)         ; a Nil <msg> supresses
  62.   )                                    ; ai_abort's alert box dialog.
  63.  
  64. ;;; ==================== end load-time operations ===========================
  65.  
  66. (defun ai_ptype_start ( / pt1 pt2)
  67.   (setq ai_pts_lst '("0" "1" "2" "3" "4" "32" "33" "34" "35" "36"
  68.                      "64" "65" "66" "67" "68" "96" "97" "98" "99" "100")
  69.   )
  70.   (foreach pt0 ai_pts_lst
  71.     (setq pt1 (strcat "pdmode" pt0)
  72.           pt2 (getvar "PDMODE")
  73.     )
  74.     (start_image pt1)
  75.     (slide_image
  76.       0 0
  77.       (- (dimx_tile pt1) 1) (- (dimy_tile pt1) 1)
  78.       (strcat "acad(pt" pt0 ")")
  79.     )
  80.     (if (= pt2 (atoi pt0))
  81.       (mode_tile pt1 2)
  82.     )
  83.     (end_image)
  84.   )
  85. )
  86.  
  87. (defun ai_ptype_set ()
  88.   (ai_chk_pts nil)
  89.   (if ai_pts_do
  90.     (progn
  91.       (if ai_pts0
  92.         (setq ai_pts 0.0)
  93.         (if (= (get_tile "pdsize_r") "1")
  94.           (setq ai_pts (- 0.0 ai_pts))
  95.         )
  96.       )
  97.       (setvar "PDSIZE" ai_pts)
  98.       (setvar "PDMODE" (atoi (substr ai_ptmode 7 3)))
  99.       (done_dialog 1)
  100.     )
  101.   )
  102. )
  103.  
  104. (defun ai_chk_pts (pts0)
  105.   (cond ((or (= ai_pts nil)
  106.              (<= ai_pts 0.0)
  107.          )
  108.          (set_tile "error" "┐ΘñJ╡L«─íC")
  109.          (setq ai_pts_do nil)
  110.          (mode_tile "pdsize_value" 2)
  111.         )
  112.         (T
  113.          (set_tile "error" "")
  114.          (setq ai_pts_do T)
  115.          (if pts0
  116.            (setq ai_pts0 nil)
  117.          )
  118.         )
  119.   )
  120. )
  121.  
  122. (defun ai_pdsize_r ()
  123.   (setq ai_pt_do T ai_pts0 nil)
  124.   (set_tile "pdsize_label" "%")
  125. )
  126.  
  127. (defun ai_pdsize_a ()
  128.   (setq ai_pt_do T ai_pts0 nil)
  129.   (set_tile "pdsize_label" "Units")
  130. )
  131.  
  132. (defun do_help (cmd)
  133.   (if (= (type acad_helpdlg) 'EXSUBR)
  134.     (acad_helpdlg "acad.hlp" cmd)
  135.     (alert "ºΣñú¿∞íu¿DºU╣∩╕▄íví╨ xload acadapp íC")
  136.   )
  137.   (princ)
  138. )
  139.  
  140. (defun ai_ptype_main (/ globals)
  141.   (ai_ptype_start)
  142.   (mode_tile ai_ptmode 4)
  143.   (if (<= ai_pts 0.0)
  144.     (progn
  145.       (set_tile "pdsize_r" "1")
  146.       (set_tile "pdsize_label" "%")
  147.     )
  148.     (progn
  149.       (set_tile "pdsize_a" "1")
  150.       (set_tile "pdsize_label" "Units")
  151.     )
  152.   )
  153.   (set_tile "pdsize_value" (rtos (setq ai_pts (abs ai_pts))))
  154.   (foreach pd0 ai_pts_lst
  155.     (action_tile (strcat "pdmode" pd0)
  156.       "(mode_tile ai_ptmode 4)(setq ai_ptmode $key)(mode_tile ai_ptmode 4)"
  157.     )
  158.   )
  159.   (action_tile "pdsize_value" "(setq ai_pts (distof $value)) (ai_chk_pts T)")
  160.   (action_tile "pdsize_r" "(ai_pdsize_r)")
  161.   (action_tile "pdsize_a" "(ai_pdsize_a)")
  162.   (action_tile "accept" "(ai_ptype_set)")
  163.   (action_tile "help" "(do_help \"ddptype\")")
  164.   (start_dialog)
  165. )
  166.  
  167. (defun c:ddptype (/ app dcl_id old_cmd ai_pts_do ai_ptmode ai_pts
  168.                     ai_pts0 undo_init)
  169.  
  170.   ;; Set up error function.
  171.   (setq old_cmd (getvar "cmdecho")    ; save current setting of cmdecho
  172.         old_error  *error*            ; save current error function
  173.         *error* ai_error              ; new error function
  174.   )
  175.  
  176.   (setvar "cmdecho" 0)
  177.  
  178.   (cond
  179.      (  (not (ai_trans)))                        ; transparent OK
  180.      (  (not (ai_acadapp)))                      ; ACADAPP.EXP xloaded?
  181.      (  (not (setq dcl_id (ai_dcl "ddptype"))))  ; is .DCL file loaded?
  182.      (T
  183.         (if (/= 1 (logand (getvar "CMDACTIVE"))) (ai_undo_push))
  184.         (ddptype_main)
  185.         (if (/= 1 (logand (getvar "CMDACTIVE"))) (ai_undo_pop))
  186.      )                          ; proceed!
  187.   )
  188.  
  189.   (setq *error* old_error)
  190.   (setvar "cmdecho" old_cmd)
  191.   (princ)
  192. )
  193.  
  194. (defun ddptype_main()
  195.   (if (not (new_dialog "ddptype" dcl_id))
  196.     (exit)
  197.   )
  198.  
  199.   (setq ai_ptmode (strcat "pdmode" (itoa (getvar "PDMODE")))
  200.         ai_pts (getvar "PDSIZE")
  201.   )
  202.   (setvar "CMDECHO" 0)
  203.   (if (= ai_pts 0.0)
  204.     (setq ai_pts -5.0 ai_pts0 T)
  205.   )
  206.   (ai_ptype_main)
  207.  
  208.   (princ)
  209. )
  210.  
  211. (princ "  íuDDPTYPEívñw╕ⁿñJíC")
  212. (princ)
  213.