home *** CD-ROM | disk | FTP | other *** search
- /* CMD: ½ModifyToSphere */
- /* By Brett Evan Hester 13032 Copenhill Rd. Dallas, Tx. 75240-5302 */
- MacrosName = "ModifyToSphere"
- /* Macro Type: */
- /* MODIFIES * OBJECTS * SELECTED * TIME NEEDED */
- /* Description: */
-
- Info1A = "!Modify To Sphere © Information 1 of 2"
- Info1B = ""
- Info1C = "@This macro reshapes the current object into that"
- Info1D = "@of a sphere, spheriod, or circular based object."
- Info1E = ""
- Info1F = "þ the default CENTER is that of the current obj."
- Info1G = "þ the default RADIUS is that of the current obj."
- Info1H = "þ each AXIS defaults to off if the obj. is flat "
- Info1I = " on that axis. "
- Info1J = "¤ If all are turned on a spheriod is created. "
- Info1K = "¤ If two are turned on a cylidrical shaped "
- Info1L = " object is the result. "
- Info1M = "¤ If only one axis is chosen, a bumped or T.V. "
- Info1N = " screen look is made. "
-
- Info2A = "!Modify To Sphere © 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"
- /* Add Math Functions */
- MATHLIB= "rexxmathlib.library"
- IF POS(MATHLIB , SHOW('L')) = 0 THEN
- IF ~ADDLIB(MATHLIB , 0 , -30 , 0) THEN DO
- CALL Notify(1,"!Can't find "MATHLIB)
- IF VT3DLib THEN CALL REMLIB("LWModelerARexx.port")
- EXIT
- END
-
- /* -------------------------------------------------------------------- */
- /* Retrieving Layer Info */
- Box = BoundingBox()
- PARSE var Box N X1 X2 Y1 Y2 Z1 Z2
-
- IF N = 0 THEN DO
- CALL Notify(1,"!Sorry!","@An object must be present for this macro.")
- CALL Exiting
- END
-
- CntX = (X1/2)+(X2/2) ; CntY = (Y1/2)+(Y2/2) ; CntZ = (Z1/2)+(Z2/2)
- RadX = (X2-X1)/2 ; RadY = (Y2-Y1)/2 ; RadZ = (Z2-Z1)/2
-
- IF RadX = 0 THEN ReqAxisX = 0 ; ELSE ReqAxisX = 1
- IF RadY = 0 THEN ReqAxisY = 0 ; ELSE ReqAxisY = 1
- IF RadZ = 0 THEN ReqAxisZ = 0 ; ELSE ReqAxisZ = 1
-
- /* ******************************************************************** */
- /* Main Body Of Code */
- CALL MenuRequester
- CALL TransformObject
- CALL Exiting
-
- /* ******************************************************************** */
- /* User Interface */
- MenuRequester:
-
- CALL Req_Begin("Modify To Sphere © by Brett Hester")
-
- ReqA = Req_AddControl("Center",'V',1)
- ReqB = Req_AddControl("Radius",'V',1)
- ReqC = Req_AddControl("X Axis",'B')
- ReqD = Req_AddControl("Y Axis",'B')
- ReqE = Req_AddControl("Z Axis",'B')
- ReqF = Req_AddControl("",'CH', "Information")
-
- CALL Req_SetVal(ReqA, CntX CntY CntZ)
- CALL Req_SetVal(ReqB, RadX RadY RadZ)
- CALL Req_SetVal(ReqC, ReqAxisX)
- CALL Req_SetVal(ReqD, ReqAxisY)
- CALL Req_SetVal(ReqE, ReqAxisZ)
- CALL Req_SetVal(ReqF, 0)
-
- OKorCancel = Req_Post() ; IF OKorCancel = 0 THEN CALL Exiting
-
- ReqCenter = Req_GetVal(ReqA)
- ReqRadius = Req_GetVal(ReqB)
- ReqAxisX = Req_GetVal(ReqC)
- ReqAxisY = Req_GetVal(ReqD)
- ReqAxisZ = Req_GetVal(ReqE)
- BEHInfo = Req_GetVal(ReqF)
-
- PARSE var ReqCenter CntX CntY CntZ
- PARSE var ReqRadius RadX RadY RadZ
-
- CALL Req_End()
-
- IF BEHInfo = 1 THEN CALL InformationWindows
-
- RETURN
-
- /* -------------------------------------------------------------------- */
- /* Transform Object */
- TransformObject:
-
- N = XFrm_Begin()
- CALL Meter_Begin(N, "Modifing To Spheroid-Based Shape")
- DO i = 1 to N
- PARSE value XFrm_GetPos(i) with X Y Z .
- DX = X - CntX ; DY = Y - CntY ; DZ = Z - CntZ
- D = SQRT(DX * DX + DY * DY + DZ * DZ)
- IF (D ~= 0) THEN DO
- DRadX = RadX / D ; DRadY = RadY / D ; DRadZ = RadZ / D
-
- IF ReqAxisX = 1 THEN X = (DX * DRadX) + CntX
- IF ReqAxisY = 1 THEN Y = (DY * DRadY) + CntY
- IF ReqAxisZ = 1 THEN Z = (DZ * DRadZ) + CntZ
-
- CALL XFrm_SetPos(i, X Y Z)
- END
- CALL Meter_Step()
- END
- CALL Meter_End()
- CALL XFrm_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
-