home *** CD-ROM | disk | FTP | other *** search
/ Windows 95 v2.4 Fix / W95-v2.4fix.iso / ACADWIN / SUPPORT / DDUCSP.LSP < prev    next >
Encoding:
Lisp/Scheme  |  1995-02-08  |  8.0 KB  |  265 lines

  1. ; Next available MSG number is    8 
  2. ; MODULE_ID DDUCSP_LSP_
  3. ;;;
  4. ;;;    dducsp.lsp
  5. ;;;
  6. ;;;    Copyright (C) 1992, 1994 by Autodesk, Inc.
  7. ;;;
  8. ;;;    Permission to use, copy, modify, and distribute this software
  9. ;;;    for any purpose and without fee is hereby granted, provided
  10. ;;;    that the above copyright notice appears in all copies and
  11. ;;;    that both that copyright notice and the limited warranty and
  12. ;;;    restricted rights notice below appear in all supporting
  13. ;;;    documentation.
  14. ;;;
  15. ;;;    AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
  16. ;;;    AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
  17. ;;;    MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE.  AUTODESK, INC.
  18. ;;;    DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
  19. ;;;    UNINTERRUPTED OR ERROR FREE.
  20. ;;;
  21. ;;;    Use, duplication, or disclosure by the U.S. Government is subject to
  22. ;;;    restrictions set forth in FAR 52.227-19 (Commercial Computer
  23. ;;;    Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) 
  24. ;;;    (Rights in Technical Data and Computer Software), as applicable.
  25. ;;;
  26. ;;;.
  27. ;;;   C:DDUCSP - User Coordinate System presets dialogue.
  28. ;;;     
  29. ;;;              Uses DDUCSP.DCL for the dialogue definition.  The
  30. ;;;              slide images are in ACAD.SLB.
  31. ;;;
  32. ;;; ===========================================================================
  33. ;;; ===================== load-time error checking ============================
  34. ;;;
  35.  
  36.   (defun ai_abort (app msg)
  37.      (defun *error* (s)
  38.         (if old_error (setq *error* old_error))
  39.         (princ)
  40.      )
  41.      (if msg
  42.        (alert (strcat " Error en la aplicaci≤n: "
  43.                       app
  44.                       " \n\n  "
  45.                       msg
  46.                       "  \n"
  47.               )
  48.        )
  49.      )
  50.      (exit)
  51.   )
  52.  
  53. ;;; Check to see if AI_UTILS is loaded, If not, try to find it,
  54. ;;; and then try to load it.
  55. ;;;
  56. ;;; If it can't be found or it can't be loaded, then abort the
  57. ;;; loading of this file immediately, preserving the (autoload)
  58. ;;; stub function.
  59.  
  60.   (cond
  61.      (  (and ai_dcl (listp ai_dcl)))          ; it's already loaded.
  62.  
  63.      (  (not (findfile ;|MSG0|;"ai_utils.lsp"))                     ; find it
  64.         (ai_abort "DDUCSP"
  65.                   (strcat "Imposible localizar el archivo AI_UTILS.LSP."
  66.                           "\n Compruebe el directorio de soporte.")))
  67.  
  68.      (  (eq ;|MSG0|;"failed" (load "ai_utils" ;|MSG0|;"failed"))            ; load it
  69.         (ai_abort "DDUCSP" "Can't load file AI_UTILS.LSP"))
  70.   )
  71.  
  72.   (if (not (ai_acadapp))               ; defined in AI_UTILS.LSP
  73.       (ai_abort "DDUCSP" nil)         ; a Nil <msg> supresses
  74.   )                                    ; ai_abort's alert box dialog.
  75.  
  76. ;;; ==================== end load-time operations ===========================
  77.  
  78. (defun ai_ucsp_start ()
  79.   (foreach v0 '(;|MSG0|;"world" "left" "cview" "top" "front" 
  80.                 "bottom" "back" "right" "prev")
  81.     (start_image (strcat "ucsp_" v0))
  82.     (slide_image
  83.       0 0
  84.       (- (dimx_tile (strcat "ucsp_" v0)) 1) (- (dimy_tile (strcat "ucsp_" v0)) 1)
  85.       (strcat "acad(u-" v0 ")")
  86.     )
  87.     (end_image)
  88.   )
  89. )
  90.  
  91. (defun ai_ucsp_set ()
  92.   (if ai_ucsp_sv
  93.     (command "_.UCS" "_V")
  94.     (if ai_ucsp_prevs
  95.       (command "_.UCS" "_P")
  96.       (if ai_ucsp_chg
  97.         (progn
  98.           (if (/= ai_ucsp_a "*")
  99.             (setvar "LASTPOINT" (trans (getvar "UCSORG") 0 1))
  100.           )
  101.           (if (< ai_ucsp_pick 6)
  102.             (setq ai_ucsp_set0 "@")
  103.             (setq ai_ucsp_set0 "*0,0,0" ai_ucsp_a "*")
  104.           )
  105.           (cond ((= ai_ucsp_pick 0)
  106.                  (setq ai_ucsp_set1 "0,-1,0"
  107.                        ai_ucsp_set2 "0,0,1"
  108.                  )
  109.                 )
  110.                 ((= ai_ucsp_pick 2)
  111.                  (setq ai_ucsp_set1 "1,0,0"
  112.                        ai_ucsp_set2 "0,0,1"
  113.                  )
  114.                 )
  115.                 ((= ai_ucsp_pick 3)
  116.                  (setq ai_ucsp_set1 "1,0,0"
  117.                        ai_ucsp_set2 "0,-1,0"
  118.                  )
  119.                 )
  120.                 ((= ai_ucsp_pick 4)
  121.                  (setq ai_ucsp_set1 "-1,0,0"
  122.                        ai_ucsp_set2 "0,0,1"
  123.                  )
  124.                 )
  125.                 ((= ai_ucsp_pick 5)
  126.                  (setq ai_ucsp_set1 "0,1,0"
  127.                        ai_ucsp_set2 "0,0,1"
  128.                  )
  129.                 )
  130.                 (T
  131.                  (setq ai_ucsp_set1 "1,0,0"
  132.                        ai_ucsp_set2 "0,1,0"
  133.                  )
  134.                 )
  135.           )
  136.           (command "_.UCS" "_3P" ai_ucsp_set0 
  137.                    (strcat ai_ucsp_a ai_ucsp_set1) 
  138.                    (strcat ai_ucsp_a ai_ucsp_set2)
  139.           ) 
  140.         )
  141.       )
  142.     )
  143.   )
  144. )
  145.  
  146. (defun ai_ucsp_p (val currtile)
  147.   (mode_tile ai_ucsp_currtile 4)
  148.   (setq ai_ucsp_pick val
  149.         ai_ucsp_sv nil
  150.         ai_ucsp_currtile currtile
  151.   )
  152.   (if (/= val 1)
  153.     (setq ai_ucsp_chg T)
  154.   )
  155.   (mode_tile ai_ucsp_currtile 4)
  156. )
  157.  
  158. (defun ai_ucsp_swcs ()
  159.   (mode_tile ai_ucsp_currtile 4)
  160.   (set_tile ;|MSG0|;"ucsp_a_wcs" "1")
  161.   (setq ai_ucsp_pick 6
  162.         ai_ucsp_sv nil
  163.         ai_ucsp_currtile ;|MSG0|;"ucsp_world"
  164.   )
  165.   (if (/= 1 (getvar "WORLDUCS"))
  166.     (setq ai_ucsp_chg T)
  167.     (setq ai_ucsp_chg nil)
  168.   )
  169.   (mode_tile ai_ucsp_currtile 4)
  170. )
  171.  
  172. (defun ai_ucsp_cview ()
  173.   (mode_tile ai_ucsp_currtile 4)
  174.   (setq ai_ucsp_sv T 
  175.         ai_ucsp_chg nil
  176.         ai_ucsp_currtile ;|MSG0|;"ucsp_cview"
  177.   )
  178.   (set_tile ;|MSG0|;"ucsp_a_wcs" "1")
  179.   (mode_tile ai_ucsp_currtile 4)
  180. )
  181.  
  182. (defun ai_ucsp_rucs (typ)
  183.   (setq ai_ucsp_a typ)
  184.   (mode_tile ai_ucsp_currtile 2)
  185. )
  186.  
  187. (defun ai_ucsp_prev ()
  188.   (mode_tile ai_ucsp_currtile 4)
  189.   (setq ai_ucsp_prevs T
  190.         ai_ucsp_currtile ;|MSG0|;"ucsp_prev"
  191.   )
  192.   (mode_tile ai_ucsp_currtile 4)
  193. )
  194.  
  195. (defun ai_ucsp_main ( / ai_ucsp_pick ai_ucsp_sv globals)
  196.   (if (not (new_dialog ;|MSG0|;"dducsp" dcl_id))
  197.     (exit)
  198.   )
  199.  
  200.   (ai_ucsp_start)
  201.   (setq ai_ucsp_a "@" 
  202.         ai_ucsp_pick 2
  203.         ai_ucsp_currtile ;|MSG0|;"ucsp_top"
  204.   )
  205.   (if (= 1 (getvar "WORLDUCS"))
  206.     (progn
  207.       (set_tile ;|MSG0|;"ucsp_a_wcs" "1")
  208.       (setq ai_ucsp_currtile ;|MSG0|;"ucsp_world")
  209.     )
  210.     (set_tile ;|MSG0|;"ucsp_r_ucs" "1")
  211.   )
  212.   (mode_tile ai_ucsp_currtile 2)
  213.   (mode_tile ai_ucsp_currtile 4)
  214.   (action_tile ;|MSG0|;"ucsp_world" "(ai_ucsp_swcs)")
  215.   (action_tile ;|MSG0|;"ucsp_cview" "(ai_ucsp_cview)")
  216.   (action_tile ;|MSG0|;"ucsp_left" "(ai_ucsp_p 0 $key)")
  217.   (action_tile ;|MSG0|;"ucsp_top" "(ai_ucsp_p 1 $key)")
  218.   (action_tile ;|MSG0|;"ucsp_front" "(ai_ucsp_p 2 $key)")
  219.   (action_tile ;|MSG0|;"ucsp_bottom" "(ai_ucsp_p 3 $key)")
  220.   (action_tile ;|MSG0|;"ucsp_back" "(ai_ucsp_p 4 $key)")
  221.   (action_tile ;|MSG0|;"ucsp_right" "(ai_ucsp_p 5 $key)")
  222.   (action_tile ;|MSG0|;"ucsp_prev" "(ai_ucsp_prev)")
  223.   (action_tile ;|MSG0|;"ucsp_r_ucs" "(ai_ucsp_rucs \"@\")")
  224.   (action_tile ;|MSG0|;"ucsp_a_wcs" "(ai_ucsp_rucs \"*\")")
  225.   (action_tile ;|MSG0|;"accept" "(done_dialog 1)")
  226.   (action_tile ;|MSG0|;"cancel" "(done_dialog 0)")
  227.   (action_tile ;|MSG0|;"help" "(help \"\" \"DDUCSP\")")
  228.   (if (= (start_dialog) 1)
  229.     (ai_ucsp_set)
  230.   )
  231. )
  232.  
  233. (defun c:dducsp ( / app dcl_id old_cmd old_osmode ai_ucsp_prevs 
  234.                     ai_ucsp_sw undo_init)
  235.  
  236.   ;; Set up error function.
  237.   (setq old_cmd (getvar "CMDECHO")    ; save current setting of cmdecho
  238.         old_error  *error*            ; save current error function
  239.         *error* ai_error              ; new error function
  240.         old_osmode (getvar "OSMODE")  ; disable OSNAP for duration
  241.   )
  242.  
  243.   (setvar "CMDECHO" 0)
  244.   (setvar "OSMODE" 0)
  245.  
  246.   (cond
  247.      (  (not (ai_notrans)))                     ; transparent not OK
  248.      (  (not (ai_acadapp)))                     ; ACADAPP.EXP xloaded?
  249.      (  (not (setq dcl_id (ai_dcl ;|MSG0|;"dducsp"))))  ; is .DCL file loaded?
  250.      (T (ai_undo_push)
  251.         (ai_ucsp_main)
  252.         (ai_undo_pop)
  253.      )
  254.   )
  255.  
  256.   (setvar "OSMODE" old_osmode)
  257.   (setq *error* old_error) 
  258.   (setvar "cmdecho" old_cmd)
  259.  
  260.   (princ)
  261. )
  262.  
  263. (princ "  DDUCSP cargada.  ")
  264. (princ)
  265.