home *** CD-ROM | disk | FTP | other *** search
- /* CMD: ½ModifyRefMove */
- /* By Brett Evan Hester 13032 Copenhill Rd. Dallas, Tx. 75240-5302 */
- MacrosName = "ModifyRefMove"
- /* Macro Type: */
- /* MODIFIES * OBJECTS * BKG NEEDED * SELECTED * REMEMBERS */
- /* Description: */
-
- Info1A = "!Modify Reference Move © Information 1 of 2"
- Info1B = ""
- Info1C = "@This macro moves the ENTIRE layer. Based upon a "
- Info1D = "@single point. The point can be positioned in "
- Info1E = "@relationship to the Current or Bkg. Layer. "
- Info1F = ""
- Info1G = 'þ "·" Moves the point to custom coordinates. '
- Info1H = " Dflt. Coords. are those of the selected point."
- Info1I = "þ CURRENT L. moves the entire layer in relation "
- Info1J = " to itself. "
- Info1K = "þ BKG LAYER positioning works by moving the sel."
- Info1L = " pnt. to a certain location and bringing all "
- Info1M = " the other points along. "
- Info1N = 'þ "X" Does NOT move the object on that axis. '
-
- Info2A = "!Modify Reference Move © Information 2 of 2"
- Info2B = "@ Plug-Ins and Go! © "
- Info2C = " Hester and associates"
- Info2D = " 13032 Copenhill Road "
- Info2E = " Dallas, Texas 75240 "
- Info2F = "@Special Thanks to: "
- Info2G = "Arnie Cachelin Henry Ribron Mark J. Holland "
- Info2H = "J. Phil Kelso Terry Wester Steven K. Simms "
- Info2I = "Kevin DeRita Greg Glaser William S. Hawes"
- Info2J = "NewTek © Commodore © INOVAtronics © "
- Info2K = ""
- Info2L = "@This macro represents a lot of time & hard work."
- Info2M = "@Encourage people to create new ones and not kill"
- Info2N = "@that possibility by stealing those that are out."
-
- /* -------------------------------------------------------------------- */
- /* Start Error Detection (See End) */
- SIGNAL ON ERROR
- SIGNAL ON SYNTAX
- /* Address LightWave */
- VT3DLib = ADDLIB("LWModelerARexx.port",0)
- ADDRESS "LWModelerARexx.port"
-
- /* -------------------------------------------------------------------- */
- /* Verify only one pnt sel. and get coords. */
- CALL Sel_Mode(USER)
-
- N = XFrm_Begin()
-
- IF N ~= 1 THEN DO
- ReqA = "!Sorry!"
- ReqB = "@Exactly one point must be selected."
- ReqC = "That point will be used as a reference"
- ReqD = "for moving the entire layer."
- CALL Notify(1,ReqA,ReqB,ReqC,ReqD)
- CALL Exiting
- END
-
- PARSE value XFrm_GetPos(1) with PntX PntY PntZ .
-
- CALL XFrm_End()
-
- /* -------------------------------------------------------------------- */
- /* Reading Global Macro Preferences */
- BEHDefaultFilePath = "Sys:"
- BEHSettingsSavedTo = "T:"
- BEHSpeechAndSound = "1"
-
- IF (EXISTS("S:PlugInPrefs")) THEN DO
- IF (~OPEN(PlugInPrefs, "S:PlugInPrefs", 'R')) THEN BREAK
- IF (READLN(PlugInPrefs) ~= "PlugInPrefs") THEN BREAK
- BEHDefaultFilePath = READLN(PlugInPrefs)
- BEHSettingsSavedTo = READLN(PlugInPrefs)
- BEHSpeechAndSound = READLN(PlugInPrefs)
- CALL CLOSE PlugInPrefs
- END
-
- /* -------------------------------------------------------------------- */
- /* Recalling Macro Settings */
- ReqOptX = 1 ; ReqOptY = 1 ; ReqOptZ = 1
- ReqPntX = PntX ; ReqPntY = PntY ; ReqPntZ = PntZ
-
- PrefsFileName = BEHSettingsSavedTo||MacrosName||".PLUG"
-
- IF (EXISTS(PrefsFileName)) THEN DO
- IF (~OPEN(PrefsFile, PrefsFileName, 'R')) THEN BREAK
- IF (READLN(PrefsFile) ~= MacrosName) THEN BREAK
-
- PARSE value READLN(PrefsFile) with ReqOptX ReqOptY ReqOptZ .
-
- CALL CLOSE PrefsFile
- END
-
- /* ******************************************************************** */
- /* Main Body Of Code */
- CALL MenuRequester
- CALL SaveSettings
- CALL Calculations
- CALL Sel_Mode(GLOBAL) ; CALL Move(PosX PosY PosZ)
- CALL Exiting
-
- /* ******************************************************************** */
- /* User Interface */
- MenuRequester:
-
- CALL Req_Begin("Modify Reference Move © by Brett Hester")
-
- CALL Req_AddControl("þ",'T',"Move selected point to:")
- CALL Req_AddControl("-",'T',"- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -")
- CALL Req_AddControl(" ",'T'," | Current Layer's | Background Layer's | ")
- CALL Req_AddControl(" ",'T'," | - Negative Positive + | - Negative Positive + | ")
- ReqA = Req_AddControl("X",'CH',"· Left Edge Center RightEdge Left Edge Center RightEdge X")
- ReqB = Req_AddControl("Y",'CH',"· LowerEdge Center UpperEdge LowerEdge Center UpperEdge X")
- ReqC = Req_AddControl("Z",'CH',"· FrontEdge Center Back Edge FrontEdge Center Back Edge X")
- ReqD = Req_AddControl("",'V',"1")
- CALL Req_AddControl("-",'T',"- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -")
- ReqE = Req_AddControl("¤",'CH',"Information")
-
- CALL Req_SetVal(ReqA, ReqOptX)
- CALL Req_SetVal(ReqB, ReqOptY)
- CALL Req_SetVal(ReqC, ReqOptZ)
- CALL Req_SetVal(ReqD, ReqPntX ReqPntY ReqPntZ)
- CALL Req_SetVal(ReqE, 0)
-
- OKorCancel = Req_Post() ; IF OKorCancel = 0 THEN CALL Exiting
-
- ReqOptX = Req_GetVal(ReqA)
- ReqOptY = Req_GetVal(ReqB)
- ReqOptZ = Req_GetVal(ReqC)
- ReqPnt = Req_GetVal(ReqD)
- BEHInfo = Req_GetVal(ReqE)
-
- PARSE var ReqPnt ReqPntX ReqPntY ReqPntZ
-
- CALL Req_End()
-
- IF BEHInfo = 1 THEN CALL InformationWindows
-
- RETURN
-
- /* -------------------------------------------------------------------- */
- /* Calculations */
- Calculations:
-
- CL = CurLayer() ; CBox = BoundingBox(CL)
- PARSE var CBox CN CX1 CX2 CY1 CY2 CZ1 CZ2
- CXC = (CX1/2)+(CX2/2) ; CYC = (CY1/2)+(CY2/2) ; CZC = (CZ1/2)+(CZ2/2)
-
- BL = CurBLayer() ; BBox = BoundingBox(BL)
- PARSE var BBox BN BX1 BX2 BY1 BY2 BZ1 BZ2
- BXC = (BX1/2)+(BX2/2) ; BYC = (BY1/2)+(BY2/2) ; BZC = (BZ1/2)+(BZ2/2)
-
- IF ReqOptX = 1 THEN PosX = ReqPntX - PntX
- IF ReqOptX = 2 THEN PosX = CX1 - PntX
- IF ReqOptX = 3 THEN PosX = CXC - PntX
- IF ReqOptX = 4 THEN PosX = CX2 - PntX
- IF ReqOptX = 5 THEN PosX = BX1 - PntX
- IF ReqOptX = 6 THEN PosX = BXC - PntX
- IF ReqOptX = 7 THEN PosX = BX2 - PntX
- IF ReqOptX = 8 THEN PosX = 0
-
- IF ReqOptY = 1 THEN PosY = ReqPntY - PntY
- IF ReqOptY = 2 THEN PosY = CY1 - PntY
- IF ReqOptY = 3 THEN PosY = CYC - PntY
- IF ReqOptY = 4 THEN PosY = CY2 - PntY
- IF ReqOptY = 5 THEN PosY = BY1 - PntY
- IF ReqOptY = 6 THEN PosY = BYC - PntY
- IF ReqOptY = 7 THEN PosY = BY2 - PntY
- IF ReqOptY = 8 THEN PosY = 0
-
- IF ReqOptZ = 1 THEN PosZ = ReqPntZ - PntZ
- IF ReqOptZ = 2 THEN PosZ = CZ1 - PntZ
- IF ReqOptZ = 3 THEN PosZ = CZC - PntZ
- IF ReqOptZ = 4 THEN PosZ = CZ2 - PntZ
- IF ReqOptZ = 5 THEN PosZ = BZ1 - PntZ
- IF ReqOptZ = 6 THEN PosZ = BZC - PntZ
- IF ReqOptZ = 7 THEN PosZ = BZ2 - PntZ
- IF ReqOptZ = 8 THEN PosZ = 0
-
- RETURN
-
- /* -------------------------------------------------------------------- */
- /* Recording Macro Settings */
- SaveSettings:
-
- IF (OPEN(PrefsFile, PrefsFileName, 'W')) THEN DO
- CALL WRITELN(PrefsFile, MacrosName)
-
- CALL WRITELN(PrefsFile, ReqOptX ReqOptY ReqOptZ)
-
- CALL CLOSE PrefsFile
- END
-
- RETURN
-
- /* -------------------------------------------------------------------- */
- /* Ending */
- Exiting:
-
- IF (VT3DLib) THEN CALL REMLIB("LWModelerARexx.port")
- EXIT
-
- RETURN
-
- /* -------------------------------------------------------------------- */
- /* Information Windows */
- InformationWindows:
-
- OKorCancel = Notify(2, Info1A, Info1B, Info1C, Info1D, Info1E, Info1F, Info1G, Info1H, Info1I, Info1J, Info1K, Info1L, Info1M, Info1N)
- IF OKorCancel = 1 THEN CALL Notify(1, Info2A, Info2B, Info2C, Info2D, Info2E, Info2F, Info2G, Info2H, Info2I, Info2J, Info2K, Info2L, Info2M, Info2N)
- CALL MenuRequester
-
- RETURN
-
- /* -------------------------------------------------------------------- */
- /* Error Handling */
- SYNTAX:
- ERROR:
-
- ErrCode = RC
- ErrLine = SIGL
- ErrInfo = ERRORTEXT(ErrCode)
-
- Err1 = "!Sorry!"
- Err2 = "An Error has been detected"
- Err3 = "@þ Macro - "
- Err4 = "@þ Line Number - "
- Err5 = "@þ Error Code - "
- Err6 = "@þ Error Description -"
- Err7 = "@¤ Please Inform - "
- Err8 = ' "Error Notice" '
- Err9 = " 13032 Copenhill Rd."
- Err10 = " Dallas, TX. 75240 "
-
- Call Notify(1,Err1,Err2,Err3,MacrosName,Err4,ErrLine,Err5,ErrCode,Err6,ErrInfo,Err7,Err8,Err9,Err10)
-
- /* -------------------------------------------------------------------- */
- /* Advanced Error Handling */
- CALL SETCLIP("ErrorMacro",MacrosName)
- CALL SETCLIP("ErrorLine",ErrLine)
- CALL SETCLIP("ErrorCode",ErrCode)
- CALL SETCLIP("ErrorDesc",ErrInfo)
-
- PARSE SOURCE TempA TempB ErrFile TempC TempD TempE
-
- CALL SETCLIP("ErrorFile",ErrFile)
-
- /* -------------------------------------------------------------------- */
-
- IF (VT3DLib) THEN CALL REMLIB("LWModelerARexx.port")
- EXIT
-