home *** CD-ROM | disk | FTP | other *** search
- /* CMD: ½QuickCone */
- /* By Brett Evan Hester 13032 Copenhill Rd. Dallas, Tx. 75240-5302 */
- MacrosName = "QuickCone"
- /* Macro Type: */
- /* CREATES * OBJECTS * LAYER NEEDED * SELECTED * REMEMBERS */
- /* Description: */
-
- Info1A = "!Quick Cone © Information 1 of 2"
- Info1B = ""
- Info1C = "@This macro will create a cone, using defaults "
- Info1D = "@based on the currently selected and last used "
- Info1E = "@settings. "
- Info1F = ""
- Info1G = "þ The CENTER defaults to that of the selected. "
- Info1H = "þ The RADIUS defaults to that of the selected. "
- Info1I = "¤ If a radius is zero; then, the radius defaults"
- Info1J = " to the previous settings. "
- Info1K = "¤ If there are no previous settings; then, the "
- Info1L = " default radius is one. "
- Info1M = "þ DIRECTION (- ¼ +) has pointed end in the neg. "
- Info1N = " (- ½ +) has pointed end in the pos. "
-
- Info2A = "!Quick Cone © 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"
-
- /* -------------------------------------------------------------------- */
- /* Empty Layer Setup */
- CL = CurLayer()
- Empty = EmptyLayers()
- IF (WORDS(Empty) < 1) THEN DO
- CALL Notify(1, "Sorry!","@An empty layer is needed for this operation.")
- CALL Exiting
- END
- EL = WORD(Empty, 1)
-
- /* -------------------------------------------------------------------- */
- /* 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 */
- ReqAxis = 3
- ReqSides = 16
- ReqSegs = 1
- ReqDir = 1
- OptRX = 1 ; OptRX = 1 ; OptRX = 1
-
- PrefsFileName = BEHSettingsSavedTo||MacrosName||".PLUG"
-
- IF (EXISTS(PrefsFileName)) THEN DO
- IF (~OPEN(PrefsFile, PrefsFileName, 'R')) THEN BREAK
- IF (READLN(PrefsFile) ~= MacrosName) THEN BREAK
-
- ReqAxis = READLN(PrefsFile)
- ReqSides = READLN(PrefsFile)
- ReqSegs = READLN(PrefsFile)
- ReqDir = READLN(PrefsFile)
- PARSE value READLN(PrefsFile) with OptRX OptRY OptRZ
-
- CALL CLOSE(PrefsFile)
- END
-
- /* -------------------------------------------------------------------- */
- /* Main Body of Code */
- CALL Sel_Mode(USER)
-
- CALL Copy() ; CALL SetLayer(EL) ; CALL Paste()
- PARSE value BoundingBox() with N X1 X2 Y1 Y2 Z1 Z2
-
- CX = (X1/2)+(X2/2) ; CY = (Y1/2)+(Y2/2) ; CZ = (Z1/2)+(Z2/2)
- RX = (X2-X1)/2 ; RY = (Y2-Y1)/2 ; RZ = (Z2-Z1)/2
- IF RX=0 THEN RX=OptRX ; IF RY=0 THEN RY=OptRY ; IF RZ=0 THEN RZ=OptRZ
-
- CALL Cut()
- CALL SetLayer(CL)
-
- /* -------------------------------------------------------------------- */
- /* For Information Window */
- BEHInfo = 1
- /* For Coming Back to Main Menu after Info Window */
- DO WHILE BEHInfo
-
- /* -------------------------------------------------------------------- */
- /* User Interface */
- CALL Req_Begin("Quick Cone © by Brett Hester")
-
- ReqA = Req_AddControl("Center Point",'V',1)
- ReqB = Req_AddControl("Radius",'V',1)
- ReqC = Req_AddControl("Axis",'CH'," X Y Z ")
- ReqD = Req_AddControl("Sides",'N',0)
- ReqE = Req_AddControl("Segments",'N',0)
- ReqF = Req_AddControl("Direction",'CH',"- ¼ + - ½ +")
- ReqG = Req_AddControl("",'CH', "Information")
-
- CALL Req_SetVal(ReqA, CX CY CZ)
- CALL Req_SetVal(ReqB, RX RY RZ)
- CALL Req_SetVal(ReqC, ReqAxis)
- CALL Req_SetVal(ReqD, ReqSides)
- CALL Req_SetVal(ReqE, ReqSegs)
- CALL Req_SetVal(ReqF, ReqDir)
- CALL Req_SetVal(ReqG, 0)
-
- OKorCancel = Req_Post() ; IF OKorCancel = 0 THEN CALL Exiting
-
- PARSE value Req_GetVal(ReqA) with CX CY CZ
- PARSE value Req_GetVal(ReqB) with RX RY RZ
- ReqAxis = Req_GetVal(ReqC)
- ReqSides = Req_GetVal(ReqD)
- ReqSegs = Req_GetVal(ReqE)
- ReqDir = Req_GetVal(ReqF)
- BEHInfo = Req_GetVal(ReqG)
-
- CALL Req_End()
-
- ReqSides = ABS(TRUNC(ReqSides)) ; ReqSegs = ABS(TRUNC(ReqSegs))
- X1 = CX + RX ; Y1 = CY + RY ; Z1 = CZ + RZ
- X2 = CX - RX ; Y2 = CY - RY ; Z2 = CZ - RZ
-
- IF BEHInfo = 1 THEN CALL InformationWindows
-
- /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
- /* Verify Input */
- OKtoContinue = 0
- IF RX ~= 0 THEN OKtoContinue = OKtoContinue + 1
- IF RY ~= 0 THEN OKtoContinue = OKtoContinue + 1
- IF RZ ~= 0 THEN OKtoContinue = OKtoContinue + 1
- IF OKtoContinue < 2 THEN DO
- CALL Notify(1,"!Sorry!","@At least two radii must not be zero.")
- BEHInfo = 1
- END
-
- IF ReqSides <= 2 THEN DO
- CALL Notify(1,"!Sorry!","@At least three sides must be chosen.")
- ReqSides = 3
- BEHInfo = 1
- END
-
- IF ReqSegs <= 0 THEN DO
- CALL Notify(1,"!Sorry!","@At least one segment must be chosen.")
- ReqSegs = 1
- BEHInfo = 1
- END
-
- END
-
- /* -------------------------------------------------------------------- */
- /* Creating the Cone */
- IF ReqAxis = 1 THEN Axis = "X"
- IF ReqAxis = 2 THEN Axis = "Y"
- IF ReqAxis = 3 THEN Axis = "Z"
-
- IF ReqDir = 1 THEN CALL MakeCone(RX RY RZ, X1, X2, Axis, ReqSides, ReqSegs, CX CY CZ)
- IF ReqDir = 2 THEN CALL MakeCone(RX RY RZ, X2, X1, Axis, ReqSides, ReqSegs, CX CY CZ)
-
- /* -------------------------------------------------------------------- */
- /* Recording Macro Settings */
- IF (OPEN(PrefsFile, PrefsFileName, 'W')) THEN DO
- CALL WRITELN(PrefsFile, MacrosName)
-
- CALL WRITELN(PrefsFile, ReqAxis)
- CALL WRITELN(PrefsFile, ReqSides)
- CALL WRITELN(PrefsFile, ReqSegs)
- CALL WRITELN(PrefsFile, ReqDir)
- CALL WRITELN(PrefsFile, RX RY RZ)
-
- CALL CLOSE(PrefsFile)
- END
-
- CALL Exiting
-
- /* -------------------------------------------------------------------- */
- /* 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)
-
- 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
-