home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 13 / 13.iso / p / p024 / 15.img / AME2.LIB / DDSOLPRM.LSP < prev    next >
Encoding:
Text File  |  1992-08-27  |  8.2 KB  |  317 lines

  1. ;;;   DDSOLPRM.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. ;;;   ¬⌐Ñ╗ 0.1               9 April 1992
  15. ;;;
  16. ;;;----------------------------------------------------------------------------;
  17. ;;;
  18. ;;;   DDSOLPRM.lsp is a dialogue box for AME 2.1.
  19. ;;;
  20. ;;;   It allows the creation of  AME primitives by picking an icon of
  21. ;;;   a box, cylinder, sphere, torus, wedge or cone. A single click
  22. ;;;   on the icon sets focus to it and the command is activated by
  23. ;;;   clicking on OK. A double click on the icon will also activate
  24. ;;;   the command.
  25. ;;;
  26. ;;;   The baseplane mode for creation of the primitive can also be set
  27. ;;;   from this dialogue box. This mode can be enabled or disabled via a
  28. ;;;   pair of radio buttons. The mode will grey out if turned off. This
  29. ;;;   is the default. When activated, the mode will ungrey and a baseplane
  30. ;;;   mode may be selected. The default mode is 3 points.
  31. ;;;
  32. ;;;   The running osnap dialogue box  can also be called and set from
  33. ;;;   this dialogue box. A help function for ddsolprm is also available.
  34. ;;;----------------------------------------------------------------------------;
  35.  
  36. ;;; ===================== load-time error checking ============================
  37. ;;;
  38.  
  39.   (defun ai_abort (app msg)
  40.      (defun *error* (s)
  41.         (if old_error (setq *error* old_error))
  42.         (princ)
  43.      )
  44.      (if msg
  45.        (alert (strcat " └│Ñ╬╡{ªí┐∙╗~: "
  46.                       app
  47.                       " \n\n  "
  48.                       msg
  49.                       "  \n"
  50.               )
  51.        )
  52.      )
  53.      (exit)
  54.   )
  55.  
  56. ;;; Check to see if AI_UTILS is loaded, If not, try to find it,
  57. ;;; and then try to load it.
  58. ;;;
  59. ;;; If it can't be found or it can't be loaded, then abort the
  60. ;;; loading of this file immediately, preserving the (autoload)
  61. ;;; stub function.
  62.  
  63.   (cond
  64.      (  (and ai_dcl (listp ai_dcl)))          ; it's already loaded.
  65.  
  66.      (  (not (findfile "ai_utils.lsp"))                     ; find it
  67.         (ai_abort "DDUCSP"
  68.                   (strcat "ºΣñú¿∞íuAI_UTILS.LSPív└╔«╫;"
  69.                           "\n └╦¼díusupportívÑ╪┐²íC")))
  70.  
  71.      (  (eq "failed" (load "ai_utils" "failed"))            ; load it
  72.         (ai_abort "DDUCSP" "╡L¬k╕ⁿñJíuAI_UTILS.LSPív└╔«╫"))
  73.   )
  74.  
  75.   (if (not (ai_acadapp))               ; defined in AI_UTILS.LSP
  76.       (ai_abort "DDUCSP" nil)         ; a Nil <msg> supresses
  77.   )                                    ; ai_abort's alert box dialog.
  78.  
  79. ;;; ==================== end load-time operations ===========================
  80.  
  81.  
  82. (defun do_help (cmd)
  83.     (if (= (type acad_helpdlg) 'EXSUBR)
  84.       (acad_helpdlg "acad.hlp" cmd)
  85.       (alert "ºΣñú¿∞íu¿DºU╣∩╕▄ív - xload acadapp íC")
  86.     )
  87.     (princ)
  88. )
  89.  
  90. (defun hi_lite (tile)
  91.  
  92.      (if (/= last_pic tile)
  93.        (progn
  94.          (mode_tile tile 4)
  95.          (if (/= nil last_pic)
  96.             (mode_tile last_pic 4)
  97.          )
  98.        )
  99.      )
  100.  
  101.     (setq last_pic tile)
  102. )
  103.  
  104. (defun start ( / bmods)
  105.  
  106.    ;initialize the list for baseplane modes
  107.     (setq bmods
  108.      (list "3 Points" "Entity" "Last" "Zaxis"
  109.             "View" "XY Plane" "YZ Plane" "ZX Plane")
  110.     )
  111.  
  112.     (start_list "bmode")
  113.     (mapcar 'add_list bmods)
  114.     (end_list)
  115.  
  116.     ;Set tile to value in bm (0 or 1) if not nil
  117.     (if (/= nil bm)
  118.       (cond
  119.          ((= bm 1)
  120.             (set_tile "bspln_on" "1")
  121.             (set_tile "bspln_off" "0")
  122.          )
  123.          ((= bm 0)
  124.             (set_tile "bspln_on" "0")
  125.             (set_tile "bspln_off" "1")
  126.          )
  127.       )
  128.     )
  129.  
  130.    ;Set bmode to what bspln_on tile is set. Grey or ungrey.
  131.     (if (= 1 (atoi (get_tile "bspln_on")))
  132.       (mode_tile "bmode" 0)
  133.       (mode_tile "bmode" 1)
  134.     )
  135.  
  136.    (if (/= nil index)
  137.     (set_tile "bmode" (itoa index))
  138.     (setq index (atoi (get_tile "bmode")))
  139.    )
  140.  
  141.    ;initialize all the icons for icon buttons
  142.    (foreach prim '("Boxpic" "Conepic" "Spherpic" "Cylpic"
  143.                     "Wedgepic" "Torpic")
  144.       (start_image prim)
  145.       (slide_image
  146.         0 0
  147.         (dimx_tile prim)(dimy_tile prim)
  148.         (strcat "acad(" prim ")")
  149.  
  150.       )
  151.       (end_image)
  152.    )
  153. )
  154.  
  155. ;Grey out popdown selection, if baseplane is turned off.
  156. (defun bm_off()
  157.    (setq bm (atoi (get_tile "bspln_on")))
  158.    (if (= 1 bm)
  159.       (progn (mode_tile "bmode" 0) (bmode))
  160.       (mode_tile "bmode" 1)
  161.    )
  162.  
  163. )
  164.  
  165. ;Retrieve the index number of selection and set bmod to
  166. ;appropriate string
  167.  
  168. (defun bmode()
  169.    (setq index (atoi (get_tile "bmode")))
  170.    (cond
  171.       ((= 0 index)
  172.          (setq bmod "3")
  173.       )
  174.       ((= 1 index)
  175.          (setq bmod "e")
  176.       )
  177.       ((= 2 index)
  178.          (setq bmod "l")
  179.       )
  180.       ((= 3 index)
  181.          (setq bmod "z")
  182.       )
  183.       ((= 4 index)
  184.          (setq bmod "v")
  185.       )
  186.       ((= 5 index)
  187.          (setq bmod "xy")
  188.       )
  189.       ((= 6 index)
  190.          (setq bmod "yz")
  191.       )
  192.       ((= 7 index)
  193.          (setq bmod "zx")
  194.       )
  195.    )
  196. )
  197.  
  198. ;This is the main function that calls up the dialog
  199. (defun c:ddsolprm (/ ce dcl_id stat old_index old_bm tile last_pic)
  200.  
  201.    ;; Set up error function.
  202.    (setq old_cmd (getvar "CMDECHO")   ; save current setting of cmdecho
  203.         old_error  *error*            ; save current error function
  204.         *error* ai_error              ; new error function
  205.  
  206.    )
  207.  
  208.    (setvar "cmdecho" 0)
  209.    (setq old_index index)
  210.    (setq old_bm bm)
  211.  
  212.    (setq dcl_id (load_dialog "ame.dcl"))
  213.  
  214.    (if (not (new_dialog "ddsolprm" dcl_id))
  215.        (exit)
  216.    )
  217.  
  218.    (start)
  219.  
  220.    (setq stat 0)
  221.  
  222.    (action_tile "Boxpic" "(hi_lite \"Boxpic\")(setq stat 2)")
  223.    (action_tile "Conepic" "(hi_lite \"Conepic\")(setq stat 3)")
  224.    (action_tile "Spherpic" "(hi_lite \"Spherpic\")(setq stat 4)")
  225.    (action_tile "Cylpic" "(hi_lite \"Cylpic\")(setq stat 5)")
  226.    (action_tile "Wedgepic" "(hi_lite \"Wedgepic\")(setq stat 6)")
  227.    (action_tile "Torpic" "(hi_lite \"Torpic\")(setq stat 7)")
  228.  
  229.    (action_tile "bspln_on" "(bm_off)")
  230.    (action_tile "bspln_off" "(bm_off)")
  231.    (action_tile "bmode" "(bmode)")
  232.  
  233.    (action_tile "snapmd" "(c:ddosnap)")
  234.  
  235.    (action_tile "accept" "(done_dialog stat)")
  236.    (action_tile "cancel" "(setq index old_index)(setq bm old_bm)")
  237.    (action_tile "help" "(do_help \"ddsolprm\")")
  238.    (setq what_next (start_dialog))
  239.    (cond
  240.       ((= what_next 2)
  241.         (if (/= 1 bm)
  242.           (c:solbox)
  243.           (progn
  244.              (if (not solbox)
  245.                  (_autoxload "ame")
  246.              )
  247.            (solbox "b" bmod "*╣∩╜═ªí...*")
  248.           )
  249.         )
  250.       )
  251.       ((= what_next 3)
  252.         (if (/= 1 bm)
  253.           (c:solcone)
  254.           (progn
  255.              (if (not solbox)
  256.                  (_autoxload "ame")
  257.              )
  258.            (solcone "b" bmod "*╣∩╜═ªí...*")
  259.           )
  260.         )
  261.       )
  262.       ((= what_next 4)
  263.         (if (/= 1 bm)
  264.          (c:solsphere)
  265.            (progn
  266.              (if (not solbox)
  267.                  (_autoxload "ame")
  268.              )
  269.  
  270.            (solsphere "b" bmod "*╣∩╜═ªí...*")
  271.           )
  272.         )
  273.       )
  274.       ((= what_next 5)
  275.         (if (/= 1 bm)
  276.          (c:solcyl)
  277.            (progn
  278.              (if (not solbox)
  279.                  (_autoxload "ame")
  280.              )
  281.            (solcyl "b" bmod "*╣∩╜═ªí...*")
  282.           )
  283.         )
  284.       )
  285.       ((= what_next 6)
  286.         (if (/= 1 bm)
  287.          (c:solwedge)
  288.            (progn
  289.              (if (not solbox)
  290.                  (_autoxload "ame")
  291.              )
  292.            (solwedge "b" bmod "*╣∩╜═ªí...*")
  293.           )
  294.         )
  295.       )
  296.       ((= what_next 7)
  297.         (if (/= 1 bm)
  298.          (c:soltorus)
  299.            (progn
  300.              (if (not solbox)
  301.                  (_autoxload "ame")
  302.              )
  303.            (soltorus "b" bmod "*╣∩╜═ªí...*")
  304.           )
  305.         )
  306.       )
  307.    )
  308.  
  309.    (unload_dialog dcl_id)
  310.    (setvar "cmdecho" old_cmd)
  311.    (setq *error* old_error)
  312.    (princ)
  313. )
  314.  
  315. (princ "\nC:DDSOLPRM ñw╕ⁿñJ; ÑHíuDDSOLPRMív▒╥░╩½ⁿÑOíC")
  316. (princ)
  317.