Zip File Name:		Gear-O-Matic!-v1_02.zip
Script Name:		Gear-O-Matic!
Version:			v1.02
Creation Date:		22June2002
Status:			Offial release
Required Extensions:	none
Encrypted:		y
MAX Build:		r3.x thru r4.x, & VIZ4
Author:			swami*, a.k.a. "codeWarrior()", swami@cfl.rr.com
Script Description:		Generate/Animate gear pairs and compound gear trains.

Excerpt from script header...
--*****************************************************
-- Gear-O-Matic!-v1_02.ms
-- "Gear-O-Matic!"
-- v1.02
-- (max r3.x thru r4.x, & VIZ4)
-- 06.22.02
-- by swami*, a.k.a. "codeWarrior()", swami@cfl.rr.com
--*******************************************************
--
--  ***************************************************
--  ***  Contact the author for custom scripting    ***
--  ***       copyright 2002 SWAMANIMATIONS!        ***
--  ***************************************************
--
--*******************************************************
-- INSTALLATION:
--    - Unzip 'Gear-O-Matic!-v#_##.zip' USING SUB-FOLDER NAMES option.
--    - To run, launch 'Gear-O-Matic!' in max ..\scripts\gom!
--*****************************************************
-- USAGE:
--    * Help is provided via the 'info' buttons by the parameters, by mouse-over tooltips, and in the
--      'Purpose/Usage/Comments/Quirks/FuturePlans...' rollout.
--    * NOTE: Lots of functionality is 'hidden' under the buttons by using ctrl, alt, and shift modifiers.
--
--    'Gear Generation/Animation':
--    - Set parameters, and hit 'Gear-O-Matic! It!'
--    - Use 'Pick 'Wheel' to Adjust Rotation/Separation' button and spinner to rotate wheel teeth to meet flush
--      with pinion teeth (NOTE: Tooth contact edge may alternate when building a gear train). Use 'Sep' to
--      further adjust. This is good for aligning gears so there is no gap between meshing teeth (i.e. zero backlash).
--    - NOTE:
--        - By default, the pinion's rotation control dummy ('Pinion##-RotControl') is set to -10 degrees per 30 frames
--          with a RelativeRepeat Out-Of-Range Type.
--        - Set 'Face Width' to zero to generate only splines.
--        - Use 'Add Detail' to add 'cut-out' shapes to the gear.
--            - Shape: 'Custom' => use a selected spline.
--
--    'Build Gear Train':
--    - Pick a 'Source' gear pair.
--    - Pick a 'Destination' gear pair.
--    - Hit 'Build Gear Train' button.
--    - Use 'Pick 'Pair' to Adjust' button and spinners to raise/lower the source pair to avoid geometry violation
--      (and we all know how painful that can be!), to rotate source pair to desired orientation, and to scale
--      the gear thickness.
--
--    'Presets, Save/Load Custom':
--    - Launch floater using 'Presets, Save/Load Custom' button in 'Gear Generation/Animation' rollout.
--        'Save':
--        - Use 'Ouput File:' to set .gom output data filename.
--        - Enter 'Title' and 'Preset Name' as desired.
--        - Hit 'Save Params.'
--
--        'Load':
--        - Choose from the 'Library of Presets' (double-click an item), or use 'Load:' to load a .gom data file.
--        - Click an item in the 'Presets' list to load it into the UI,
--          then you can use 'Gear-O-Matic!' It!' to generate the gear or gear pair
--          (NOTE: Rotation/Separation adjustments must be redone manually).
--
--    'ORTFixer!&Helper' (max R3.x only):
--    - This launches a floater to fix loaded GOM! scenes, and to allow animation of gear trains.
--    - See the floater's 'Purpose/Usage/Comments/Quirks/FuturePlans...' for details.
--
--    NOTE:
--    - With so many parameters, trial-and-error is required.
--    - Not all combinations generate valid geometries.
--    - Read ALL documentation for a full understanding and best usage of the script.
--
--    - CAUTION:
--        - Do not rename objects (script controllers, and 'Build Gear Train' code are based on initial object names).
--        - Keep fingers clear of rotating gears!
--*****************************************************
-- COMMENTS:
--    - Contains lots of debug code (will be removed in final version - for speed and clarity).
--    - The code has NOT been optimized. In fact, it is slowed by the debug code. Even if a debug flag is false,
--      a conditional if must still be processed, thus slowing execution. NOTE: conditional ifs are compute expensive.
--    - Gear geometry is not entirely correct, but does mesh properly.
--        - Need trochoid fillet at base of tooth.
--        - Addendem and Dedendum are correct but tooth placement is not.
--    - 'Wheel##' must be slightly rotated to mesh properly (has been semi-automated.).
--    - Currently, only one gear train per scene is allowed.
--
--    - IMPORTANT NOTE (max R3.x only):
--        Re: Loading files generated by 'Gear-O-Matic!'
--        - You MUST use 'ORTFixer!&Helper.ms' to fix a nasty habit of MAX: on loading a scene,
--          objects with script controllers have their Out-Of-Range Types reset to 'Constant'!
--          This little script sets the appropriate objects' ORT's to 'Relative Repeat.'
--        Re: Animation
--        - See important comments in ORTFixer!&Helper floater.
--*****************************************************
-- HISTORY:
-- (">>>" => to be done...)
--    - v1.02 (06.22.02):
--        - Disabled softlock.
--        - Fixed a couple minor bugs.
--        - Encrypted!
--    - v1.00 (12.19.01):
--        - 1st official release.
--        - Updated softlock.
--    - v0.97 (08.30.01)
--        - Updated to work in R4.20!
--        - Added option to not include the 'Out-Of-Range Type Fixer!&Helper' rollout, because the bug that made
--          it necessary has been fixed in R4.20!
------------------
------------------
-- LOST :(
--    - v0.962 (08.08.2k):
--        - Extended time limit: will run thru 9.30.2k.
--        - Disabled (i.e. commented out) any code related to 'netrender fix', because this is better handled in
--          'ORTFixer&Helper!'
--    - v0.961 (07.03.2k):
--        - Added temporary, limited fix to allow network rendering of GOM! generated files. This 'fix' is required due to a
--          bug in MAX: on loading a scene, objects with script controllers have their Out-Of-Range Types reset to 'Constant'!
------------------
------------------
--    - v0.96 (06.28.2k):
--        - Added 'Generate Axle' checkbox for option to make axle or not.
--        - Added button to launch 'Quick Start Turorial' (see 'Purpose/Usage/Comments/Quirks/FuturePlans...')
--        - Added 'Add Detail' option to add 'cut-out' shapes (circle, square, star, custom) in gears.
--            - For details on 'custom', launch the 'Add Detail Tutorial' from 'Purpose/Usage/Comments/Quirks/FuturePlans...'.
--    - v0.95 (06.24.2k):
--        * Worked around a nasty MAX precision problem that lead to gears with a non-integer number of teeth even though they
--          should have been OK. The 'Gear Ratio' spinner' has been replaced by two spinners. Serendipitously, this is actually
--          a better method!
--        - Added option to increase spinner range for 'Gear Ratio' and 'Number of Teeth on Pinion." Reset to default values is
--          also supported.
--        - Added display of estimated generation time for items in 'Presets' list.
--    - v0.9 (06.24.2k):
--        * -=<< 1 S T   G E N E R A L   B E T A   R E L E A S E   T O   T H E   M A X   C O M M U N I T Y ! >>=-
--        * Fixed nasy error that required script to be run twice on starting a MAX session! Yahoo!
--        - Added 'Zoom Extents on Generation' checkbox.
--        - Added control over random gear colors feature.
--    - v0.87 (06.24.2k):
--        - To speed workflow, removed 'Reset' on 'Gear-O-Matic! It!'; and removed 'DONE' on 'build Gear Train.'
--        - In 'Load', added listbox to show .goms to choose from. This serves as a library of presets. These files must be
--          placed in MAX ..\Scripts to be found. Other .goms can be loaded using 'Load', but currently do NOT appear in the list.
--        - Created new .goms.
--        - Added code: on 'Gear-O-Matic!' It!' pressed, 'Build Gear Train' pair adjustment is setup.
--        - Added 'Randomize Gear Colors'. Affects objects named 'Pinion??' or 'Wheel??' only.
--        - Added error checking/handling: In 'Build Gear Train', flag user if 'Source' and 'Destination' are not different.
--        - Fixed bug that wrote the wrong processing time (dt) to the pinion's UserProps.
--    - v0.86 (06.21.2k):
--        - Simplified 'readGOMParams' function to allow easier data file writing on 'Save Custom' (not implemented, yet).
--        - Added 'Save' feature which creates a '.gom' data file with a SINGLE gear or gear pair defined.
--          These can be manually combined to create .gom with multiple presets.
--        - Generated .gom data file of 'Cogs' and set as default.
--    - v0.85 (06.20.2k):
--        - >>>Worked on 'Presets'.
--        - Added 'Separation' spinner to Adjustment:'Pick 'Wheel' to Adjust...'
--        - Added support for 'reverse engineering' a gear or gear pair: creation parameters are stored
--          in the pinion's User Defined Properties. NOTE: Wheel rotation/separation adjustments are NOT included.
--    - v0.84 (06.18.2k):
--        - Fixed bug in 'Presets, Save/Load Custom' that prevented .gom's from loading if a parameter is missing.
--          This happens as new parameters are added, and therefore are not present in old data files.
--    - v0.83 (06.18.2k):
--        - Modified script to account for renamed 'ORTFixer!.ms' which is now 'ORTFixer!&Helper.ms' to reflect
--          it expanded functionality.
--    - v0.82 (06.18.2k):
--        - Fixed bug (typo) in 'Build Gear Train'/Adjustment/Scale.
--        - Added code to flag possible round-off error resulting in wheel with a non-integer number of teeth.
--          Added could to attempt to correct this error, but doesn't work quite right, so it is temporarily
--          commented out.
--        - Increased the wheel rotation adjustment range for +/-10 to +/-20 degrees.
--    - v0.81 (06.18.2k):
--        - Added option to generate a label to indicate the gear ratio.
--    - v0.8 (06.17.2k):
--        - Started coding 'Presets, Save/Load Custom' feature as floater.
--          Preliminary success at manually writing/reading a presets data file.
--    - v0.7 (06.17.2k):
--        - Removed 'Tooth Curvature' spinner.
--        - Added option to generate 'Indicator' (or not) on gear generation.
--        - Added option to toggle 'Indicator' renderable status.
--        - Rewrote 'Build Gear Train' code to key on 'GearPair' group heads.
--          This is more logical to the user, and it will allow proper position/rotation/scale adjustment on ANY gear pair
--          (not just on an end gear pair as in previous method). Still need to write this part... 
--        - Added feature to scale gear pair in its local z (i.e. its 'thickness')
--        - Added 'Delete Last Gear/Gear Pair.'
--        - Eliminated need for 'GearTrainAligner' dummy. This simplified the gear pair hierarchy and the code.
--    - v0.6 (06.16.2k):
--        - Fixed bug that somtimes would crash script when 'Addendum' or 'Dedendum' were intially changed.
--        - Added 'Wheel' rotation adjustment.
--        - >>>Added group attach upon building gear train.
--        - Added 'Gear Pair' position/rotation/scale adjustment (in 'Aligner' coord sys).
--        - >>>Added group position/rotation/scale adjustment (in 'Aligner' coord sys).
--        - >>>Added option to toggle render status of 'Indicators', or to delete them altogher.
--        - Divided UI up into groups.
--        - Added more tooltips.
--    - v0.5 (06.15.2k):
--        - Added alternative method to align position and align direction (i.e. z direction) using direct selection
--          of source ('aligner') and destination ('wheel'). This method allows cloned gear pair to be added to gear train.
--        - Added script contoller code to complete building of a gear train.
--          NOTE:
--              - There is minimal error checking/handling, yet.
--              - No height adjustment is made to account for gear faceWidth, yet.
--              - No extra grouping is done, yet.
--    - v0.4 (06.14.2k):
--        - Added 'Indicator' object to better visualize rotations.
--        - Added rollout for building a gear train.
--        - Added code to write 'RotControl' and 'numTeeth' to 'Aligner' User Properties
--          (will be used by 'buildGearTrain' function).
--          Also, added code to write 'numTeeth' to gear's User Properties (just because).
--        - Added align position and align direction (i.e. z direction) using aligners' userProp
--          and an execute string. This has limitations I would like to avoid: 1) a copied pair could not be added
--          to a gear train, because the userProp data would not be correct (i.e. not updated on clone); 2) building
--          execute strings can be ugly; and 3) executes are global and thus process slowly.
--          NOTE: Did NOT code required script controller changes for completing the gear train.
--    - v0.3 (06.14.2k):
--        - Added 'EVAL' notice on startup.
--        - Added 'softLock' to limit script usage period.
--        - Added text to 'Usage', 'Purpose', and 'Future Plans' in "Purpose/Usage/Comments/Quirks/FuturePlans..."
--        - Changes some spinner ranges and other default values.
--    - v0.21 (06.13.2k):
--        - Fixed bug encountered on 1st run due to argument error in 'makeGear'.
--    - v0.2 (06.12.2k):
--        - Rearranged UI slightly.
--        - Changed some defaults.
--        - Added 'Skip every other tooth' option.
--        - Modified "Align Pitch Cirles' code to align them better
--    - v0.1 (06.10.2k):
--        - 1st Beta version.
--          NOTE: Code was in Alpha for quite some time prior!
--        - Added scriptController-based animation!
--        - Added lots of documentation.
--        - Added "Purpose/Usage/Comments/Quirks/FuturePlans..." (currenly, just stubs, except "COMMENTS").
--        - Added "Processing Status:" and "Total Processing Time:" labels to UI.
--        - Added 'gearPairGroup' array to allow grouping of gears and related object.
--        - Added an axle.
--*****************************************************