home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD1.iso / GFX / Raytracing / Raytracer / LW5VT09.LHA / Toaster / Arexx_examples / PlugIns / QuickMove.lwm < prev    next >
Encoding:
Text File  |  1996-06-10  |  6.7 KB  |  185 lines

  1. /* CMD: ½QuickMove                                                      */
  2. /* By Brett Evan Hester      13032 Copenhill Rd. Dallas, Tx. 75240-5302 */
  3.     MacrosName = "QuickMove"
  4. /* Macro Type:                                                          */
  5. /* MODIFIES    * OBJECTS   * LAYER        * REMEMBERS                   */
  6. /* Description:                                                         */
  7.  
  8. Info1A = "!Quick Move ©                  Information 1 of 2"
  9. Info1B = ""
  10. Info1C = "@This macro moves the ENTIRE layer. Moving the   "
  11. Info1D = "@center of the layer to new coordinates.         "
  12. Info1E = ""
  13. Info1F = "þ The default position to MOVE TO is that of the "
  14. Info1G = "  previous settings for this macro.              "
  15. Info1H = "¤ If no previous settings are found; then, the   "
  16. Info1I = "  default coordinates are those of the           "
  17. Info1J = "  background layers' center.                     "
  18. Info1K = "¤ If there are no background layers; then, the   "
  19. Info1L = "  default coordinates are those of the current   "
  20. Info1M = "  layers' center. (The layer would not move.)    "
  21. Info1N = ""
  22.  
  23. Info2A = "!Quick Move ©                  Information 2 of 2"
  24. Info2B = "@               Plug-Ins and Go! ©               "
  25. Info2C = "                           Hester and associates"
  26. Info2D = "                           13032 Copenhill Road "
  27. Info2E = "                           Dallas, Texas 75240  "
  28. Info2F = "@Special Thanks to:                              "
  29. Info2G = "Arnie Cachelin  Henry Ribron    Mark J. Holland "
  30. Info2H = "J. Phil Kelso   Terry Wester    Steven K. Simms "
  31. Info2I = "Kevin DeRita    Greg Glaser     William S. Hawes"
  32. Info2J = "NewTek ©        Commodore ©     INOVAtronics ©  "
  33. Info2K = ""
  34. Info2L = "@This macro represents a lot of time & hard work."
  35. Info2M = "@Encourage people to create new ones and not kill"
  36. Info2N = "@that possibility by stealing those that are out."
  37.  
  38. /* -------------------------------------------------------------------- */
  39.                                      /* Start Error Detection (See End) */
  40. SIGNAL ON ERROR
  41. SIGNAL ON SYNTAX
  42.                                                    /* Address LightWave */
  43. VT3DLib = ADDLIB("LWModelerARexx.port",0)
  44. ADDRESS "LWModelerARexx.port"
  45.  
  46. /* -------------------------------------------------------------------- */
  47.                                     /* Reading Global Macro Preferences */
  48. BEHDefaultFilePath = "Sys:"
  49. BEHSettingsSavedTo = "T:"
  50. BEHSpeechAndSound = "1"
  51.  
  52. IF (EXISTS("S:PlugInPrefs")) THEN DO
  53.     IF (~OPEN(PlugInPrefs, "S:PlugInPrefs", 'R')) THEN BREAK
  54.     IF (READLN(PlugInPrefs) ~= "PlugInPrefs") THEN BREAK
  55.     BEHDefaultFilePath = READLN(PlugInPrefs)
  56.     BEHSettingsSavedTo = READLN(PlugInPrefs)
  57.     BEHSpeechAndSound = READLN(PlugInPrefs)
  58.     CALL CLOSE(PlugInPrefs)
  59. END
  60.  
  61. /* -------------------------------------------------------------------- */
  62.                                             /* Recalling Macro Settings */
  63. CL = CurLayer()
  64. PARSE value BoundingBox() with N X1 X2 Y1 Y2 Z1 Z2
  65.  
  66. BL = CurBLayer()
  67. IF WORDS(BL) ~= 0 THEN PARSE value BoundingBox(BL) with N X1 X2 Y1 Y2 Z1 Z2
  68.  
  69. ReqX = (X1/2)+(X2/2) ; ReqY = (Y1/2)+(Y2/2) ; ReqZ = (Z1/2)+(Z2/2)
  70.  
  71. PrefsFileName = BEHSettingsSavedTo||MacrosName||".PLUG"
  72.  
  73. IF (EXISTS(PrefsFileName)) THEN DO
  74.     IF (~OPEN(PrefsFile, PrefsFileName, 'R')) THEN BREAK
  75.     IF (READLN(PrefsFile) ~= MacrosName) THEN BREAK
  76.  
  77.     PARSE value READLN(PrefsFile) with ReqX ReqY ReqZ .
  78.  
  79.     CALL CLOSE(PrefsFile)
  80. END
  81.  
  82. /* -------------------------------------------------------------------- */
  83.                                               /* For Information Window */
  84. BEHInfo = 1
  85.                       /* For Coming Back to Main Menu after Info Window */
  86. DO WHILE BEHInfo
  87.  
  88. /* -------------------------------------------------------------------- */
  89.                                                       /* User Interface */
  90.     CALL Req_Begin("Quick Move ©                by Brett Hester")
  91.  
  92.     ReqA = Req_AddControl("Move To",'V',1)
  93.     ReqB = Req_AddControl("",'CH',"Information")
  94.  
  95.     CALL Req_SetVal(ReqA, ReqX ReqY ReqZ)
  96.     CALL Req_SetVal(ReqB, 0)
  97.  
  98.     OKorCANCEL = Req_Post() ; IF OKorCANCEL = 0 THEN CALL Exiting
  99.  
  100.     PARSE value Req_GetVal(ReqA) with ReqX ReqY ReqZ
  101.     BEHInfo = Req_GetVal(ReqB)
  102.  
  103.     CALL Req_End()
  104.  
  105.     IF BEHInfo = 1 THEN CALL InformationWindows
  106.  
  107. END
  108.  
  109. /* -------------------------------------------------------------------- */
  110.                                                    /* Main Body of Code */
  111. PARSE value BoundingBox() with N X1 X2 Y1 Y2 Z1 Z2
  112.  
  113. CX = (X1/2)+(X2/2)  ; CY = (Y1/2)+(Y2/2)  ; CZ = (Z1/2)+(Z2/2)
  114. OffsetX = ReqX - CX ; OffsetY = ReqY - CY ; OffsetZ = ReqZ - CZ
  115.  
  116. CALL Move(OffsetX OffsetY OffsetZ)
  117.  
  118. /* -------------------------------------------------------------------- */
  119.                                             /* Recording Macro Settings */
  120. IF (OPEN(PrefsFile, PrefsFileName, 'W')) THEN DO
  121.     CALL WRITELN(PrefsFile, MacrosName)
  122.  
  123.     CALL WRITELN(PrefsFile, ReqX ReqY ReqZ)
  124.  
  125.     CALL CLOSE(PrefsFile)
  126. END
  127.  
  128. CALL Exiting
  129.  
  130. /* -------------------------------------------------------------------- */
  131.                                                               /* Ending */
  132. Exiting:
  133.  
  134.     IF (VT3DLib) THEN CALL remlib("LWModelerARexx.port")
  135.     EXIT
  136.  
  137. RETURN
  138.  
  139. /* -------------------------------------------------------------------- */
  140.                                                  /* Information Windows */
  141. InformationWindows:
  142.  
  143.     OKorCancel = Notify(2, Info1A, Info1B, Info1C, Info1D, Info1E, Info1F, Info1G, Info1H, Info1I, Info1J, Info1K, Info1L, Info1M, Info1N)
  144.     IF OKorCancel = 1 THEN CALL Notify(1, Info2A, Info2B, Info2C, Info2D, Info2E, Info2F, Info2G, Info2H, Info2I, Info2J, Info2K, Info2L, Info2M, Info2N)
  145.  
  146. RETURN
  147.  
  148. /* -------------------------------------------------------------------- */
  149.                                                       /* Error Handling */
  150. SYNTAX:
  151. ERROR:
  152.  
  153.     ErrCode = RC
  154.     ErrLine = SIGL
  155.     ErrInfo = ERRORTEXT(ErrCode)
  156.  
  157.     Err1 = "!Sorry!"
  158.     Err2 = "An Error has been detected"
  159.     Err3 = "@þ Macro -            "
  160.     Err4 = "@þ Line Number -      "
  161.     Err5 = "@þ Error Code -       "
  162.     Err6 = "@þ Error Description -"
  163.     Err7 = "@¤ Please Inform -    "
  164.     Err8 = '  "Error Notice"     '
  165.     Err9 = "  13032 Copenhill Rd."
  166.     Err10 = "  Dallas, TX. 75240  "
  167.  
  168.     Call Notify(1,Err1,Err2,Err3,MacrosName,Err4,ErrLine,Err5,ErrCode,Err6,ErrInfo,Err7,Err8,Err9,Err10)
  169.  
  170. /* -------------------------------------------------------------------- */
  171.                                              /* Advanced Error Handling */
  172.     CALL SETCLIP("ErrorMacro",MacrosName)
  173.     CALL SETCLIP("ErrorLine",ErrLine)
  174.     CALL SETCLIP("ErrorCode",ErrCode)
  175.     CALL SETCLIP("ErrorDesc",ErrInfo)
  176.  
  177.     PARSE SOURCE TempA TempB ErrFile TempC TempD TempE
  178.  
  179.     CALL SETCLIP("ErrorFile",ErrFile)
  180.  
  181. /* -------------------------------------------------------------------- */
  182.  
  183.     IF (VT3DLib) THEN CALL REMLIB("LWModelerARexx.port")
  184.     EXIT
  185.