home *** CD-ROM | disk | FTP | other *** search
- /* CMD: ½QuickConvert */
- /* By Brett Evan Hester 13032 Copenhill Rd. Dallas, Tx. 75240-5302 */
- MacrosName = "QuickConvert"
- /* Macro Type: */
- /* MODIFIES * OBJECTS * LAYER * REMEMBERS */
- /* Description: */
-
- Info1A = "!Quick Convert © Information 1 of 2"
- Info1B = ""
- Info1C = "@This macro will resize the entire layer, "
- Info1D = "@from one unit of measurement to another. "
- Info1E = ""
- Info1F = "þ WHAT I CONSIDER ONE ... is the unit you want. "
- Info1G = "þ ... IS CURRENTLY ONE ... means displayed as. "
- Info1H = ""
- Info1I = "Example: When designing something small, one"
- Info1J = "option sometimes used, is to have one meter/unit"
- Info1K = "represent one inch. In larger designs, one meter"
- Info1L = "could represent one foot. This macro allows for "
- Info1M = "resizing the object to the proper scale. "
- Info1N = "@All objs should be built to scale when possible."
-
- Info2A = "!Quick Convert © 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"
-
- /* -------------------------------------------------------------------- */
- /* 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 */
- ReqFrom = "7" ; ReqTo = "7"
-
- PrefsFileName = BEHSettingsSavedTo||MacrosName||".PLUG"
-
- IF (EXISTS(PrefsFileName)) THEN DO
- IF (~OPEN(PrefsFile, PrefsFileName, 'R')) THEN BREAK
- IF (READLN(PrefsFile) ~= MacrosName) THEN BREAK
-
- ReqFrom = READLN(PrefsFile)
- ReqTo = READLN(PrefsFile)
-
- CALL CLOSE PrefsFile
- END
-
- /* -------------------------------------------------------------------- */
- /* For Information Window */
- BEHInfo = 1
- /* For Coming Back to Main Menu after Info Window */
- DO WHILE BEHInfo
-
- /* -------------------------------------------------------------------- */
- /* User Interface */
- CALL Req_Begin("Quick Convert © by Brett Hester")
-
- CALL Req_AddControl("",'T'," Fill in the blanks:")
- CALL Req_AddControl("",'T',"What I consider one ...")
- ReqA = Req_AddControl("",'CH',"Inch Foot Yard Mile Millimeter Centimeter Meter Kilometer")
- CALL Req_AddControl("",'T',"... is currently one ...")
- ReqB = Req_AddControl("",'CH',"Inch Foot Yard Mile Millimeter Centimeter Meter Kilometer")
- CALL Req_AddControl("",'T',"")
- ReqC = Req_AddControl("",'CH',"Information")
-
- CALL Req_SetVal(ReqA, ReqFrom)
- CALL Req_SetVal(ReqB, ReqTo)
- CALL Req_SetVal(ReqC, 0)
-
- OKorCANCEL = Req_Post() ; IF OKorCANCEL = 0 THEN CALL Exiting
-
- ReqFrom = Req_GetVal(ReqA)
- ReqTo = Req_GetVal(ReqB)
- BEHInfo = Req_GetVal(ReqC)
-
- CALL Req_End()
-
- IF BEHInfo = 1 THEN CALL InformationWindows
-
- END
-
- /* -------------------------------------------------------------------- */
- /* Main Body Of Code */
- UnitVal.1 = 39370.0787400 /* Inches */
- UnitVal.2 = 3280.83989500 /* Feet */
- UnitVal.3 = 1093.61329800 /* Yards */
- UnitVal.4 = 0.62137100000 /* Miles */
- UnitVal.5 = 1000000.00000 /* Millimeters */
- UnitVal.6 = 100000.000000 /* Centimeters */
- UnitVal.7 = 1000.00000000 /* Meters */
- UnitVal.8 = 1.00000000000 /* Kilometers */
-
- Difference = UnitVal.ReqTo / UnitVal.ReqFrom
-
- CALL Scale(Difference, 0 0 0)
-
- /* -------------------------------------------------------------------- */
- /* Recording Macro Settings */
- IF (OPEN(PrefsFile, PrefsFileName, 'W')) THEN DO
- CALL WRITELN(PrefsFile, MacrosName)
-
- CALL WRITELN(PrefsFile, ReqFrom)
- CALL WRITELN(PrefsFile, ReqTo)
-
- 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 OKorCancel = 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
-