(use-package :oli) ;; define a new license module: ;; revised 7-20-2005 revised module for bevel and bevel pinion gears. Changes include calculations for addendum and dedendum, and gear width ;; and mounting distance based on hub projection ;;(sd-define-licensing-module "Metric-GEARDESIGNER" ;; module name ;;"PENTENGR" ;; partner key ;;"GEARDSGN") ;; product key ;; create activation function which will be called, when module is activated: (defun Metric-GEARDESIGNER-activation-function (&rest args) (declare (ignore args)) (load "Metric-GEARDESIGNER")) ;; subscribe function to activation event: (sd-subscribe-event (sd-module-activation-event "Metric-GEARDESIGNER") #'Metric-GEARDESIGNER-activation-function) (defun CLEAR_VARIABLES_FUNCTION () (setq ADDENDUM nil) (setq BEVEL_HEEL_BACKLASH 0.0) (setq BEVEL_TOE_BACKLASH 0.0) (setq BEVEL_HEEL_CIRCULAR_THICKNESS nil) (setq BEVEL_HEEL_CHORDAL_THICKNESS nil) (setq BEVEL_TOE_CIRCULAR_THICKNESS nil) (setq BEVEL_TOE_CHORDAL_THICKNESS nil) (setq CIRCULAR_PITCH nil) (setq CIRCULAR_THICKNESS nil) (setq CLEARANCE nil) (setq CONE_DISTANCE nil) (setq DEDENDUM nil) (setq FACE_ANGLE nil) (setq FACE_WIDTH nil) (setq GEAR_CENTER_POINT nil) (setq OUTSIDE_DIAMETER nil) (setq PITCH_ANGLE nil) (setq PITCH_DIAMETER nil) (setq ROOT_ANGLE nil) (setq ROOT_CIRCLE_RADIUS nil) (setq ROOT_FILLET_RADIUS nil) (setq USERS_ADDENDUM nil) (setq USERS_BEVEL_HEEL_BACKLASH 0.0) (setq USERS_BEVEL_HEEL_CIRCULAR_THICKNESS nil) (setq USERS_BEVEL_HEEL_CHORDAL_THICKNESS nil) (setq USERS_BEVEL_TOE_BACKLASH 0.0) (setq USERS_BEVEL_TOE_CIRCULAR_THICKNESS nil) (setq USERS_BEVEL_TOE_CHORDAL_THICKNESS nil) (setq USERS_CIRCULAR_PITCH nil) (setq USERS_CIRCULAR_THICKNESS nil) (setq USERS_CONE_DISTANCE nil) (setq USERS_DEDENDUM nil) (setq USERS_FACE_WIDTH nil) (setq USERS_OUTSIDE_DIAMETER nil) (setq USERS_PITCH_DIAMETER nil) (setq USERS_WHOLE_DEPTH nil) (setq WHOLE_DEPTH nil) );defun ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun SPECIFIC_BEVEL_PARAMETERS_FUNCTION (NUMBER_OF_TEETH NUMBER_OF_PINION_TEETH MODE PITCH_ANGLE FACE_ANGLE GEAR_WIDTH PRESSURE_ANGLE MOUNTING_DISTANCE) ;-----This is set to 1.0 if this function is ran. Will be used later (after the user selects "OK" from the main menu) to determine if the values needed ;-----to create the bevel gear need to be calculated (that is, if the user did not select the "Specific Parameters" button). (setq SPECIFIC_BEVEL_PARAMETERS_FUNCTION_RAN 1.0) (setq USERS_INPUTTED_FACE_ANGLE FACE_ANGLE) (setq FACE_ANGLE (abs (- FACE_ANGLE PITCH_ANGLE))) (if (eq PITCH_DIAMETER nil) (progn (setq PITCH_DIAMETER (/ NUMBER_OF_TEETH ( / 1 MODE))) (setq INITIAL_PITCH_DIAMETER PITCH_DIAMETER) );progn );if (if (eq CIRCULAR_PITCH nil) (setq CIRCULAR_PITCH (/ pi ( / 1 MODE))) );if (if (eq CONE_DISTANCE nil) (setq CONE_DISTANCE (/ PITCH_DIAMETER (* 2.0 (sin (/ (* pi PITCH_ANGLE) 180.0))))) );if (if (eq ADDENDUM nil) (progn (setq A (/ 0.54 ( / 1 MODE))) (setq B (* (/ NUMBER_OF_TEETH NUMBER_OF_PINION_TEETH) (/ NUMBER_OF_TEETH NUMBER_OF_PINION_TEETH))) (setq ADDENDUM (/ 1 ( / 1 MODE))) (setq ORIGINALLY_CALCULATED_ADDENDUM ADDENDUM) );progn );if (if (eq DEDENDUM nil) (setq DEDENDUM (/ 1.157 ( / 1 MODE))) );if (progn (setq A (- MOUNTING_DISTANCE GEAR_WIDTH));-----Gives us the distance between the pitch apex to the front face (or toe end) of the gear (setq B (* CONE_DISTANCE (cos (oli:sd-deg-to-rad PITCH_ANGLE))));-----Gives us the horizontal (along centerline of gear) distance between the pitch apex and the pitch angle/pitch diameter (or back cone angle) intersection (setq C (- B A)) (setq FACE_WIDTH (/ C (cos (oli:sd-deg-to-rad PITCH_ANGLE)))) );progn (if (eq OUTSIDE_DIAMETER nil) (setq OUTSIDE_DIAMETER (+ PITCH_DIAMETER (* 2.0 (* ADDENDUM (cos (oli:sd-deg-to-rad PITCH_ANGLE)))))) );if (if (eq BEVEL_HEEL_CIRCULAR_THICKNESS nil) (progn (setq hk (/ 2.0 ( / 1 MODE))) (setq aP (- hk ADDENDUM)) (setq mG (/ NUMBER_OF_TEETH NUMBER_OF_PINION_TEETH)) (setq A (- (* 0.092 mG) 0.088)) (setq B (* 0.004 mG mG)) (setq C (* 0.0016 (- NUMBER_OF_PINION_TEETH 30) (- mG 1))) (setq K (+ (- A B) C)) (setq BEVEL_HEEL_CIRCULAR_THICKNESS (- (/ CIRCULAR_PITCH 2.0) (* (- aP ADDENDUM) (tan (oli:sd-deg-to-rad PRESSURE_ANGLE))) (/ K ( / 1 MODE)))) );progn );if (if (eq BEVEL_HEEL_CHORDAL_THICKNESS nil) (progn (setq A (/ (* BEVEL_HEEL_CIRCULAR_THICKNESS BEVEL_HEEL_CIRCULAR_THICKNESS BEVEL_HEEL_CIRCULAR_THICKNESS) (* 6.0 (* PITCH_DIAMETER PITCH_DIAMETER)))) (setq BEVEL_HEEL_CHORDAL_THICKNESS (- BEVEL_HEEL_CIRCULAR_THICKNESS A)) );progn );if (if (eq BEVEL_TOE_CIRCULAR_THICKNESS nil) (progn (setq A (* FACE_WIDTH (tan (oli:sd-deg-to-rad FACE_ANGLE)))) (setq B (- ADDENDUM A)) (setq SECOND_BEVEL_GEAR_2D_SCALE_FACTOR (/ B Addendum)) (setq BEVEL_TOE_CIRCULAR_THICKNESS (* BEVEL_HEEL_CIRCULAR_THICKNESS SECOND_BEVEL_GEAR_2D_SCALE_FACTOR)) ; (setq BEVEL_TOE_CIRCULAR_THICKNESS (* BEVEL_HEEL_CIRCULAR_THICKNESS (/ (- CONE_DISTANCE FACE_WIDTH) CONE_DISTANCE))) );progn );if (if (eq BEVEL_TOE_CHORDAL_THICKNESS nil) (progn (setq A (* FACE_WIDTH (tan (oli:sd-deg-to-rad FACE_ANGLE)))) (setq B (- ADDENDUM A)) (setq SECOND_BEVEL_GEAR_2D_SCALE_FACTOR (/ B Addendum)) (setq BEVEL_TOE_CHORDAL_THICKNESS (* BEVEL_HEEL_CHORDAL_THICKNESS SECOND_BEVEL_GEAR_2D_SCALE_FACTOR)) ; (setq BEVEL_TOE_CHORDAL_THICKNESS (* (/ (- CONE_DISTANCE FACE_WIDTH) CONE_DISTANCE) BEVEL_HEEL_CHORDAL_THICKNESS)) );progn );if (sd-defdialog 'specific_bevel_parameters_dialog :dialog-title "Specific Parameters" :toggle-type :wide-toggle :dialog-type :interrupt :toolbox-button t :initial-enable t :variables '( ;----------------Local Variables----------------; ("Specific Bevel Parameters") (USERS_PITCH_DIAMETER :value-type :number :title "Pitch Dia." :initial-value INITIAL_PITCH_DIAMETER :prompt-text "Enter the pitch diameter of the gear." :after-input (progn (setq USERS_CIRCULAR_PITCH (/ (* pi USERS_PITCH_DIAMETER) NUMBER_OF_TEETH)) (setq USERS_CONE_DISTANCE (/ USERS_PITCH_DIAMETER (* 2.0 (sin (/ (* pi PITCH_ANGLE) 180.0))))) (setq USERS_FACE_WIDTH (/ USERS_CONE_DISTANCE 3.0)) (setq USERS_BEVEL_HEEL_CHORDAL_THICKNESS (- USERS_BEVEL_HEEL_CIRCULAR_THICKNESS (/ (* USERS_BEVEL_HEEL_CIRCULAR_THICKNESS USERS_BEVEL_HEEL_CIRCULAR_THICKNESS USERS_BEVEL_HEEL_CIRCULAR_THICKNESS) (* 6.0 (* USERS_PITCH_DIAMETER USERS_PITCH_DIAMETER))) (/ USERS_BEVEL_HEEL_BACKLASH 2.0))) (setq USERS_BEVEL_TOE_CHORDAL_THICKNESS (* (/ (- USERS_CONE_DISTANCE USERS_FACE_WIDTH) USERS_CONE_DISTANCE) USERS_BEVEL_HEEL_CHORDAL_THICKNESS)) );progn ) (USERS_CIRCULAR_PITCH :value-type :display-only :title "Circ. Pitch" :initial-value CIRCULAR_PITCH) (USERS_CONE_DISTANCE :value-type :display-only :title "Cone Dist." :initial-value CONE_DISTANCE) (USERS_ADDENDUM :value-type :number :title "Addendum" :initial-value ADDENDUM :prompt-text "Enter the addendum of the gear.") (USERS_DEDENDUM :value-type :number :title "Dedendum" :initial-value DEDENDUM :prompt-text "Enter the dedendum of the gear.") (USERS_WHOLE_DEPTH :value-type :display-only :title "Whole Depth" :initial-value (+ 0.002 (/ 2.188 ( / 1 MODE)))) (USERS_FACE_WIDTH :value-type :display-only :title "Face Width" :initial-value FACE_WIDTH) (USERS_OUTSIDE_DIAMETER :value-type :number :title "Outside Dia." :initial-value OUTSIDE_DIAMETER) ("Heel End of Tooth") (USERS_BEVEL_HEEL_CIRCULAR_THICKNESS :value-type :display-only :title "Circ. Thick." :initial-value BEVEL_HEEL_CIRCULAR_THICKNESS) (USERS_BEVEL_HEEL_CHORDAL_THICKNESS :value-type :display-only :title "Chord. Thick." :initial-value BEVEL_HEEL_CHORDAL_THICKNESS) (USERS_BEVEL_HEEL_BACKLASH :value-type :number :title "Backlash" :initial-value BEVEL_HEEL_BACKLASH :after-input (progn (setq USERS_BEVEL_HEEL_CIRCULAR_THICKNESS (+ BEVEL_HEEL_CIRCULAR_THICKNESS (* 2.0 USERS_BEVEL_HEEL_BACKLASH))) (setq USERS_BEVEL_HEEL_CHORDAL_THICKNESS (- USERS_BEVEL_HEEL_CIRCULAR_THICKNESS (/ (* USERS_BEVEL_HEEL_CIRCULAR_THICKNESS USERS_BEVEL_HEEL_CIRCULAR_THICKNESS USERS_BEVEL_HEEL_CIRCULAR_THICKNESS) (* 6.0 (* USERS_PITCH_DIAMETER USERS_PITCH_DIAMETER))) (/ USERS_BEVEL_HEEL_BACKLASH 2.0))) );progn :prompt-text "Enter the backlash for the heel of the gear.") ("Toe End of Tooth") (USERS_BEVEL_TOE_CIRCULAR_THICKNESS :value-type :display-only :title "Circ. Thick." :initial-value BEVEL_TOE_CIRCULAR_THICKNESS) ; :prompt-text "Enter the circular thickness (at the pitch diameter) for the toe of the gear.") (USERS_BEVEL_TOE_CHORDAL_THICKNESS :value-type :display-only :title "Chord. Thick." :initial-value BEVEL_TOE_CHORDAL_THICKNESS) (USERS_BEVEL_TOE_BACKLASH :value-type :number :title "Backlash" :initial-value BEVEL_TOE_BACKLASH :after-input (progn (setq USERS_BEVEL_TOE_CIRCULAR_THICKNESS (+ BEVEL_TOE_CIRCULAR_THICKNESS (* 2.0 USERS_BEVEL_TOE_BACKLASH))) ; (setq D (* (- USERS_CONE_DISTANCE USERS_FACE_WIDTH) (sin (oli:sd-deg-to-rad PITCH_ANGLE)) 2.0)) (setq D (* USERS_PITCH_DIAMETER SECOND_BEVEL_GEAR_2D_SCALE_FACTOR)) (setq USERS_BEVEL_TOE_CHORDAL_THICKNESS (- USERS_BEVEL_TOE_CIRCULAR_THICKNESS (/ (* USERS_BEVEL_TOE_CIRCULAR_THICKNESS USERS_BEVEL_TOE_CIRCULAR_THICKNESS USERS_BEVEL_TOE_CIRCULAR_THICKNESS) (* 6.0 (* D D))) (/ USERS_BEVEL_TOE_BACKLASH 2.0))) );progn :prompt-text "Enter the backlash for the toe of the gear.") ) :ok-action '(progn (setq USERS_INPUTTED_PITCH_DIAMETER USERS_PITCH_DIAMETER) (setq PITCH_DIAMETER (* 2.0 (/ (/ USERS_PITCH_DIAMETER 2.0) (sin (oli:sd-deg-to-rad (- 90.0 PITCH_ANGLE)))))) (setq INITIAL_PITCH_DIAMETER USERS_PITCH_DIAMETER) (setq CIRCULAR_PITCH USERS_CIRCULAR_PITCH) (setq CONE_DISTANCE USERS_CONE_DISTANCE) (setq ADDENDUM USERS_ADDENDUM) (setq DEDENDUM USERS_DEDENDUM) (setq WHOLE_DEPTH USERS_WHOLE_DEPTH) (setq FACE_WIDTH USERS_FACE_WIDTH) (setq OUTSIDE_DIAMETER USERS_OUTSIDE_DIAMETER) (setq BEVEL_HEEL_CIRCULAR_THICKNESS USERS_BEVEL_HEEL_CIRCULAR_THICKNESS) (setq BEVEL_HEEL_CHORDAL_THICKNESS USERS_BEVEL_HEEL_CHORDAL_THICKNESS) (setq BEVEL_TOE_CIRCULAR_THICKNESS USERS_BEVEL_TOE_CIRCULAR_THICKNESS) (setq BEVEL_TOE_CHORDAL_THICKNESS USERS_BEVEL_TOE_CHORDAL_THICKNESS) (setq BEVEL_HEEL_BACKLASH USERS_BEVEL_HEEL_BACKLASH) (setq BEVEL_TOE_BACKLASH USERS_BEVEL_TOE_BACKLASH) (setq USERS_INPUTTED_BEVEL_TOE_BACKLASH USERS_BEVEL_TOE_BACKLASH) );progn );sd-defdialog );defun ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun SPECIFIC_PINION_PARAMETERS_FUNCTION (NUMBER_OF_BEVEL_TEETH NUMBER_OF_TEETH MODE PITCH_ANGLE FACE_ANGLE GEAR_WIDTH PRESSURE_ANGLE MOUNTING_DISTANCE) (setq USERS_INPUTTED_FACE_ANGLE FACE_ANGLE) (setq FACE_ANGLE (abs (- FACE_ANGLE PITCH_ANGLE))) (if (eq PITCH_DIAMETER nil) (progn (setq PITCH_DIAMETER (/ NUMBER_OF_TEETH ( / 1 MODE))) (setq INITIAL_PITCH_DIAMETER PITCH_DIAMETER) );progn );if (if (eq CIRCULAR_PITCH nil) (setq CIRCULAR_PITCH (/ (* pi PITCH_DIAMETER) NUMBER_OF_TEETH)) );if (if (eq CONE_DISTANCE nil) (setq CONE_DISTANCE (/ PITCH_DIAMETER (* 2.0 (sin (/ (* pi PITCH_ANGLE) 180.0))))) );if (if (eq ADDENDUM nil) (progn (setq A (+ (/ 0.54 ( / 1 MODE)) (/ 0.46 (* ( / 1 MODE) (* (/ NUMBER_OF_BEVEL_TEETH NUMBER_OF_TEETH) (/ NUMBER_OF_BEVEL_TEETH NUMBER_OF_TEETH)))))) (setq ADDENDUM (/ 1 ( / 1 MODE))) (setq ORIGINALLY_CALCULATED_ADDENDUM ADDENDUM) );progn );if (if (eq DEDENDUM nil) (setq DEDENDUM (/ 1.157 ( / 1 MODE))) );if (progn (setq A (- MOUNTING_DISTANCE GEAR_WIDTH));-----Gives us the distance between the pitch apex to the front face (or toe end) of the gear (setq B (* CONE_DISTANCE (cos (oli:sd-deg-to-rad PITCH_ANGLE))));-----Gives us the horizontal (along centerline of gear) distance between the pitch apex and the pitch angle/pitch diameter (or back cone angle) intersection (setq C (- B A)) (setq FACE_WIDTH (/ C (cos (oli:sd-deg-to-rad PITCH_ANGLE)))) );progn (if (eq OUTSIDE_DIAMETER nil) (setq OUTSIDE_DIAMETER (+ PITCH_DIAMETER (* 2.0 (* ADDENDUM (cos (oli:sd-deg-to-rad PITCH_ANGLE)))))) );if (if (eq BEVEL_HEEL_CIRCULAR_THICKNESS nil) (progn (setq aG (+ (/ 0.54 ( / 1 MODE)) (/ 0.46 (* ( / 1 MODE) (* (/ NUMBER_OF_BEVEL_TEETH NUMBER_OF_TEETH) (/ NUMBER_OF_BEVEL_TEETH NUMBER_OF_TEETH)))))) (setq hk (/ 2.0 ( / 1 MODE))) (setq aP (- hk aG)) (setq mG (/ NUMBER_OF_BEVEL_TEETH NUMBER_OF_TEETH)) (setq A (- (* 0.092 mG) 0.088)) (setq B (* 0.004 mG mG)) (setq C (* 0.0016 (- NUMBER_OF_TEETH 30) (- mG 1))) (setq K (+ (- A B) C)) (setq BEVEL_GEAR_HEEL_CIRCULAR_THICKNESS (- (/ CIRCULAR_PITCH 2.0) (* (- aP aG) (tan (oli:sd-deg-to-rad PRESSURE_ANGLE))) (/ K ( / 1 MODE)))) (setq BEVEL_HEEL_CIRCULAR_THICKNESS (- CIRCULAR_PITCH BEVEL_GEAR_HEEL_CIRCULAR_THICKNESS)) (setq ORIGINALLY_CALCULATED_BEVEL_HEEL_CIRCULAR_THICKNESS BEVEL_HEEL_CIRCULAR_THICKNESS) );progn );if (if (eq BEVEL_HEEL_CHORDAL_THICKNESS nil) (progn (setq A (/ BEVEL_HEEL_CIRCULAR_THICKNESS PITCH_DIAMETER));-----gives results in radians:) (setq SIN_OF_A (sin A)) (setq BEVEL_HEEL_CHORDAL_THICKNESS (* 2.0 (/ PITCH_DIAMETER 2.0) SIN_OF_A)) );progn );if (if (eq BEVEL_TOE_CIRCULAR_THICKNESS nil) (progn (setq A (* FACE_WIDTH (tan (oli:sd-deg-to-rad FACE_ANGLE)))) (setq B (- ADDENDUM A)) (setq SECOND_BEVEL_GEAR_2D_SCALE_FACTOR (/ B Addendum)) (setq BEVEL_TOE_CIRCULAR_THICKNESS (* BEVEL_HEEL_CIRCULAR_THICKNESS SECOND_BEVEL_GEAR_2D_SCALE_FACTOR)) );progn );if (if (eq BEVEL_TOE_CHORDAL_THICKNESS nil) (progn (setq A (* FACE_WIDTH (tan (oli:sd-deg-to-rad FACE_ANGLE)))) (setq B (- ADDENDUM A)) (setq SECOND_BEVEL_GEAR_2D_SCALE_FACTOR (/ B Addendum)) (setq BEVEL_TOE_CHORDAL_THICKNESS (* BEVEL_HEEL_CHORDAL_THICKNESS SECOND_BEVEL_GEAR_2D_SCALE_FACTOR)) );progn );if (if (eq OUTSIDE_DIAMETER nil) (setq OUTSIDE_DIAMETER (+ PITCH_DIAMETER (* 2.0 (* ADDENDUM (cos (oli:sd-deg-to-rad PITCH_ANGLE)))))) );if (sd-defdialog 'specific_pinion_parameters_dialog :dialog-title "Specific Parameters" :toggle-type :wide-toggle :dialog-type :interrupt :toolbox-button nil :initial-enable t :variables '( ;----------------Local Variables----------------; ("Specific Pinion Parameters") (USERS_PITCH_DIAMETER :value-type :number :title "Pitch Dia." :initial-value INITIAL_PITCH_DIAMETER :prompt-text "Enter the pitch diameter of the gear." :after-input (progn (setq USERS_CIRCULAR_PITCH (/ (* pi USERS_PITCH_DIAMETER) NUMBER_OF_TEETH)) (setq USERS_CONE_DISTANCE (/ USERS_PITCH_DIAMETER (* 2.0 (sin (/ (* pi PITCH_ANGLE) 180.0))))) (setq USERS_FACE_WIDTH (/ USERS_CONE_DISTANCE 3.0)) ; (progn ; (setq A (/ USERS_BEVEL_HEEL_CIRCULAR_THICKNESS USERS_PITCH_DIAMETER));-----gives results in radians:) ; (setq A (/ 90.0 NUMBER_OF_TEETH)) ; (setq SIN_OF_A (sin A)) ; (setq USERS_BEVEL_HEEL_CHORDAL_THICKNESS (* 2.0 (/ USERS_PITCH_DIAMETER 2.0) SIN_OF_A)) ; );progn (setq USERS_BEVEL_HEEL_CHORDAL_THICKNESS (- USERS_BEVEL_HEEL_CIRCULAR_THICKNESS (/ (* USERS_BEVEL_HEEL_CIRCULAR_THICKNESS USERS_BEVEL_HEEL_CIRCULAR_THICKNESS USERS_BEVEL_HEEL_CIRCULAR_THICKNESS) (* 6.0 (* USERS_PITCH_DIAMETER USERS_PITCH_DIAMETER))) (/ USERS_BEVEL_HEEL_BACKLASH 2.0))) (setq USERS_BEVEL_TOE_CHORDAL_THICKNESS (* (/ (- USERS_CONE_DISTANCE USERS_FACE_WIDTH) USERS_CONE_DISTANCE) USERS_BEVEL_HEEL_CHORDAL_THICKNESS)) );progn ) (USERS_CIRCULAR_PITCH :value-type :display-only :title "Circ. Pitch" :initial-value CIRCULAR_PITCH) ; :prompt-text "Enter the circular pitch of the gear.") (USERS_CONE_DISTANCE :value-type :display-only :title "Cone Dist." :initial-value CONE_DISTANCE) (USERS_ADDENDUM :value-type :number :title "Addendum" :initial-value ADDENDUM :prompt-text "Enter the addendum of the gear.") (USERS_DEDENDUM :value-type :number :title "Dedendum" :initial-value DEDENDUM :prompt-text "Enter the dedendum of the gear.") (USERS_WHOLE_DEPTH :value-type :display-only :title "Whole Depth" :initial-value (+ 0.002 (/ 2.188 ( / 1 MODE)))) (USERS_FACE_WIDTH :value-type :display-only :title "Face Width" :initial-value FACE_WIDTH) (USERS_OUTSIDE_DIAMETER :value-type :number :title "Outside Dia." :initial-value OUTSIDE_DIAMETER) ("Heel End of Tooth") (USERS_BEVEL_HEEL_CIRCULAR_THICKNESS :value-type :display-only :title "Circ. Thick." :initial-value BEVEL_HEEL_CIRCULAR_THICKNESS) ; :prompt-text "Enter the circular thickness (at the pitch diameter) for the heel of the gear.") (USERS_BEVEL_HEEL_CHORDAL_THICKNESS :value-type :display-only :title "Chord. Thick." :initial-value BEVEL_HEEL_CHORDAL_THICKNESS) (USERS_BEVEL_HEEL_BACKLASH :value-type :number :title "Backlash" :initial-value BEVEL_HEEL_BACKLASH :after-input (progn (setq USERS_BEVEL_HEEL_CIRCULAR_THICKNESS (+ BEVEL_HEEL_CIRCULAR_THICKNESS (* 2.0 USERS_BEVEL_HEEL_BACKLASH))) (setq USERS_BEVEL_HEEL_CHORDAL_THICKNESS (- USERS_BEVEL_HEEL_CIRCULAR_THICKNESS (/ (* USERS_BEVEL_HEEL_CIRCULAR_THICKNESS USERS_BEVEL_HEEL_CIRCULAR_THICKNESS USERS_BEVEL_HEEL_CIRCULAR_THICKNESS) (* 6.0 (* USERS_PITCH_DIAMETER USERS_PITCH_DIAMETER))) (/ USERS_BEVEL_HEEL_BACKLASH 2.0))) );progn :prompt-text "Enter the backlash for the heel of the gear.") ("Toe End of Tooth") (USERS_BEVEL_TOE_CIRCULAR_THICKNESS :value-type :display-only :title "Circ. Thick." :initial-value BEVEL_TOE_CIRCULAR_THICKNESS) ; :prompt-text "Enter the circular thickness (at the pitch diameter) for the toe of the gear.") (USERS_BEVEL_TOE_CHORDAL_THICKNESS :value-type :display-only :title "Chord. Thick." :initial-value BEVEL_TOE_CHORDAL_THICKNESS) (USERS_BEVEL_TOE_BACKLASH :value-type :number :title "Backlash" :initial-value BEVEL_TOE_BACKLASH :after-input (progn (setq USERS_BEVEL_TOE_CIRCULAR_THICKNESS (+ BEVEL_TOE_CIRCULAR_THICKNESS (* 2.0 USERS_BEVEL_TOE_BACKLASH))) ; (setq D (* (- USERS_CONE_DISTANCE USERS_FACE_WIDTH) (sin (oli:sd-deg-to-rad PITCH_ANGLE)) 2.0)) (setq D (* USERS_PITCH_DIAMETER SECOND_BEVEL_GEAR_2D_SCALE_FACTOR)) (setq USERS_BEVEL_TOE_CHORDAL_THICKNESS (- USERS_BEVEL_TOE_CIRCULAR_THICKNESS (/ (* USERS_BEVEL_TOE_CIRCULAR_THICKNESS USERS_BEVEL_TOE_CIRCULAR_THICKNESS USERS_BEVEL_TOE_CIRCULAR_THICKNESS) (* 6.0 (* D D))) (/ USERS_BEVEL_TOE_BACKLASH 2.0))) );progn :prompt-text "Enter the backlash for the toe of the gear.") ) :ok-action '(progn (setq USERS_INPUTTED_PITCH_DIAMETER USERS_PITCH_DIAMETER) (setq PITCH_DIAMETER (* 2.0 (/ (/ USERS_PITCH_DIAMETER 2.0) (sin (oli:sd-deg-to-rad (- 90.0 PITCH_ANGLE)))))) (setq INITIAL_PITCH_DIAMETER USERS_PITCH_DIAMETER) (setq CIRCULAR_PITCH USERS_CIRCULAR_PITCH) (setq CONE_DISTANCE USERS_CONE_DISTANCE) (setq ADDENDUM USERS_ADDENDUM) (setq DEDENDUM USERS_DEDENDUM) (setq WHOLE_DEPTH USERS_WHOLE_DEPTH) (setq FACE_WIDTH USERS_FACE_WIDTH) (setq OUTSIDE_DIAMETER USERS_OUTSIDE_DIAMETER) (setq BEVEL_HEEL_CIRCULAR_THICKNESS USERS_BEVEL_HEEL_CIRCULAR_THICKNESS) (setq BEVEL_HEEL_CHORDAL_THICKNESS USERS_BEVEL_HEEL_CHORDAL_THICKNESS) (setq BEVEL_TOE_CIRCULAR_THICKNESS USERS_BEVEL_TOE_CIRCULAR_THICKNESS) (setq BEVEL_TOE_CHORDAL_THICKNESS USERS_BEVEL_TOE_CHORDAL_THICKNESS) (setq BEVEL_HEEL_BACKLASH USERS_BEVEL_HEEL_BACKLASH) (setq BEVEL_TOE_BACKLASH USERS_BEVEL_TOE_BACKLASH) (setq USERS_INPUTTED_BEVEL_TOE_BACKLASH USERS_BEVEL_TOE_BACKLASH) );progn );sd-defdialog );defun ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (CLEAR_VARIABLES_FUNCTION) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (sd-defdialog 'Metric-GEARDESIGNER :dialog-title "Metric-GEARDESIGNER v1.6" :toolbox-button t :toggle-type :wide-toggle ;;;;;;;;;; :module "Metric-GEARDESIGNER" :variables '( (SELECTED_WP :value-type :wp :title "Workplane" :prompt-text "Identify workplane for gear construction.") ("Parameters") (TYPE_OF_GEAR :title "Gear Type" :expand-shrink ((NUMBER_OF_TEETH MODE PRESSURE_ANGLE) (NUMBER_OF_TEETH MODE PRESSURE_ANGLE HELIX_ANGLE) (NUMBER_OF_BEVEL_TEETH NUMBER_OF_PINION_TEETH MODE PRESSURE_ANGLE PITCH_ANGLE FACE_ANGLE ROOT_ANGLE NUMBER_OF_TEETH_DISPLAY LINE MOUNTING_DISTANCE) (NUMBER_OF_BEVEL_TEETH NUMBER_OF_PINION_TEETH MODE PRESSURE_ANGLE PITCH_ANGLE FACE_ANGLE ROOT_ANGLE NUMBER_OF_TEETH_DISPLAY LINE MOUNTING_DISTANCE)) :expand-shrink-range ((:SPUR :label "Spur") (:HELICAL :label "Helical") (:BEVEL :label "Bevel") (:PINION :label "Pinion"))) (UNITS :range ((:Inch :label "Inch") (:MM :label "MM")) :title "Units" :initial-value :MM :prompt-text "Select the units in which to create gear.") (NUMBER_OF_TEETH_DISPLAY :title "Number of Teeth") (NUMBER_OF_TEETH :value-type :integer :check-function #'(lambda (new-value) (if (> new-value 3) :ok (values :error "The number of teeth must be an integer greater than 3."))) :title "# Of Teeth" :prompt-text "Enter the number of teeth on gear.") (NUMBER_OF_BEVEL_TEETH :value-type :integer :check-function #'(lambda (new-value) (if (> new-value 3) :ok (values :error "The number of teeth must be an integer greater than 3."))) :title "Bevel Teeth" :prompt-text "Enter the number of teeth on bevel gear.") (NUMBER_OF_PINION_TEETH :value-type :integer :check-function #'(lambda (new-value) (if (> new-value 3) :ok (values :error "The number of teeth must be an integer greater than 3."))) :title "Pinion Teeth" :prompt-text "Enter the number of teeth on bevel pinion.") (LINE :title "-") (MODE :value-type :number :check-function #'(lambda (new-value) (if (> new-value 0) :ok (values :error "The Module must be an integer greater than 0."))) :title "Module" :prompt-text "Enter the module of gear.") (PRESSURE_ANGLE :value-type :number :title "Press. Angle" :prompt-text "Enter the pressure angle of gear.") (HELIX_ANGLE :value-type :number :optional t :title "Helix Angle" :prompt-text "Enter the helix angle of the gear (in degrees).") (PITCH_ANGLE :value-type :number :check-function #'(lambda (new-value) (if (> new-value 0) :ok (values :error "The pitch angle must be an number greater than 0."))) ; :optional t :title "Pitch Angle" :prompt-text "Enter the pitch angle of the gear (in degrees).") (FACE_ANGLE :value-type :number :check-function #'(lambda (new-value) (if (> new-value 0) :ok (values :error "The face angle must be an number greater than 0."))) :title "Face Angle" :prompt-text "Enter the face angle of the gear (in degrees).") (ROOT_ANGLE :value-type :number :check-function #'(lambda (new-value) (if (> new-value 0) :ok (values :error "The root angle must be an number greater than 0."))) :title "Root Angle" :prompt-text "Enter the root angle of the gear (in degrees).") (MOUNTING_DISTANCE :value-type :number :check-function #'(lambda (new-value) (if (>= new-value 0) :ok (values :error "The mounting distance must be a number greater than 0."))) :title "Mount. Dist." :prompt-text "Enter the mounting distance.") (GEAR_WIDTH :value-type :number :check-function #'(lambda (new-value) (if (>= new-value 0) :ok (values :error "The gear width must be a number greater than 0."))) :title "Gear Width" :prompt-text "Enter the width of gear.") ("Bore") (BORE_DIAMETER :value-type :number :check-function #'(lambda (new-value) (if (>= new-value 0) :ok (values :error "The bore diameter cannot be less than 0."))) :initial-value 0 :title "Diameter" :prompt-text "Enter the bore diameter of gear.") ("Hub") (HUB_DIAMETER :value-type :number :check-function #'(lambda (new-value) (if (>= new-value 0) :ok (values :error "The hub diameter cannot be less than 0.")) (if (>= new-value BORE_DIAMETER) :ok (values :error "The hub diameter cannot be less than or equal to the bore diameter."))) :initial-value 0 :title "Diameter" :prompt-text "Enter the hub diameter of gear.") (HUB_PROJECTION :value-type :number :check-function #'(lambda (new-value) (if (>= new-value 0) :ok (values :error "The hub projection cannot be less than 0."))) :initial-value 0 :title "Projection" :prompt-text "Enter the hub projection of gear.") ("Keyway") (KEYWAY_WIDTH :value-type :number :initial-value 0 :title "Width" :prompt-text "Enter the keyway width of gear.") (KEYWAY_DEPTH :value-type :number :initial-value 0 :title "Depth" :prompt-text "Enter the keyway depth of gear.") (NO_OF_KEYS :value-type :integer :check-function #'(lambda (new-value) (if (<= 0 new-value 2) :ok (values :error "The number of keys must be between 0 and 2."))) :initial-value 1 :title "Number Of" :prompt-text "Enger the number of keyways in gear (1 or 2).") ("Specific Parameters") (SPECIFIC_PARAMETERS :title "Specific Parameters" :toggle-type :wide-toggle :push-action (progn (if (eq MODE nil) (sd-display-error (format nil "You must supply a mode.")) );if (unless (eq MODE nil) (progn (cond ;;;;Commented out 00dec06 ((string= TYPE_OF_GEAR "SPUR") ;;;;No functions defined (progn ; (SPECIFIC_SPUR_PARAMETERS_FUNCTION NUMBER_OF_TEETH MODE) ; (set_pers_context SPECIFIC_SPUR_PARAMETERS_DIALOG) ; );progn ; );string= ; ; ((string= TYPE_OF_GEAR "HELICAL") ; (progn ; (SPECIFIC_HELICAL_PARAMETERS_FUNCTION NUMBER_OF_TEETH MODE) ; (set_pers_context SPECIFIC_HELICAL_PARAMETERS_DIALOG) ; );progn ; );string= ((string= TYPE_OF_GEAR "BEVEL") (progn (if (eq PRESSURE_ANGLE nil) (sd-display-error (format nil "You must supply a pressure angle.")) );if (if (eq PITCH_ANGLE nil) (sd-display-error (format nil "You must supply a pitch angle.")) );if (if (eq GEAR_WIDTH nil) (sd-display-error (format nil "You must supply a gear width.")) );if (if (eq MOUNTING_DISTANCE nil) (sd-display-error (format nil "You must supply a mounting distance.")) );if (if (eq NUMBER_OF_BEVEL_TEETH nil) (sd-display-error (format nil "You must supply the number of bevel gear teeth.")) );if (if (eq NUMBER_OF_PINION_TEETH nil) (sd-display-error (format nil "You must supply the number of bevel pinion teeth.")) );if (unless (or (eq PITCH_ANGLE nil) (eq NUMBER_OF_BEVEL_TEETH nil) (eq NUMBER_OF_PINION_TEETH nil)) (SPECIFIC_BEVEL_PARAMETERS_FUNCTION NUMBER_OF_BEVEL_TEETH NUMBER_OF_PINION_TEETH MODE PITCH_ANGLE FACE_ANGLE GEAR_WIDTH PRESSURE_ANGLE MOUNTING_DISTANCE) (set_pers_context SPECIFIC_BEVEL_PARAMETERS_DIALOG) );unless );progn );string= ((string= TYPE_OF_GEAR "PINION") (progn (if (eq PRESSURE_ANGLE nil) (sd-display-error (format nil "You must supply a pressure angle.")) );if (if (eq PITCH_ANGLE nil) (sd-display-error (format nil "You must supply a pitch angle.")) );if (if (eq GEAR_WIDTH nil) (sd-display-error (format nil "You must supply a gear width.")) );if (if (eq MOUNTING_DISTANCE nil) (sd-display-error (format nil "You must supply a mounting distance.")) );if (if (eq NUMBER_OF_BEVEL_TEETH nil) (sd-display-error (format nil "You must supply the number of bevel gear teeth.")) );if (if (eq NUMBER_OF_PINION_TEETH nil) (sd-display-error (format nil "You must supply the number of bevel pinion teeth.")) );if (unless (or (eq PITCH_ANGLE nil) (eq NUMBER_OF_BEVEL_TEETH nil) (eq NUMBER_OF_PINION_TEETH nil)) (SPECIFIC_PINION_PARAMETERS_FUNCTION NUMBER_OF_BEVEL_TEETH NUMBER_OF_PINION_TEETH MODE PITCH_ANGLE FACE_ANGLE GEAR_WIDTH PRESSURE_ANGLE MOUNTING_DISTANCE) (set_pers_context SPECIFIC_PINION_PARAMETERS_DIALOG) );unless );progn );string= );cond );progn );unless )) ("Gear Center Point") (GEAR_CENTER_POINT :value-type :point-3d :title "Gear Center Point" :prompt-text "Specify the center point (3D) of gear.") ) :ok-action-precondition :ok :cleanup-action '(CLEAR_VARIABLES_FUNCTION) :ok-action ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; '(progn (let ((initial-state (sd-set-model-checkpoint)) (error nil)) (if (and (string= HELIX_ANGLE nil) (string= TYPE_OF_GEAR "HELICAL")) (setq error t) );if (when error (sd-display-error (format nil "You must supply a helix angle.")) (sd-return-from-ok-action))) (let ((initial-state (sd-set-model-checkpoint)) (error nil)) (unless GEAR_CENTER_POINT (setq error t) );unless (when error (sd-display-error (format nil "You must supply a center point of the gear.")) (sd-return-from-ok-action))) ;-----For moving the completed bevel gear, SolidDesigner requires a 3D to and from point. However, the rest of the program only requires 2D ;-----points (ie. for moving the gears to the user-specified center point). Therefore, we will create a variable GEAR_CENTER_POINT_3D which ;-----will have the same 3D points as the original GEAR_CENTER_POINT variable, and save the variable GEAR_CENTER_POINT with only the X and Y ;-----coordinates as follows: (setq GEAR_CENTER_POINT_3D GEAR_CENTER_POINT) (setq GEAR_CENTER_POINT_2D (sd-gpnt3d-to-2d GEAR_CENTER_POINT)) (ecase TYPE_OF_GEAR;-----evaluates the value of "TYPE_OF_GEAR" (:SPUR;-----If a SPUR gear was choose (progn (setq ADDENDUM (/ 1.0 ( / 1 MODE))) (setq PITCH_DIAMETER (/ NUMBER_OF_TEETH ( / 1 MODE))) (setq DEDENDUM (/ 1.25 ( / 1 MODE))) (setq CLEARANCE (- DEDENDUM ADDENDUM)) (setq ROOT_FILLET_RADIUS (/ 0.157 ( / 1 MODE))) (setq ROOT_CIRCLE_RADIUS (- (/ PITCH_DIAMETER 2.0) DEDENDUM)) (setq PITCH_CIRCLE_RADIUS (/ PITCH_DIAMETER 2.0)) (setq ADDENDUM_CIRCLE_RADIUS (+ PITCH_CIRCLE_RADIUS ADDENDUM)) (setq GEAR_ANGLE (/ 360.0 (* 2.0 NUMBER_OF_TEETH))) (setq BASE_CIRCLE_RADIUS (* (/ PITCH_DIAMETER 2.0) (sin (* (/ (- 90.0 PRESSURE_ANGLE) 180.0) pi)))) (setq CIRCULAR_PITCH (/ (* pi PITCH_DIAMETER) NUMBER_OF_TEETH)) (setq CIRCULAR_THICKNESS (/ CIRCULAR_PITCH 2.0)) (setq PRESSURE_ANGLE_IN_RADIANS (/ (* PRESSURE_ANGLE pi) 180.0)) (setq TAN_OF_PRESSURE_ANGLE_IN_RADIANS (tan PRESSURE_ANGLE_IN_RADIANS)) (setq INV_OF_PRESSURE_ANGLE (- TAN_OF_PRESSURE_ANGLE_IN_RADIANS (* pi (/ PRESSURE_ANGLE 180.0))));inv1 );progn );:SPUR (:HELICAL;-------If a HELICAL gear was choose (progn (setq ADDENDUM (/ 1.0 ( / 1 MODE))) ;-----The PITCH_DIAMETER calculation is the only calculation different than that of a spur gear (setq PITCH_DIAMETER (/ NUMBER_OF_TEETH (* ( / 1 MODE) (cos (/ (* pi HELIX_ANGLE) 180.0))))) (setq DEDENDUM (/ 1.25 ( / 1 MODE))) (setq CLEARANCE (- DEDENDUM ADDENDUM)) (setq ROOT_FILLET_RADIUS (/ 0.157 ( / 1 MODE))) (setq ROOT_CIRCLE_RADIUS (- (/ PITCH_DIAMETER 2.0) DEDENDUM)) (setq PITCH_CIRCLE_RADIUS (/ PITCH_DIAMETER 2.0)) (setq ADDENDUM_CIRCLE_RADIUS (+ PITCH_CIRCLE_RADIUS ADDENDUM)) (setq GEAR_ANGLE (/ 360.0 (* 2.0 NUMBER_OF_TEETH))) (setq BASE_CIRCLE_RADIUS (* (/ PITCH_DIAMETER 2.0) (sin (* (/ (- 90.0 PRESSURE_ANGLE) 180.0) pi)))) (setq CIRCULAR_PITCH (/ (* pi PITCH_DIAMETER) NUMBER_OF_TEETH)) (setq CIRCULAR_THICKNESS (/ CIRCULAR_PITCH 2.0)) (setq PRESSURE_ANGLE_IN_RADIANS (/ (* PRESSURE_ANGLE pi) 180.0)) (setq TAN_OF_PRESSURE_ANGLE_IN_RADIANS (tan PRESSURE_ANGLE_IN_RADIANS)) (setq INV_OF_PRESSURE_ANGLE (- TAN_OF_PRESSURE_ANGLE_IN_RADIANS (* pi (/ PRESSURE_ANGLE 180.0))));inv1 );progn );:HELICAL (:BEVEL;-------If a BEVEL GEAR was choose (progn (setq NUMBER_OF_TEETH NUMBER_OF_BEVEL_TEETH) (setq GEAR_WIDTH (- GEAR_WIDTH HUB_PROJECTION)) (setq MOUNTING_DISTANCE (- MOUNTING_DISTANCE HUB_PROJECTION)) (if (eq PITCH_DIAMETER nil) (setq PITCH_DIAMETER (* 2.0 (/ (/ (/ NUMBER_OF_TEETH ( / 1 MODE)) 2.0) (sin (oli:sd-deg-to-rad (- 90.0 PITCH_ANGLE)))))) );if (if (eq CIRCULAR_PITCH nil) (setq CIRCULAR_PITCH (/ pi ( / 1 MODE))) );if (if (eq CONE_DISTANCE nil) (setq CONE_DISTANCE (/ PITCH_DIAMETER (* 2.0 (sin (/ (* pi PITCH_ANGLE) 180.0))))) );if (if (eq ADDENDUM nil) (progn (setq A (/ 0.54 ( / 1 MODE))) (setq B (* (/ NUMBER_OF_TEETH NUMBER_OF_PINION_TEETH) (/ NUMBER_OF_TEETH NUMBER_OF_PINION_TEETH))) (setq ADDENDUM (/ 1 ( / 1 MODE))) );progn );if (if (eq DEDENDUM nil) (setq DEDENDUM (/ 1.157 ( / 1 MODE))) );if (if (eq FACE_WIDTH nil) (progn (setq A (- MOUNTING_DISTANCE GEAR_WIDTH));-----Gives us the distance between the pitch apex to the front face (or toe end) of the gear (setq B (* CONE_DISTANCE (cos (oli:sd-deg-to-rad PITCH_ANGLE))));-----Gives us the horizontal (along centerline of gear) distance between the pitch apex and the pitch angle/pitch diameter (or back cone angle) intersection (setq C (- B A)) (setq FACE_WIDTH (/ C (cos (oli:sd-deg-to-rad PITCH_ANGLE)))) );progn );if (if (eq OUTSIDE_DIAMETER nil) (setq OUTSIDE_DIAMETER (+ PITCH_DIAMETER (* 2.0 (* ADDENDUM (cos (oli:sd-deg-to-rad PITCH_ANGLE)))))) );if (if (eq BEVEL_HEEL_CIRCULAR_THICKNESS nil) (progn (setq aG (+ (/ 0.54 ( / 1 MODE)) (/ 0.46 (* ( / 1 MODE) (* (/ NUMBER_OF_BEVEL_TEETH NUMBER_OF_TEETH) (/ NUMBER_OF_BEVEL_TEETH NUMBER_OF_TEETH)))))) (setq hk (/ 2.0 ( / 1 MODE))) (setq aP (- hk ADDENDUM)) (setq mG (/ NUMBER_OF_TEETH NUMBER_OF_PINION_TEETH)) (setq A (- (* 0.092 mG) 0.088)) (setq B (* 0.004 mG mG)) (setq C (* 0.0016 (- NUMBER_OF_PINION_TEETH 30) (- mG 1))) (setq K (+ (- A B) C)) (setq BEVEL_HEEL_CIRCULAR_THICKNESS (- (/ CIRCULAR_PITCH 2.0) (* (- aP aG) (tan (oli:sd-deg-to-rad PRESSURE_ANGLE))) (/ K ( / 1 MODE)))) );progn );if (if (eq BEVEL_HEEL_CHORDAL_THICKNESS nil) (progn (setq A (/ (* BEVEL_HEEL_CIRCULAR_THICKNESS BEVEL_HEEL_CIRCULAR_THICKNESS BEVEL_HEEL_CIRCULAR_THICKNESS) (* 6.0 (* PITCH_DIAMETER PITCH_DIAMETER)))) (setq BEVEL_HEEL_CHORDAL_THICKNESS (- BEVEL_HEEL_CIRCULAR_THICKNESS A)) );progn );if (if (eq BEVEL_TOE_CIRCULAR_THICKNESS nil) (progn (setq A (* FACE_WIDTH (tan (oli:sd-deg-to-rad FACE_ANGLE)))) (setq B (- ADDENDUM A)) (setq SECOND_BEVEL_GEAR_2D_SCALE_FACTOR (/ B Addendum)) (setq BEVEL_TOE_CIRCULAR_THICKNESS (* BEVEL_HEEL_CIRCULAR_THICKNESS SECOND_BEVEL_GEAR_2D_SCALE_FACTOR)) );progn );if (if (eq BEVEL_TOE_CHORDAL_THICKNESS nil) (progn (setq A (* FACE_WIDTH (tan (oli:sd-deg-to-rad FACE_ANGLE)))) (setq B (- ADDENDUM A)) (setq SECOND_BEVEL_GEAR_2D_SCALE_FACTOR (/ B Addendum)) (setq BEVEL_TOE_CHORDAL_THICKNESS (* BEVEL_HEEL_CHORDAL_THICKNESS SECOND_BEVEL_GEAR_2D_SCALE_FACTOR)) );progn );if (if (eq WHOLE_DEPTH nil) (setq WHOLE_DEPTH (+ 0.002 (/ 2.188 ( / 1 MODE)))) );if (setq CLEARANCE (- WHOLE_DEPTH (/ 2.0 ( / 1 MODE)))) (setq ROOT_FILLET_RADIUS 0.0) (setq ROOT_CIRCLE_RADIUS (- (/ PITCH_DIAMETER 2.0) DEDENDUM)) (setq PITCH_CIRCLE_RADIUS (/ PITCH_DIAMETER 2.0)) (setq ADDENDUM_CIRCLE_RADIUS (+ PITCH_CIRCLE_RADIUS ADDENDUM)) (setq GEAR_ANGLE (/ 360.0 (* 2.0 NUMBER_OF_BEVEL_TEETH))) (setq BASE_CIRCLE_RADIUS (* (/ PITCH_DIAMETER 2.0) (sin (* (/ (- 90.0 PRESSURE_ANGLE) 180.0) pi)))) (setq PRESSURE_ANGLE_IN_RADIANS (/ (* PRESSURE_ANGLE pi) 180.0)) (setq TAN_OF_PRESSURE_ANGLE_IN_RADIANS (tan PRESSURE_ANGLE_IN_RADIANS)) (setq INV_OF_PRESSURE_ANGLE (- TAN_OF_PRESSURE_ANGLE_IN_RADIANS (* pi (/ PRESSURE_ANGLE 180.0))));inv1 (if (> FACE_ANGLE PITCH_ANGLE) (progn (setq USERS_INPUTTED_FACE_ANGLE FACE_ANGLE) (setq FACE_ANGLE (abs (- FACE_ANGLE PITCH_ANGLE))) );progn );if (setq USERS_INPUTTED_ROOT_ANGLE ROOT_ANGLE) (setq ROOT_ANGLE (abs (- PITCH_ANGLE ROOT_ANGLE))) );progn );:BEVEL (:PINION;-------If a BEVEL PINION was choose (progn (setq NUMBER_OF_TEETH NUMBER_OF_PINION_TEETH) (setq GEAR_WIDTH (- GEAR_WIDTH HUB_PROJECTION)) (setq MOUNTING_DISTANCE (- MOUNTING_DISTANCE HUB_PROJECTION)) (if (eq PITCH_DIAMETER nil) (setq PITCH_DIAMETER (* 2.0 (/ (/ (/ NUMBER_OF_TEETH ( / 1 MODE)) 2.0) (sin (oli:sd-deg-to-rad (- 90.0 PITCH_ANGLE)))))) );if (if (eq CIRCULAR_PITCH nil) (setq CIRCULAR_PITCH (/ (* pi (/ NUMBER_OF_TEETH ( / 1 MODE))) NUMBER_OF_TEETH)) );if (if (eq CONE_DISTANCE nil) (setq CONE_DISTANCE (/ (/ NUMBER_OF_TEETH ( / 1 MODE)) (* 2.0 (sin (/ (* pi PITCH_ANGLE) 180.0))))) );if (if (eq ADDENDUM nil) (progn (setq A (+ (/ 0.54 ( / 1 MODE)) (/ 0.46 (* ( / 1 MODE) (* (/ NUMBER_OF_BEVEL_TEETH NUMBER_OF_TEETH) (/ NUMBER_OF_BEVEL_TEETH NUMBER_OF_TEETH)))))) (setq ADDENDUM (/ 1.0 ( / 1 MODE))) );progn );if (if (eq DEDENDUM nil) (setq DEDENDUM (/ 1.157 ( / 1 MODE))) );if (if (eq FACE_WIDTH nil) (setq FACE_WIDTH (/ GEAR_WIDTH (cos (oli:sd-deg-to-rad PITCH_ANGLE)))) );if (if (eq OUTSIDE_DIAMETER nil) (setq OUTSIDE_DIAMETER (+ (/ NUMBER_OF_TEETH ( / 1 MODE)) (* 2.0 (* ADDENDUM (cos (oli:sd-deg-to-rad PITCH_ANGLE)))))) );if (if (eq BEVEL_HEEL_CIRCULAR_THICKNESS nil) (progn (setq aG (+ (/ 0.54 ( / 1 MODE)) (/ 0.46 (* ( / 1 MODE) (* (/ NUMBER_OF_BEVEL_TEETH NUMBER_OF_TEETH) (/ NUMBER_OF_BEVEL_TEETH NUMBER_OF_TEETH)))))) (setq hk (/ 2.0 ( / 1 MODE))) (setq aP (- hk aG)) (setq mG (/ NUMBER_OF_BEVEL_TEETH NUMBER_OF_TEETH)) (setq A (- (* 0.092 mG) 0.088)) (setq B (* 0.004 mG mG)) (setq C (* 0.0016 (- NUMBER_OF_TEETH 30) (- mG 1))) (setq K (+ (- A B) C)) (setq BEVEL_GEAR_HEEL_CIRCULAR_THICKNESS (- (/ CIRCULAR_PITCH 2.0) (* (- aP aG) (tan (oli:sd-deg-to-rad PRESSURE_ANGLE))) (/ K ( / 1 MODE)))) (setq BEVEL_HEEL_CIRCULAR_THICKNESS (- CIRCULAR_PITCH BEVEL_GEAR_HEEL_CIRCULAR_THICKNESS)) (setq ORIGINALLY_CALCULATED_BEVEL_HEEL_CIRCULAR_THICKNESS BEVEL_HEEL_CIRCULAR_THICKNESS) );progn );if (if (eq BEVEL_HEEL_CHORDAL_THICKNESS nil) (progn (setq A (/ BEVEL_HEEL_CIRCULAR_THICKNESS PITCH_DIAMETER));-----gives results in radians:) (setq SIN_OF_A (sin A)) (setq BEVEL_HEEL_CHORDAL_THICKNESS (* 2.0 (/ PITCH_DIAMETER 2.0) SIN_OF_A)) );progn );if (if (eq BEVEL_TOE_CIRCULAR_THICKNESS nil) (setq BEVEL_TOE_CIRCULAR_THICKNESS (* BEVEL_HEEL_CIRCULAR_THICKNESS (/ (- CONE_DISTANCE FACE_WIDTH) CONE_DISTANCE))) );if (if (eq BEVEL_TOE_CHORDAL_THICKNESS nil) (setq BEVEL_TOE_CHORDAL_THICKNESS (* (/ (- CONE_DISTANCE FACE_WIDTH) CONE_DISTANCE) BEVEL_HEEL_CHORDAL_THICKNESS)) );if (if (eq WHOLE_DEPTH nil) (setq WHOLE_DEPTH (+ 0.002 (/ 2.188 ( / 1 MODE)))) );if (setq CLEARANCE (- WHOLE_DEPTH (/ 2.0 ( / 1 MODE)))) (setq ROOT_FILLET_RADIUS 0.0) (setq ROOT_CIRCLE_RADIUS (- (/ PITCH_DIAMETER 2.0) DEDENDUM)) (setq PITCH_CIRCLE_RADIUS (/ PITCH_DIAMETER 2.0)) (setq ADDENDUM_CIRCLE_RADIUS (+ PITCH_CIRCLE_RADIUS ADDENDUM)) (setq BASE_CIRCLE_RADIUS (* (/ PITCH_DIAMETER 2.0) (sin (* (/ (- 90.0 PRESSURE_ANGLE) 180.0) pi)))) (setq PRESSURE_ANGLE_IN_RADIANS (/ (* PRESSURE_ANGLE pi) 180.0)) (setq TAN_OF_PRESSURE_ANGLE_IN_RADIANS (tan PRESSURE_ANGLE_IN_RADIANS)) (setq INV_OF_PRESSURE_ANGLE (- TAN_OF_PRESSURE_ANGLE_IN_RADIANS (* pi (/ PRESSURE_ANGLE 180.0))));inv1 (if (> FACE_ANGLE PITCH_ANGLE) (progn (setq USERS_INPUTTED_FACE_ANGLE FACE_ANGLE) (setq FACE_ANGLE (abs (- FACE_ANGLE PITCH_ANGLE))) );progn );if (setq USERS_INPUTTED_ROOT_ANGLE ROOT_ANGLE) (setq ROOT_ANGLE (abs (- PITCH_ANGLE ROOT_ANGLE))) );progn );:PINION );ecase (setf SELECTED_X (gpnt2d_x GEAR_CENTER_POINT));-----This is the 'x' value of the GEAR_CENTER_POINT selected by user (setf SELECTED_Y (gpnt2d_y GEAR_CENTER_POINT));-----This is the 'y' value of the GEAR_CENTER_POINT selected by user ;-----Set the current workplane to the workplane selected by the user (sd-call-cmds (current_wp SELECTED_WP)) ;-----All of the gear profiles are initially drawn at coordinates 0,0 (this eliminates a lot of problems in calculations). ;-----Therefore, we set the vales of X and Y to 0 (which are then used to set the variable GEAR_CENTER_POINT). (setq X 0) (setq Y 0) ;-----Set a variable LENGTH&LENGTH_FACTOR to the current length units and length factor (setq LENGTH&LENGTH_FACTOR (oli::sd-inq-length-units)) (if (string= "INCH" (elt length&length_factor 0)) (progn (ecase UNITS;-----evaluates the value of "UNITS" (:INCH;-----If the user selected INCH units (progn (setf SELECTED_X (/ SELECTED_X 25.4));-----This is the 'x' value of the GEAR_CENTER_POINT selected by user (setf SELECTED_Y (/ SELECTED_Y 25.4));-----This is the 'y' value of the GEAR_CENTER_POINT selected by user );progn );:INCH (:MM;-------If the user selected MM units );:MM );ecase );progn );if (if (string= "MM" (elt length&length_factor 0)) (progn (ecase UNITS;-----evaluates the value of "UNITS" (:INCH;-----If the user selected INCH units (progn (setf SELECTED_X (/ SELECTED_X 25.4));-----This is the 'x' value of the GEAR_CENTER_POINT selected by user (setf SELECTED_Y (/ SELECTED_Y 25.4));-----This is the 'y' value of the GEAR_CENTER_POINT selected by user );progn );:INCH (:MM;-------If the user selected MM units );:MM );ecase );progn );if (setq GEAR_CENTER_POINT (gpnt2d 0 0)) (ecase UNITS;-----evaluates the value of "UNITS" (:INCH;-----If the user selected INCH units (progn (sd-call-cmds (units :inch)) );progn );:INCH (:MM;-------If the user selected MM units (sd-call-cmds (units :mm)) );:MM );ecase ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun INVOLUTE_CALCULATION_FUNCTION (CIRCULAR_THICKNESS BACKLASH) ;-----------------This calculates the points required to create the involute curves------------------; (setq N 0);-----this is just a counter to be used in this section ;---This portion of code subtracts the addendum circle radius from the radius where the involute intersects ;---with the root fillet, and then divides that calculated value by 30. This new value (called RADIUS_INCREMENT) ;---will be used in the following section of code to determine the tooth thickness at 30 different points, ;---starting at the root fillet/involute intersection radius. The following calculations will start by determining ;---the tooth thickness at the root fillet/involute intersection circle. After that has been calculated, it will ;---calculate the tooth thickness at a radius which is the radius of the root fillet/involute intersection circle ;---plus the variable RADIUS_INCREMENT. Each time the following loop cycles, it will add the variable RADIUS_INCREMENT ;---to the last used radius to calculate the new tooth thickness. ; (setq ADDENDUM_ROOT_FILLET_RADIUS_HEIGHT (- ADDENDUM_CIRCLE_RADIUS RADIUS_OF_ROOT_FILLET_INTERSECTION_WITH_INVOLUTE)) ; (setq RADIUS_INCREMENT (/ ADDENDUM_ROOT_FILLET_RADIUS_HEIGHT 29.0)) (if (< ROOT_CIRCLE_RADIUS BASE_CIRCLE_RADIUS) (progn (setq TESTING_RADIUS BASE_CIRCLE_RADIUS);r2 );progn );if (if (> (+ ROOT_CIRCLE_RADIUS ROOT_FILLET_RADIUS) BASE_CIRCLE_RADIUS) (progn ;-----First, find the cosine of the PRESSURE_ANGLE - save it as A (setq A (cos (oli::sd-deg-to-rad PRESSURE_ANGLE))) ;-----Next, find the sine of the PRESSURE_ANGLE - save it as B (setq B (sin (oli::sd-deg-to-rad PRESSURE_ANGLE))) ;-----Now find the pressure angle at the center of the root fillet radius - save it as E (setq C (/ (* PITCH_CIRCLE_RADIUS A) (+ ROOT_CIRCLE_RADIUS ROOT_FILLET_RADIUS))) ;-----Change the result of the last calculation from the cosine of the angle to the angle itself (setq D (oli::sd-rad-to-deg (acos C))) ;-----Now obtain the tangent of D - save it as E (setq E (tan (oli::sd-deg-to-rad D))) ;-----Finally, obtain the radius of the circle where the involute will intersect with the fillet radius - save it as F (setq ROOT_FILLET_AND_INVOLUTE_INTERSECTION_POINT_RADIUS (sqrt (+ (* (- (* BASE_CIRCLE_RADIUS E) ROOT_FILLET_RADIUS) (- (* BASE_CIRCLE_RADIUS E) ROOT_FILLET_RADIUS)) (* BASE_CIRCLE_RADIUS BASE_CIRCLE_RADIUS)))) (setq TESTING_RADIUS ROOT_FILLET_AND_INVOLUTE_INTERSECTION_POINT_RADIUS);(+ ROOT_CIRCLE_RADIUS ROOT_FILLET_RADIUS));r2 );progn );if (if (and (= ROOT_FILLET_RADIUS 0.0) (> (+ ROOT_CIRCLE_RADIUS ROOT_FILLET_RADIUS) BASE_CIRCLE_RADIUS)) (progn (setq TESTING_RADIUS ROOT_CIRCLE_RADIUS) );progn );if (setq RADIUS_INCREMENT (/ (- ADDENDUM_CIRCLE_RADIUS TESTING_RADIUS) 29.0)) ;---This portion of code follows the instructions from Brian's "Involute Trigonometry" book, Figure 3, page 25 ;---to calculate the tooth thickness at any radius given the circular thickness (at the pitch circle) and the ;---radius of the pitch circle. (loop (progn (setq A (/ (* PITCH_CIRCLE_RADIUS (cos PRESSURE_ANGLE_IN_RADIANS)) TESTING_RADIUS));cos2 (setq A_ACOS (acos A)) (setq A_ACOS_IN_DEGREES (/ (* A_ACOS 180.0) pi)) (setq TAN_OF_A_ACOS_IN_RADIANS (tan A_ACOS)) (setq INV_OF_A_ACOS (- TAN_OF_A_ACOS_IN_RADIANS (* pi (/ A_ACOS_IN_DEGREES 180.0)))) (setq DESIRED_ARC_LENGTH_OF_TESTING_RADIUS (+ (* 2.0 TESTING_RADIUS (- (+ (/ CIRCULAR_THICKNESS (* 2.0 PITCH_CIRCLE_RADIUS)) INV_OF_PRESSURE_ANGLE) INV_OF_A_ACOS)) (* BACKLASH 2.0))) ;---This portion of code follows the instructions from Brian's "Involute Trigonometry" book, Figure 4, page 25 ;---to calculate the chordal tooth thickness at the tooth thickness (DESIRED_ARC_LENGTH_OF_TESTING_RADIUS) ;---calculated above. (setq A (/ DESIRED_ARC_LENGTH_OF_TESTING_RADIUS (* 2.0 TESTING_RADIUS)));-----gives results in radians:) (setq SIN_OF_A (sin A)) (setq DESIRED_CHORDAL_TOOTH_THICKNESS (* 2.0 TESTING_RADIUS SIN_OF_A)) ;---This sections translates the HALF_OF_DESIRED_CHORDAL_TOOTH_THICKNESS and TESTING_RADIUS variables to X and Y ;---coordinates to draw the involute. (setq HALF_OF_DESIRED_CHORDAL_TOOTH_THICKNESS (/ DESIRED_CHORDAL_TOOTH_THICKNESS 2.0)) (setq X_VALUE_OF_CALCULATED_POINT HALF_OF_DESIRED_CHORDAL_TOOTH_THICKNESS) (setq Y_VALUE_OF_CALCULATED_POINT (sqrt (- (* TESTING_RADIUS TESTING_RADIUS) (* HALF_OF_DESIRED_CHORDAL_TOOTH_THICKNESS HALF_OF_DESIRED_CHORDAL_TOOTH_THICKNESS)))) (setq N (+ N 1));-----increment the counter (cond ((= N 1) (setf LEFT_SIDE_INVOLUTE_POINT_ONE (gpnt2d (- X X_VALUE_OF_CALCULATED_POINT) (+ Y Y_VALUE_OF_CALCULATED_POINT))) (setq RIGHT_SIDE_INVOLUTE_POINT_ONE (gpnt2d (+ X X_VALUE_OF_CALCULATED_POINT) (+ Y Y_VALUE_OF_CALCULATED_POINT))) ;---The variable SIN_OF_ANGLE_BETWEEN_TESTING_RADIUS_AND_VERTICAL_AXIS will be used later to calculate ;---the root fillet/involute intersection. (setq SIN_OF_ANGLE_BETWEEN_TESTING_RADIUS_AND_VERTICAL_AXIS (/ X_VALUE_OF_CALCULATED_POINT TESTING_RADIUS)) ) ((= N 2) (setf LEFT_SIDE_INVOLUTE_POINT_TWO (gpnt2d (- X X_VALUE_OF_CALCULATED_POINT) (+ Y Y_VALUE_OF_CALCULATED_POINT))) (setf RIGHT_SIDE_INVOLUTE_POINT_TWO (gpnt2d (+ X X_VALUE_OF_CALCULATED_POINT) (+ Y Y_VALUE_OF_CALCULATED_POINT))) ) ((= N 3) (setf LEFT_SIDE_INVOLUTE_POINT_THREE (gpnt2d (- X X_VALUE_OF_CALCULATED_POINT) (+ Y Y_VALUE_OF_CALCULATED_POINT))) (setf RIGHT_SIDE_INVOLUTE_POINT_THREE (gpnt2d (+ X X_VALUE_OF_CALCULATED_POINT) (+ Y Y_VALUE_OF_CALCULATED_POINT))) ) ((= N 4) (setf LEFT_SIDE_INVOLUTE_POINT_FOUR (gpnt2d (- X X_VALUE_OF_CALCULATED_POINT) (+ Y Y_VALUE_OF_CALCULATED_POINT))) (setf RIGHT_SIDE_INVOLUTE_POINT_FOUR (gpnt2d (+ X X_VALUE_OF_CALCULATED_POINT) (+ Y Y_VALUE_OF_CALCULATED_POINT))) ) ((= N 5) (setf LEFT_SIDE_INVOLUTE_POINT_FIVE (gpnt2d (- X X_VALUE_OF_CALCULATED_POINT) (+ Y Y_VALUE_OF_CALCULATED_POINT))) (setf RIGHT_SIDE_INVOLUTE_POINT_FIVE (gpnt2d (+ X X_VALUE_OF_CALCULATED_POINT) (+ Y Y_VALUE_OF_CALCULATED_POINT))) ) ((= N 6) (setf LEFT_SIDE_INVOLUTE_POINT_SIX (gpnt2d (- X X_VALUE_OF_CALCULATED_POINT) (+ Y Y_VALUE_OF_CALCULATED_POINT))) (setf RIGHT_SIDE_INVOLUTE_POINT_SIX (gpnt2d (+ X X_VALUE_OF_CALCULATED_POINT) (+ Y Y_VALUE_OF_CALCULATED_POINT))) ) ((= N 7) (setf LEFT_SIDE_INVOLUTE_POINT_SEVEN (gpnt2d (- X X_VALUE_OF_CALCULATED_POINT) (+ Y Y_VALUE_OF_CALCULATED_POINT))) (setf RIGHT_SIDE_INVOLUTE_POINT_SEVEN (gpnt2d (+ X X_VALUE_OF_CALCULATED_POINT) (+ Y Y_VALUE_OF_CALCULATED_POINT))) ) ((= N 8) (setf LEFT_SIDE_INVOLUTE_POINT_EIGHT (gpnt2d (- X X_VALUE_OF_CALCULATED_POINT) (+ Y Y_VALUE_OF_CALCULATED_POINT))) (setf RIGHT_SIDE_INVOLUTE_POINT_EIGHT (gpnt2d (+ X X_VALUE_OF_CALCULATED_POINT) (+ Y Y_VALUE_OF_CALCULATED_POINT))) ) ((= N 9) (setf LEFT_SIDE_INVOLUTE_POINT_NINE (gpnt2d (- X X_VALUE_OF_CALCULATED_POINT) (+ Y Y_VALUE_OF_CALCULATED_POINT))) (setf RIGHT_SIDE_INVOLUTE_POINT_NINE (gpnt2d (+ X X_VALUE_OF_CALCULATED_POINT) (+ Y Y_VALUE_OF_CALCULATED_POINT))) ) ((= N 10) (setf LEFT_SIDE_INVOLUTE_POINT_TEN (gpnt2d (- X X_VALUE_OF_CALCULATED_POINT) (+ Y Y_VALUE_OF_CALCULATED_POINT))) (setf RIGHT_SIDE_INVOLUTE_POINT_TEN (gpnt2d (+ X X_VALUE_OF_CALCULATED_POINT) (+ Y Y_VALUE_OF_CALCULATED_POINT))) ) ((= N 11) (setf LEFT_SIDE_INVOLUTE_POINT_ELEVEN (gpnt2d (- X X_VALUE_OF_CALCULATED_POINT) (+ Y Y_VALUE_OF_CALCULATED_POINT))) (setf RIGHT_SIDE_INVOLUTE_POINT_ELEVEN (gpnt2d (+ X X_VALUE_OF_CALCULATED_POINT) (+ Y Y_VALUE_OF_CALCULATED_POINT))) ) ((= N 12) (setf LEFT_SIDE_INVOLUTE_POINT_TWELVE (gpnt2d (- X X_VALUE_OF_CALCULATED_POINT) (+ Y Y_VALUE_OF_CALCULATED_POINT))) (setf RIGHT_SIDE_INVOLUTE_POINT_TWELVE (gpnt2d (+ X X_VALUE_OF_CALCULATED_POINT) (+ Y Y_VALUE_OF_CALCULATED_POINT))) ) ((= N 13) (setf LEFT_SIDE_INVOLUTE_POINT_THIRTEEN (gpnt2d (- X X_VALUE_OF_CALCULATED_POINT) (+ Y Y_VALUE_OF_CALCULATED_POINT))) (setf RIGHT_SIDE_INVOLUTE_POINT_THIRTEEN (gpnt2d (+ X X_VALUE_OF_CALCULATED_POINT) (+ Y Y_VALUE_OF_CALCULATED_POINT))) ) ((= N 14) (setf LEFT_SIDE_INVOLUTE_POINT_FOURTEEN (gpnt2d (- X X_VALUE_OF_CALCULATED_POINT) (+ Y Y_VALUE_OF_CALCULATED_POINT))) (setf RIGHT_SIDE_INVOLUTE_POINT_FOURTEEN (gpnt2d (+ X X_VALUE_OF_CALCULATED_POINT) (+ Y Y_VALUE_OF_CALCULATED_POINT))) ) ((= N 15) (setf LEFT_SIDE_INVOLUTE_POINT_FIFTEEN (gpnt2d (- X X_VALUE_OF_CALCULATED_POINT) (+ Y Y_VALUE_OF_CALCULATED_POINT))) (setf RIGHT_SIDE_INVOLUTE_POINT_FIFTEEN (gpnt2d (+ X X_VALUE_OF_CALCULATED_POINT) (+ Y Y_VALUE_OF_CALCULATED_POINT))) ) ((= N 16) (setf LEFT_SIDE_INVOLUTE_POINT_SIXTEEN (gpnt2d (- X X_VALUE_OF_CALCULATED_POINT) (+ Y Y_VALUE_OF_CALCULATED_POINT))) (setf RIGHT_SIDE_INVOLUTE_POINT_SIXTEEN (gpnt2d (+ X X_VALUE_OF_CALCULATED_POINT) (+ Y Y_VALUE_OF_CALCULATED_POINT))) ) ((= N 17) (setf LEFT_SIDE_INVOLUTE_POINT_SEVENTEEN (gpnt2d (- X X_VALUE_OF_CALCULATED_POINT) (+ Y Y_VALUE_OF_CALCULATED_POINT))) (setf RIGHT_SIDE_INVOLUTE_POINT_SEVENTEEN (gpnt2d (+ X X_VALUE_OF_CALCULATED_POINT) (+ Y Y_VALUE_OF_CALCULATED_POINT))) ) ((= N 18) (setf LEFT_SIDE_INVOLUTE_POINT_EIGHTEEN (gpnt2d (- X X_VALUE_OF_CALCULATED_POINT) (+ Y Y_VALUE_OF_CALCULATED_POINT))) (setf RIGHT_SIDE_INVOLUTE_POINT_EIGHTEEN (gpnt2d (+ X X_VALUE_OF_CALCULATED_POINT) (+ Y Y_VALUE_OF_CALCULATED_POINT))) ) ((= N 19) (setf LEFT_SIDE_INVOLUTE_POINT_NINETEEN (gpnt2d (- X X_VALUE_OF_CALCULATED_POINT) (+ Y Y_VALUE_OF_CALCULATED_POINT))) (setf RIGHT_SIDE_INVOLUTE_POINT_NINETEEN (gpnt2d (+ X X_VALUE_OF_CALCULATED_POINT) (+ Y Y_VALUE_OF_CALCULATED_POINT))) ) ((= N 20) (setf LEFT_SIDE_INVOLUTE_POINT_TWENTY (gpnt2d (- X X_VALUE_OF_CALCULATED_POINT) (+ Y Y_VALUE_OF_CALCULATED_POINT))) (setf RIGHT_SIDE_INVOLUTE_POINT_TWENTY (gpnt2d (+ X X_VALUE_OF_CALCULATED_POINT) (+ Y Y_VALUE_OF_CALCULATED_POINT))) ) ((= N 21) (setf LEFT_SIDE_INVOLUTE_POINT_TWENTYONE (gpnt2d (- X X_VALUE_OF_CALCULATED_POINT) (+ Y Y_VALUE_OF_CALCULATED_POINT))) (setf RIGHT_SIDE_INVOLUTE_POINT_TWENTYONE (gpnt2d (+ X X_VALUE_OF_CALCULATED_POINT) (+ Y Y_VALUE_OF_CALCULATED_POINT))) ) ((= N 22) (setf LEFT_SIDE_INVOLUTE_POINT_TWENTYTWO (gpnt2d (- X X_VALUE_OF_CALCULATED_POINT) (+ Y Y_VALUE_OF_CALCULATED_POINT))) (setf RIGHT_SIDE_INVOLUTE_POINT_TWENTYTWO (gpnt2d (+ X X_VALUE_OF_CALCULATED_POINT) (+ Y Y_VALUE_OF_CALCULATED_POINT))) ) ((= N 23) (setf LEFT_SIDE_INVOLUTE_POINT_TWENTYTHREE (gpnt2d (- X X_VALUE_OF_CALCULATED_POINT) (+ Y Y_VALUE_OF_CALCULATED_POINT))) (setf RIGHT_SIDE_INVOLUTE_POINT_TWENTYTHREE (gpnt2d (+ X X_VALUE_OF_CALCULATED_POINT) (+ Y Y_VALUE_OF_CALCULATED_POINT))) ) ((= N 24) (setf LEFT_SIDE_INVOLUTE_POINT_TWENTYFOUR (gpnt2d (- X X_VALUE_OF_CALCULATED_POINT) (+ Y Y_VALUE_OF_CALCULATED_POINT))) (setf RIGHT_SIDE_INVOLUTE_POINT_TWENTYFOUR (gpnt2d (+ X X_VALUE_OF_CALCULATED_POINT) (+ Y Y_VALUE_OF_CALCULATED_POINT))) ) ((= N 25) (setf LEFT_SIDE_INVOLUTE_POINT_TWENTYFIVE (gpnt2d (- X X_VALUE_OF_CALCULATED_POINT) (+ Y Y_VALUE_OF_CALCULATED_POINT))) (setf RIGHT_SIDE_INVOLUTE_POINT_TWENTYFIVE (gpnt2d (+ X X_VALUE_OF_CALCULATED_POINT) (+ Y Y_VALUE_OF_CALCULATED_POINT))) ) ((= N 26) (setf LEFT_SIDE_INVOLUTE_POINT_TWENTYSIX (gpnt2d (- X X_VALUE_OF_CALCULATED_POINT) (+ Y Y_VALUE_OF_CALCULATED_POINT))) (setf RIGHT_SIDE_INVOLUTE_POINT_TWENTYSIX (gpnt2d (+ X X_VALUE_OF_CALCULATED_POINT) (+ Y Y_VALUE_OF_CALCULATED_POINT))) ) ((= N 27) (setf LEFT_SIDE_INVOLUTE_POINT_TWENTYSEVEN (gpnt2d (- X X_VALUE_OF_CALCULATED_POINT) (+ Y Y_VALUE_OF_CALCULATED_POINT))) (setf RIGHT_SIDE_INVOLUTE_POINT_TWENTYSEVEN (gpnt2d (+ X X_VALUE_OF_CALCULATED_POINT) (+ Y Y_VALUE_OF_CALCULATED_POINT))) ) ((= N 28) (setf LEFT_SIDE_INVOLUTE_POINT_TWENTYEIGHT (gpnt2d (- X X_VALUE_OF_CALCULATED_POINT) (+ Y Y_VALUE_OF_CALCULATED_POINT))) (setf RIGHT_SIDE_INVOLUTE_POINT_TWENTYEIGHT (gpnt2d (+ X X_VALUE_OF_CALCULATED_POINT) (+ Y Y_VALUE_OF_CALCULATED_POINT))) ) ((= N 29) (setf LEFT_SIDE_INVOLUTE_POINT_TWENTYNINE (gpnt2d (- X X_VALUE_OF_CALCULATED_POINT) (+ Y Y_VALUE_OF_CALCULATED_POINT))) (setf RIGHT_SIDE_INVOLUTE_POINT_TWENTYNINE (gpnt2d (+ X X_VALUE_OF_CALCULATED_POINT) (+ Y Y_VALUE_OF_CALCULATED_POINT))) ) ((= N 30) (setf LEFT_SIDE_INVOLUTE_POINT_THIRTY (gpnt2d (- X X_VALUE_OF_CALCULATED_POINT) (+ Y Y_VALUE_OF_CALCULATED_POINT))) (setf RIGHT_SIDE_INVOLUTE_POINT_THIRTY (gpnt2d (+ X X_VALUE_OF_CALCULATED_POINT) (+ Y Y_VALUE_OF_CALCULATED_POINT))) ) );cond ;---This portion of code increments the radius being used in the above code by RADIUS_INCREMENT. For the last ;---loop, the last radius being used in the above is set to the addendum circle radius. (if (< TESTING_RADIUS ADDENDUM_CIRCLE_RADIUS) (setq TESTING_RADIUS (+ TESTING_RADIUS RADIUS_INCREMENT)) );if (if (= N 29) (setq TESTING_RADIUS ADDENDUM_CIRCLE_RADIUS) );if ;---When N has reached a value of 30, close the loop. (when (= N 30) (return "done.") );when );progn );loop );defun ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun RADIAL_LINE_ROOT_FILLET_INTERSECTION_FUNCTION () ;----------This calculates the point where the radial line intersects with the root fillet.----------; ;-----------This code only performs if a radial line is drawn (only if the root circle is------------; ;-----------------------------------smaller than the base circle)------------------------------------; ;---This portion of code just triangulates the length between the center of the gear and the point ;---where the root fillet intersects with the radial line. (if (< ROOT_CIRCLE_RADIUS BASE_CIRCLE_RADIUS) (progn (setq A (* (+ ROOT_CIRCLE_RADIUS ROOT_FILLET_RADIUS) (+ ROOT_CIRCLE_RADIUS ROOT_FILLET_RADIUS))) (setq B (* ROOT_FILLET_RADIUS ROOT_FILLET_RADIUS)) (setq C (sqrt (- A B)));-----C is the length between the center of the gear and the root fillet/radial line intersection (setq ROOT_FILLET_AND_RADIAL_LINE_INTERSECTION_POINT_RADIUS C) (setq D (* SIN_OF_ANGLE_BETWEEN_TESTING_RADIUS_AND_VERTICAL_AXIS C));-----X length between vertical axis and root fillet/radial line intersection (setq E (sqrt (- (* C C) (* D D))));-----Y length between horizontal axis and root fillet/radial line intersection (setq LEFT_SIDE_ROOT_FILLET_RADIAL_LINE_INTERSECTION_POINT (gpnt2d (- X D) (+ Y E))) (setq RIGHT_SIDE_ROOT_FILLET_RADIAL_LINE_INTERSECTION_POINT (gpnt2d (+ X D) (+ Y E))) );progn );if );defun ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun ROOT_FILLET_CENTER_POINT_FUNCTION () ;------------------------This calculates the center point of the root fillet.------------------------; (setq A ROOT_FILLET_RADIUS) (if (< (+ ROOT_CIRCLE_RADIUS ROOT_FILLET_RADIUS) BASE_CIRCLE_RADIUS) (setq B ROOT_FILLET_AND_RADIAL_LINE_INTERSECTION_POINT_RADIUS) );if (if (> (+ ROOT_CIRCLE_RADIUS ROOT_FILLET_RADIUS) BASE_CIRCLE_RADIUS) (setq B ROOT_FILLET_AND_INVOLUTE_INTERSECTION_POINT_RADIUS) );if (setq C (+ ROOT_FILLET_RADIUS ROOT_CIRCLE_RADIUS)) (setq ASQ (* A A)) (setq BSQ (* B B)) (setq CSQ (* C C)) (setq D (oli::sd-rad-to-deg (acos (/ (- (+ BSQ CSQ) ASQ) (* 2.0 B C))))) (setq E (+ D (oli::sd-rad-to-deg (asin SIN_OF_ANGLE_BETWEEN_TESTING_RADIUS_AND_VERTICAL_AXIS)))) (setq ANGLE_BETWEEN_VERTICAL_AXIS_AND_LINE_BETWEEN_GEAR_CENTER_AND_ROOT_FILLET_RADIUS_CENTER_POINT E) (setq F (* C (sin (oli::sd-deg-to-rad E))));-----X length between vertical axis and center of root fillet (setq G (* C (cos (oli::sd-deg-to-rad E))));-----Y length between vertical axis and center of root fillet (setq LEFT_SIDE_ROOT_FILLET_CENTER_POINT (gpnt2d (- X F) (+ Y G))) (setq RIGHT_SIDE_ROOT_FILLET_CENTER_POINT (gpnt2d (+ X F) (+ Y G))) );defun ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun ROOT_CIRCLE_ROOT_FILLET_INTERSECTION_FUNCTION () ;---------This calculates the intersection point between the root circle and the root fillet.--------; (setq A (* ROOT_CIRCLE_RADIUS (sin (oli::sd-deg-to-rad ANGLE_BETWEEN_VERTICAL_AXIS_AND_LINE_BETWEEN_GEAR_CENTER_AND_ROOT_FILLET_RADIUS_CENTER_POINT))));-----X length between vertical axis and root fillet/root circle intersection (setq B (* ROOT_CIRCLE_RADIUS (cos (oli::sd-deg-to-rad ANGLE_BETWEEN_VERTICAL_AXIS_AND_LINE_BETWEEN_GEAR_CENTER_AND_ROOT_FILLET_RADIUS_CENTER_POINT))));-----Y length between vertical axis and root fillet/root circle intersection (setq LEFT_SIDE_ROOT_FILLET_ROOT_CIRCLE_INTERSECTION_POINT (gpnt2d (- X A) (+ Y B))) (setq RIGHT_SIDE_ROOT_FILLET_ROOT_CIRCLE_INTERSECTION_POINT (gpnt2d (+ X A) (+ Y B))) );defun ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun SECOND_ROOT_CIRCLE_ROOT_FILLET_INTERSECTION_FUNCTION () ;---------This calculates the last point required to make a root circle arc between the first------; ;----------------root fillet/root circle intersection and the root fillet/root circle--------------; ;----------------------------intersection to the left of the first---------------------------------; ; (setq A (asin (/ E ROOT_CIRCLE_RADIUS))) ; (setq B (/ (* A 180.0) pi));-----this is the angle between the first root circle/root fillet intersection and the vertical axis ; (setq C (/ (- 360.0 (* (* B 2.0) NUMBER_OF_TEETH)) NUMBER_OF_TEETH));-----this is the angle between the first root circle/root fillet intersection and the root circle/root fillet intersection to the left ; (setq D (+ B C));-----this is the angle between the second root circle/root fillet intersection and the vertical axis ; (setq E (/ (* D pi) 180.0)) ; (setq A (sin E));-----this is the sine of the angle between the line which connects the second root circle/root fillet intersection and the vertical axis. ; (setq B (* ROOT_CIRCLE_RADIUS A));-----X length between vertical axis and second root fillet/root circle intersection ; (setq C (sqrt (- (* ROOT_CIRCLE_RADIUS ROOT_CIRCLE_RADIUS) (* B B))));-----Y length between vertical axis and second root fillet/root circle intersection ; (setq LEFT_SIDE_SECOND_ROOT_FILLET_ROOT_CIRCLE_INTERSECTION_POINT (gpnt2d (- X B) (+ Y C))) (setq A (* 2.0 ANGLE_BETWEEN_VERTICAL_AXIS_AND_LINE_BETWEEN_GEAR_CENTER_AND_ROOT_FILLET_RADIUS_CENTER_POINT)) (setq B (* A NUMBER_OF_TEETH)) (setq C (/ (- 360.0 B) NUMBER_OF_TEETH)) (setq D (+ ANGLE_BETWEEN_VERTICAL_AXIS_AND_LINE_BETWEEN_GEAR_CENTER_AND_ROOT_FILLET_RADIUS_CENTER_POINT C)) (setq E (* ROOT_CIRCLE_RADIUS (sin (oli::sd-deg-to-rad D))));-----X length between vertical axis and second root fillet/root circle intersection (setq F (* ROOT_CIRCLE_RADIUS (cos (oli::sd-deg-to-rad D))));-----Y length between vertical axis and second root fillet/root circle intersection (setq LEFT_SIDE_SECOND_ROOT_FILLET_ROOT_CIRCLE_INTERSECTION_POINT (gpnt2d (- X E) (+ Y F))) );defun ;*****************************************************************************************************************************; ;*****************************************************************************************************************************; ;*****************************************************************************************************************************; ;------------------------------------DRAW THE SPUR OR HELICAL GEAR OUTLINE (TOOTH FORM)---------------------------------------; ;*****************************************************************************************************************************; ;*****************************************************************************************************************************; ;*****************************************************************************************************************************; (defun CREATE_SPUR_OR_HELICAL_2D_PROFILE_FUNCTION () (SETQ NEW_PART (sd-call-cmds (CREATE_PART))) (setq TEMPORARY_WORKPLANE (sd-gen-obj-basename :workplane :prefix "Metric-GEARDESIGNER"));-----Will create a base workplane name "Metric-GEARDESIGNERX", where X is a unique number (sd-call-cmds (CREATE_WORKPLANE :NEW :NAME TEMPORARY_WORKPLANE :PAR_WP :REF_WP SELECTED_WP)) (sd-call-cmds (BSPLINE_INT LEFT_SIDE_INVOLUTE_POINT_ONE LEFT_SIDE_INVOLUTE_POINT_TWO LEFT_SIDE_INVOLUTE_POINT_THREE LEFT_SIDE_INVOLUTE_POINT_FOUR LEFT_SIDE_INVOLUTE_POINT_FIVE LEFT_SIDE_INVOLUTE_POINT_SIX LEFT_SIDE_INVOLUTE_POINT_SEVEN LEFT_SIDE_INVOLUTE_POINT_EIGHT LEFT_SIDE_INVOLUTE_POINT_NINE LEFT_SIDE_INVOLUTE_POINT_TEN LEFT_SIDE_INVOLUTE_POINT_ELEVEN LEFT_SIDE_INVOLUTE_POINT_TWELVE LEFT_SIDE_INVOLUTE_POINT_THIRTEEN LEFT_SIDE_INVOLUTE_POINT_FOURTEEN LEFT_SIDE_INVOLUTE_POINT_FIFTEEN LEFT_SIDE_INVOLUTE_POINT_SIXTEEN LEFT_SIDE_INVOLUTE_POINT_SEVENTEEN LEFT_SIDE_INVOLUTE_POINT_EIGHTEEN LEFT_SIDE_INVOLUTE_POINT_NINETEEN LEFT_SIDE_INVOLUTE_POINT_TWENTY LEFT_SIDE_INVOLUTE_POINT_TWENTYONE LEFT_SIDE_INVOLUTE_POINT_TWENTYTWO LEFT_SIDE_INVOLUTE_POINT_TWENTYTHREE LEFT_SIDE_INVOLUTE_POINT_TWENTYFOUR LEFT_SIDE_INVOLUTE_POINT_TWENTYFIVE LEFT_SIDE_INVOLUTE_POINT_TWENTYSIX LEFT_SIDE_INVOLUTE_POINT_TWENTYSEVEN LEFT_SIDE_INVOLUTE_POINT_TWENTYEIGHT LEFT_SIDE_INVOLUTE_POINT_TWENTYNINE LEFT_SIDE_INVOLUTE_POINT_THIRTY)) (sd-call-cmds (BSPLINE_INT RIGHT_SIDE_INVOLUTE_POINT_ONE RIGHT_SIDE_INVOLUTE_POINT_TWO RIGHT_SIDE_INVOLUTE_POINT_THREE RIGHT_SIDE_INVOLUTE_POINT_FOUR RIGHT_SIDE_INVOLUTE_POINT_FIVE RIGHT_SIDE_INVOLUTE_POINT_SIX RIGHT_SIDE_INVOLUTE_POINT_SEVEN RIGHT_SIDE_INVOLUTE_POINT_EIGHT RIGHT_SIDE_INVOLUTE_POINT_NINE RIGHT_SIDE_INVOLUTE_POINT_TEN RIGHT_SIDE_INVOLUTE_POINT_ELEVEN RIGHT_SIDE_INVOLUTE_POINT_TWELVE RIGHT_SIDE_INVOLUTE_POINT_THIRTEEN RIGHT_SIDE_INVOLUTE_POINT_FOURTEEN RIGHT_SIDE_INVOLUTE_POINT_FIFTEEN RIGHT_SIDE_INVOLUTE_POINT_SIXTEEN RIGHT_SIDE_INVOLUTE_POINT_SEVENTEEN RIGHT_SIDE_INVOLUTE_POINT_EIGHTEEN RIGHT_SIDE_INVOLUTE_POINT_NINETEEN RIGHT_SIDE_INVOLUTE_POINT_TWENTY RIGHT_SIDE_INVOLUTE_POINT_TWENTYONE RIGHT_SIDE_INVOLUTE_POINT_TWENTYTWO RIGHT_SIDE_INVOLUTE_POINT_TWENTYTHREE RIGHT_SIDE_INVOLUTE_POINT_TWENTYFOUR RIGHT_SIDE_INVOLUTE_POINT_TWENTYFIVE RIGHT_SIDE_INVOLUTE_POINT_TWENTYSIX RIGHT_SIDE_INVOLUTE_POINT_TWENTYSEVEN RIGHT_SIDE_INVOLUTE_POINT_TWENTYEIGHT RIGHT_SIDE_INVOLUTE_POINT_TWENTYNINE RIGHT_SIDE_INVOLUTE_POINT_THIRTY)) (if (> (+ ROOT_CIRCLE_RADIUS ROOT_FILLET_RADIUS) BASE_CIRCLE_RADIUS) (progn (sd-call-cmds (ARC :CENTER LEFT_SIDE_ROOT_FILLET_CENTER_POINT LEFT_SIDE_ROOT_FILLET_ROOT_CIRCLE_INTERSECTION_POINT LEFT_SIDE_INVOLUTE_POINT_ONE));-----Draws the arc (root fillet) between the radial line and root circle (left hand side of tooth) (sd-call-cmds (ARC :CENTER RIGHT_SIDE_ROOT_FILLET_CENTER_POINT RIGHT_SIDE_INVOLUTE_POINT_ONE RIGHT_SIDE_ROOT_FILLET_ROOT_CIRCLE_INTERSECTION_POINT));-----Draws the arc (root fillet) between the radial line and root circle (right hand side of tooth) (sd-call-cmds (ARC :CENTER GEAR_CENTER_POINT RIGHT_SIDE_INVOLUTE_POINT_THIRTY LEFT_SIDE_INVOLUTE_POINT_THIRTY));-----Draws the arc of the top (addendum) of the gear (sd-call-cmds (ARC :CENTER GEAR_CENTER_POINT LEFT_SIDE_ROOT_FILLET_ROOT_CIRCLE_INTERSECTION_POINT LEFT_SIDE_SECOND_ROOT_FILLET_ROOT_CIRCLE_INTERSECTION_POINT));-----Draws the arc (root circle) between the first root circle/root fillet intersection and the second root circle/root fillet intersection );progn );if (if (< (+ ROOT_CIRCLE_RADIUS ROOT_FILLET_RADIUS) BASE_CIRCLE_RADIUS) (progn (sd-call-cmds (LINE :TWO_POINTS LEFT_SIDE_INVOLUTE_POINT_ONE LEFT_SIDE_ROOT_FILLET_RADIAL_LINE_INTERSECTION_POINT));-----Draws a radial line between the involute (at the base circle) and the root fillet (left hand side of tooth) (sd-call-cmds (LINE :TWO_POINTS RIGHT_SIDE_INVOLUTE_POINT_ONE RIGHT_SIDE_ROOT_FILLET_RADIAL_LINE_INTERSECTION_POINT));-----Draws a radial line between the involute (at the base circle) and the root fillet (right hand side of tooth) (sd-call-cmds (ARC :CENTER LEFT_SIDE_ROOT_FILLET_CENTER_POINT LEFT_SIDE_ROOT_FILLET_ROOT_CIRCLE_INTERSECTION_POINT LEFT_SIDE_ROOT_FILLET_RADIAL_LINE_INTERSECTION_POINT));-----Draws the arc (root fillet) between the radial line and root circle (left hand side of tooth) (sd-call-cmds (ARC :CENTER RIGHT_SIDE_ROOT_FILLET_CENTER_POINT RIGHT_SIDE_ROOT_FILLET_RADIAL_LINE_INTERSECTION_POINT RIGHT_SIDE_ROOT_FILLET_ROOT_CIRCLE_INTERSECTION_POINT));-----Draws the arc (root fillet) between the radial line and root circle (right hand side of tooth) (sd-call-cmds (ARC :CENTER GEAR_CENTER_POINT RIGHT_SIDE_INVOLUTE_POINT_THIRTY LEFT_SIDE_INVOLUTE_POINT_THIRTY));-----Draws the arc of the top (addendum) of the gear (sd-call-cmds (ARC :CENTER GEAR_CENTER_POINT LEFT_SIDE_ROOT_FILLET_ROOT_CIRCLE_INTERSECTION_POINT LEFT_SIDE_SECOND_ROOT_FILLET_ROOT_CIRCLE_INTERSECTION_POINT));-----Draws the arc (root circle) between the first root circle/root fillet intersection and the second root circle/root fillet intersection );progn );if ;; (sd-call-cmds (ROTATE_2D :SELECT :current :all_2d :CENTER_POINT GEAR_CENTER_POINT :ANGLE (/ 360.0 NUMBER_OF_TEETH) :REPEAT_FACTOR (- NUMBER_OF_TEETH 1.0) :KEEP :ON)) (sd-call-cmds (ROTATE_2D :SELECT :all_2d :CENTER_POINT GEAR_CENTER_POINT :ANGLE (sd-deg-to-rad (/ 360.0 NUMBER_OF_TEETH)) :REPEAT_FACTOR (- NUMBER_OF_TEETH 1.0) :KEEP :ON)) ; (ROTATE_2D :SELECT :IN_PART NEW_PART :CENTER_POINT GEAR_CENTER_POINT :ANGLE (/ 360.0 NUMBER_OF_TEETH) :REPEAT_FACTOR (- NUMBER_OF_TEETH 1.0) :KEEP :ON) ;(CIRCLE :CEN_RAD GEAR_CENTER_POINT PITCH_CIRCLE_RADIUS) );defun ;*****************************************************************************************************************************; ;*****************************************************************************************************************************; ;*****************************************************************************************************************************; ;-----------------------------------------DRAW THE BEVEL GEAR OUTLINE (TOOTH FORM)--------------------------------------------; ;*****************************************************************************************************************************; ;*****************************************************************************************************************************; ;*****************************************************************************************************************************; (defun CREATE_BEVEL_2D_PROFILE_FUNCTION () (sd-call-cmds (BSPLINE_INT LEFT_SIDE_INVOLUTE_POINT_ONE LEFT_SIDE_INVOLUTE_POINT_TWO LEFT_SIDE_INVOLUTE_POINT_THREE LEFT_SIDE_INVOLUTE_POINT_FOUR LEFT_SIDE_INVOLUTE_POINT_FIVE LEFT_SIDE_INVOLUTE_POINT_SIX LEFT_SIDE_INVOLUTE_POINT_SEVEN LEFT_SIDE_INVOLUTE_POINT_EIGHT LEFT_SIDE_INVOLUTE_POINT_NINE LEFT_SIDE_INVOLUTE_POINT_TEN LEFT_SIDE_INVOLUTE_POINT_ELEVEN LEFT_SIDE_INVOLUTE_POINT_TWELVE LEFT_SIDE_INVOLUTE_POINT_THIRTEEN LEFT_SIDE_INVOLUTE_POINT_FOURTEEN LEFT_SIDE_INVOLUTE_POINT_FIFTEEN LEFT_SIDE_INVOLUTE_POINT_SIXTEEN LEFT_SIDE_INVOLUTE_POINT_SEVENTEEN LEFT_SIDE_INVOLUTE_POINT_EIGHTEEN LEFT_SIDE_INVOLUTE_POINT_NINETEEN LEFT_SIDE_INVOLUTE_POINT_TWENTY LEFT_SIDE_INVOLUTE_POINT_TWENTYONE LEFT_SIDE_INVOLUTE_POINT_TWENTYTWO LEFT_SIDE_INVOLUTE_POINT_TWENTYTHREE LEFT_SIDE_INVOLUTE_POINT_TWENTYFOUR LEFT_SIDE_INVOLUTE_POINT_TWENTYFIVE LEFT_SIDE_INVOLUTE_POINT_TWENTYSIX LEFT_SIDE_INVOLUTE_POINT_TWENTYSEVEN LEFT_SIDE_INVOLUTE_POINT_TWENTYEIGHT LEFT_SIDE_INVOLUTE_POINT_TWENTYNINE LEFT_SIDE_INVOLUTE_POINT_THIRTY)) (sd-call-cmds (BSPLINE_INT RIGHT_SIDE_INVOLUTE_POINT_ONE RIGHT_SIDE_INVOLUTE_POINT_TWO RIGHT_SIDE_INVOLUTE_POINT_THREE RIGHT_SIDE_INVOLUTE_POINT_FOUR RIGHT_SIDE_INVOLUTE_POINT_FIVE RIGHT_SIDE_INVOLUTE_POINT_SIX RIGHT_SIDE_INVOLUTE_POINT_SEVEN RIGHT_SIDE_INVOLUTE_POINT_EIGHT RIGHT_SIDE_INVOLUTE_POINT_NINE RIGHT_SIDE_INVOLUTE_POINT_TEN RIGHT_SIDE_INVOLUTE_POINT_ELEVEN RIGHT_SIDE_INVOLUTE_POINT_TWELVE RIGHT_SIDE_INVOLUTE_POINT_THIRTEEN RIGHT_SIDE_INVOLUTE_POINT_FOURTEEN RIGHT_SIDE_INVOLUTE_POINT_FIFTEEN RIGHT_SIDE_INVOLUTE_POINT_SIXTEEN RIGHT_SIDE_INVOLUTE_POINT_SEVENTEEN RIGHT_SIDE_INVOLUTE_POINT_EIGHTEEN RIGHT_SIDE_INVOLUTE_POINT_NINETEEN RIGHT_SIDE_INVOLUTE_POINT_TWENTY RIGHT_SIDE_INVOLUTE_POINT_TWENTYONE RIGHT_SIDE_INVOLUTE_POINT_TWENTYTWO RIGHT_SIDE_INVOLUTE_POINT_TWENTYTHREE RIGHT_SIDE_INVOLUTE_POINT_TWENTYFOUR RIGHT_SIDE_INVOLUTE_POINT_TWENTYFIVE RIGHT_SIDE_INVOLUTE_POINT_TWENTYSIX RIGHT_SIDE_INVOLUTE_POINT_TWENTYSEVEN RIGHT_SIDE_INVOLUTE_POINT_TWENTYEIGHT RIGHT_SIDE_INVOLUTE_POINT_TWENTYNINE RIGHT_SIDE_INVOLUTE_POINT_THIRTY)) (if (> (+ ROOT_CIRCLE_RADIUS ROOT_FILLET_RADIUS) BASE_CIRCLE_RADIUS) (progn (sd-call-cmds (ARC :CENTER GEAR_CENTER_POINT RIGHT_SIDE_INVOLUTE_POINT_THIRTY LEFT_SIDE_INVOLUTE_POINT_THIRTY));-----Draws the arc of the top (addendum) of the gear (sd-call-cmds (LINE :TWO_POINTS LEFT_SIDE_INVOLUTE_POINT_ONE GEAR_CENTER_POINT)) (sd-call-cmds (LINE :TWO_POINTS RIGHT_SIDE_INVOLUTE_POINT_ONE GEAR_CENTER_POINT)) );progn );if (if (< (+ ROOT_CIRCLE_RADIUS ROOT_FILLET_RADIUS) BASE_CIRCLE_RADIUS) (progn (sd-call-cmds (LINE :TWO_POINTS LEFT_SIDE_INVOLUTE_POINT_ONE GEAR_CENTER_POINT)) (sd-call-cmds (LINE :TWO_POINTS RIGHT_SIDE_INVOLUTE_POINT_ONE GEAR_CENTER_POINT)) (sd-call-cmds (ARC :CENTER GEAR_CENTER_POINT RIGHT_SIDE_INVOLUTE_POINT_THIRTY LEFT_SIDE_INVOLUTE_POINT_THIRTY));-----Draws the arc of the top (addendum) of the gear );progn );if );defun ;*****************************************************************************************************************************; ;*****************************************************************************************************************************; ;*****************************************************************************************************************************; ;*****************************************************************************************************************************; ;*****************************************************************************************************************************; ;*****************************************************************************************************************************; ;---------------------EVALUATE WHAT TYPE OF GEAR WAS CHOSEN BY USER AND EXTRUDE, MILL, PUNCH, ETC.----------------------------; ;-----------------------------------------------------AS REQUIRED-------------------------------------------------------------; ;*****************************************************************************************************************************; ;*****************************************************************************************************************************; ;*****************************************************************************************************************************; (ecase TYPE_OF_GEAR;-----evaluates the value of "TYPE_OF_GEAR" ;****************************************************************************************************************************** ;***********************************************IF A SPUR GEAR WAS CHOSEN: ;****************************************************************************************************************************** (:SPUR (progn (INVOLUTE_CALCULATION_FUNCTION CIRCULAR_THICKNESS 0);-----Call the INVOLUTE_CALCULATION_FUNCTION function (RADIAL_LINE_ROOT_FILLET_INTERSECTION_FUNCTION);-----Call the RADIAL_LINE_ROOT_FILLET_INTERSECTION_FUNCTION function (ROOT_FILLET_CENTER_POINT_FUNCTION);-----Call the ROOT_FILLET_CENTER_POINT_FUNCTION function (ROOT_CIRCLE_ROOT_FILLET_INTERSECTION_FUNCTION);-----Call the ROOT_CIRCLE_ROOT_FILLET_INTERSECTION_FUNCTION function (SECOND_ROOT_CIRCLE_ROOT_FILLET_INTERSECTION_FUNCTION);-----Call the SECOND_ROOT_CIRCLE_ROOT_FILLET_INTERSECTION_FUNCTION function (CREATE_SPUR_OR_HELICAL_2D_PROFILE_FUNCTION);-----Run the CREATE_SPUR_OR_HELICAL_2D_PROFILE_FUNCTION function to create 2D profile (ecase UNITS;-----evaluates the value of "UNITS" (:INCH;-----If the user selected INCH units (progn ;-----Since the use of SD-CALL-CMDS sets everything to millimeters, we need to scale up the 2D geometry by 25.4 (scale_2d :select :all_2d :center_point GEAR_CENTER_POINT :scale_factor 25.4) (move_2d :select :all_2d :direction GEAR_CENTER_POINT (gpnt2d SELECTED_X SELECTED_Y) :repeat_factor 1 :keep :off) );progn );:INCH (:MM;-----If the user selected MM units (move_2d :select :all_2d :direction GEAR_CENTER_POINT (gpnt2d SELECTED_X SELECTED_Y) :repeat_factor 1 :keep :off) );MM );ecase ;-----Now that the gear profile has been moved to the users specified center point (SELECTED_X and SELECTED_Y), we can set ;-----the gear center point variable (GEAR_CENTER_POINT) from 0,0 to the users specified center point (SELECTED_X and SELECTED_Y) ;-----and set the variables X and Y to the users selected gear center point X and Y value. (setq GEAR_CENTER_POINT (gpnt2d SELECTED_X SELECTED_Y)) (setq X SELECTED_X) (setq Y SELECTED_Y) (if (and (= BORE_DIAMETER 0) (= HUB_DIAMETER 0));-----If there is no bore and no hub (progn (extrude :wp (concatenate 'string "/" TEMPORARY_WORKPLANE) :distance GEAR_WIDTH :keep_wp :no) (current_wp SELECTED_WP) );progn );if (if (and (> BORE_DIAMETER 0) (= HUB_DIAMETER 0));-----If there is a bore but no hub (if (= KEYWAY_WIDTH 0);-----------------------------If there is no keyway (progn (circle :cen_dia GEAR_CENTER_POINT BORE_DIAMETER) (extrude :wp (concatenate 'string "/" TEMPORARY_WORKPLANE) :distance GEAR_WIDTH :keep_wp :no) (current_wp SELECTED_WP) );progn );if );if (if (and (> BORE_DIAMETER 0) (= HUB_DIAMETER 0));-----If there is a bore but no hub (if (> KEYWAY_WIDTH 0);----------------------------If there is a keyway (progn (if (= NO_OF_KEYS 1);---------------------------If there is one keyway (progn (setq A (/ BORE_DIAMETER 2.0)) (setq B (/ KEYWAY_WIDTH 2.0)) (setq C (+ (sqrt (- (* A A) (* B B))) KEYWAY_DEPTH A));-----This is the distance from the bottom of the bore to the top of the keyway (setq C (- C A));-----This is the distance from the center of the bore to the top of the keyway (setq TOP_KEYWAY_LEFT (gpnt2d (- X (/ KEYWAY_WIDTH 2.0)) (+ Y C))) (setq TOP_KEYWAY_RIGHT (gpnt2d (+ X (/ KEYWAY_WIDTH 2.0)) (+ Y C))) (setq KEY_X (gpnt2d_x TOP_KEYWAY_LEFT));-----This is the 'x' value of the TOP_KEYWAY_LEFT (setq KEY_Y (gpnt2d_y TOP_KEYWAY_RIGHT));-----This is the 'y' value of the TOP_KEYWAY_RIGHT (setq BOTTOM_KEYWAY_LEFT (gpnt2d (- X (/ KEYWAY_WIDTH 2.0)) (- KEY_Y KEYWAY_DEPTH))) (setq BOTTOM_KEYWAY_RIGHT (gpnt2d (+ X (/ KEYWAY_WIDTH 2.0)) (- KEY_Y KEYWAY_DEPTH))) (ARC :CENTER GEAR_CENTER_POINT BOTTOM_KEYWAY_LEFT BOTTOM_KEYWAY_RIGHT) (LINE :TWO_POINTS BOTTOM_KEYWAY_LEFT TOP_KEYWAY_LEFT) (LINE :TWO_POINTS TOP_KEYWAY_LEFT TOP_KEYWAY_RIGHT) (LINE :TWO_POINTS TOP_KEYWAY_RIGHT BOTTOM_KEYWAY_RIGHT) (extrude :wp (concatenate 'string "/" TEMPORARY_WORKPLANE) :distance GEAR_WIDTH :keep_wp :no) (current_wp SELECTED_WP) );progn );if (if (= NO_OF_KEYS 2);----------------------------If there are two keyways (progn (setq A (/ BORE_DIAMETER 2.0)) (setq B (/ KEYWAY_WIDTH 2.0)) (setq C (+ (sqrt (- (* A A) (* B B))) KEYWAY_DEPTH A));-----This is the distance from the bottom of the bore to the top of the keyway (setq C (- C A));-----This is the distance from the center of the bore to the top of the keyway (setq TOP_KEYWAY_LEFT1 (gpnt2d (- X (/ KEYWAY_WIDTH 2.0)) (+ Y C))) (setq TOP_KEYWAY_RIGHT1 (gpnt2d (+ X (/ KEYWAY_WIDTH 2.0)) (+ Y C))) (setq KEY_X (gpnt2d_x TOP_KEYWAY_LEFT1));-----This is the 'x' value of the TOP_KEYWAY_LEFT1 (setq KEY_Y (gpnt2d_y TOP_KEYWAY_RIGHT1));-----This is the 'y' value of the TOP_KEYWAY_RIGHT1 (setq BOTTOM_KEYWAY_LEFT1 (gpnt2d (- X (/ KEYWAY_WIDTH 2.0)) (- KEY_Y KEYWAY_DEPTH))) (setq BOTTOM_KEYWAY_RIGHT1 (gpnt2d (+ X (/ KEYWAY_WIDTH 2.0)) (- KEY_Y KEYWAY_DEPTH))) (setq TOP_KEYWAY_LEFT2 (gpnt2d (- X (/ KEYWAY_WIDTH 2.0)) (- Y C))) (setq TOP_KEYWAY_RIGHT2 (gpnt2d (+ X (/ KEYWAY_WIDTH 2.0)) (- Y C))) (setq KEY_X (gpnt2d_x TOP_KEYWAY_LEFT2));-----This is the 'x' value of the TOP_KEYWAY_LEFT2 (setq KEY_Y (gpnt2d_y TOP_KEYWAY_RIGHT2));-----This is the 'y' value of the TOP_KEYWAY_RIGHT2 (setq BOTTOM_KEYWAY_LEFT2 (gpnt2d (- X (/ KEYWAY_WIDTH 2.0)) (+ KEY_Y KEYWAY_DEPTH))) (setq BOTTOM_KEYWAY_RIGHT2 (gpnt2d (+ X (/ KEYWAY_WIDTH 2.0)) (+ KEY_Y KEYWAY_DEPTH))) (ARC :CENTER GEAR_CENTER_POINT BOTTOM_KEYWAY_LEFT1 BOTTOM_KEYWAY_LEFT2) (ARC :CENTER GEAR_CENTER_POINT BOTTOM_KEYWAY_RIGHT2 BOTTOM_KEYWAY_RIGHT1) (LINE :TWO_POINTS BOTTOM_KEYWAY_LEFT1 TOP_KEYWAY_LEFT1) (LINE :TWO_POINTS TOP_KEYWAY_LEFT1 TOP_KEYWAY_RIGHT1) (LINE :TWO_POINTS TOP_KEYWAY_RIGHT1 BOTTOM_KEYWAY_RIGHT1) (LINE :TWO_POINTS BOTTOM_KEYWAY_LEFT2 TOP_KEYWAY_LEFT2) (LINE :TWO_POINTS TOP_KEYWAY_LEFT2 TOP_KEYWAY_RIGHT2) (LINE :TWO_POINTS TOP_KEYWAY_RIGHT2 BOTTOM_KEYWAY_RIGHT2) (extrude :wp (concatenate 'string "/" TEMPORARY_WORKPLANE) :distance GEAR_WIDTH :keep_wp :no) (current_wp SELECTED_WP) );progn );if );progn );if );if (if (> HUB_DIAMETER 0);------------------------------If there is a hub (if (= BORE_DIAMETER 0);----------------------------If there is no bore (progn (extrude :wp (concatenate 'string "/" TEMPORARY_WORKPLANE) :distance GEAR_WIDTH :keep_wp :yes) (delete_2d :all_2d);---------Erase the tooth 2d profile (circle :cen_dia GEAR_CENTER_POINT HUB_DIAMETER);-----Draw the circle for the hub diameter (extrude :wp (concatenate 'string "/" TEMPORARY_WORKPLANE) :distance (+ HUB_PROJECTION GEAR_WIDTH) :keep_wp :no);-----Extrude the hub diameter ; (DELETE_2D :all_2d);-----Erase the hub 2d profile (current_wp SELECTED_WP) );progn );if );if (if (> HUB_DIAMETER 0);------------------------------If there is a hub (if (and (> BORE_DIAMETER 0) (= KEYWAY_WIDTH 0));---------------------------If there is a bore but no keyway (progn ; (EXTRUDE :wp TEMPORARY_WORKPLANE :distance GEAR_WIDTH);-----Extrude the tooth profile (extrude :wp (concatenate 'string "/" TEMPORARY_WORKPLANE) :distance GEAR_WIDTH :keep_wp :yes) (delete_2d :all_2d);---------Erase the tooth 2d profile (circle :cen_dia GEAR_CENTER_POINT HUB_DIAMETER);-----Draw the circle for the hub diameter ; (EXTRUDE :wp TEMPORARY_WORKPLANE :distance (+ HUB_PROJECTION GEAR_WIDTH));-----Extrude the hub diameter (extrude :wp (concatenate 'string "/" TEMPORARY_WORKPLANE) :distance (+ HUB_PROJECTION GEAR_WIDTH) :keep_wp :yes);-----Extrude the hub diameter (delete_2d :all_2d);-----Erase the hub 2d profile (circle :cen_dia GEAR_CENTER_POINT BORE_DIAMETER);-----Draw the circle for the bore diameter (punch) (delete_3d :wp (concatenate 'string "/" TEMPORARY_WORKPLANE));-----Erase the hub 2d profile (current_wp SELECTED_WP) );progn );if );if (if (> HUB_DIAMETER 0);------------------------------If there is a hub (if (and (> KEYWAY_WIDTH 0) (> BORE_DIAMETER 0));----------------------------If there is a keyway and a bore (progn (if (= NO_OF_KEYS 1);---------------------------If there is one keyway (progn ; (EXTRUDE :wp TEMPORARY_WORKPLANE :distance GEAR_WIDTH);-----Extrude the tooth profile (extrude :wp (concatenate 'string "/" TEMPORARY_WORKPLANE) :distance GEAR_WIDTH :keep_wp :yes) (delete_2d :all_2d);---------Erase the tooth 2d profile (circle :cen_dia GEAR_CENTER_POINT HUB_DIAMETER);-----Draw the circle for the hub diameter ; (EXTRUDE :wp TEMPORARY_WORKPLANE :distance (+ HUB_PROJECTION GEAR_WIDTH));-----Extrude the hub diameter (extrude :wp (concatenate 'string "/" TEMPORARY_WORKPLANE) :distance (+ HUB_PROJECTION GEAR_WIDTH) :keep_wp :yes);-----Extrude the hub diameter (delete_2d :all_2d);-----Erase the hub 2d profile (setq A (/ BORE_DIAMETER 2.0)) (setq B (/ KEYWAY_WIDTH 2.0)) (setq C (+ (sqrt (- (* A A) (* B B))) KEYWAY_DEPTH A));-----This is the distance from the bottom of the bore to the top of the keyway (setq C (- C A));-----This is the distance from the center of the bore to the top of the keyway (setq TOP_KEYWAY_LEFT (gpnt2d (- X (/ KEYWAY_WIDTH 2.0)) (+ Y C))) (setq TOP_KEYWAY_RIGHT (gpnt2d (+ X (/ KEYWAY_WIDTH 2.0)) (+ Y C))) (setq KEY_X (gpnt2d_x TOP_KEYWAY_LEFT));-----This is the 'x' value of the TOP_KEYWAY_LEFT (setq KEY_Y (gpnt2d_y TOP_KEYWAY_RIGHT));-----This is the 'y' value of the TOP_KEYWAY_RIGHT (setq BOTTOM_KEYWAY_LEFT (gpnt2d (- X (/ KEYWAY_WIDTH 2.0)) (- KEY_Y KEYWAY_DEPTH))) (setq BOTTOM_KEYWAY_RIGHT (gpnt2d (+ X (/ KEYWAY_WIDTH 2.0)) (- KEY_Y KEYWAY_DEPTH))) (ARC :CENTER GEAR_CENTER_POINT BOTTOM_KEYWAY_LEFT BOTTOM_KEYWAY_RIGHT) (LINE :TWO_POINTS BOTTOM_KEYWAY_LEFT TOP_KEYWAY_LEFT) (LINE :TWO_POINTS TOP_KEYWAY_LEFT TOP_KEYWAY_RIGHT) (LINE :TWO_POINTS TOP_KEYWAY_RIGHT BOTTOM_KEYWAY_RIGHT) (punch) (delete_3d (concatenate 'string "/" TEMPORARY_WORKPLANE));-----Erase the hub 2d profile and workplane ; (DELETE_2D :all_2d);-----Erase the hub 2d profile (current_wp SELECTED_WP) );progn );if (if (= NO_OF_KEYS 2);---------------------------If there are two keyways (progn ; (EXTRUDE :wp TEMPORARY_WORKPLANE :distance GEAR_WIDTH);-----Extrude the tooth profile (extrude :wp (concatenate 'string "/" TEMPORARY_WORKPLANE) :distance GEAR_WIDTH :keep_wp :yes) (delete_2d :all_2d);---------Erase the tooth 2d profile (circle :cen_dia GEAR_CENTER_POINT HUB_DIAMETER);-----Draw the circle for the hub diameter ; (EXTRUDE :wp TEMPORARY_WORKPLANE :distance (+ HUB_PROJECTION GEAR_WIDTH));-----Extrude the hub diameter (extrude :wp (concatenate 'string "/" TEMPORARY_WORKPLANE) :distance (+ HUB_PROJECTION GEAR_WIDTH) :keep_wp :yes);-----Extrude the hub diameter (delete_2d :all_2d);-----Erase the hub 2d profile (setq A (/ BORE_DIAMETER 2.0)) (setq B (/ KEYWAY_WIDTH 2.0)) (setq C (+ (sqrt (- (* A A) (* B B))) KEYWAY_DEPTH A));-----This is the distance from the bottom of the bore to the top of the keyway (setq C (- C A));-----This is the distance from the center of the bore to the top of the keyway (setq TOP_KEYWAY_LEFT1 (gpnt2d (- X (/ KEYWAY_WIDTH 2.0)) (+ Y C))) (setq TOP_KEYWAY_RIGHT1 (gpnt2d (+ X (/ KEYWAY_WIDTH 2.0)) (+ Y C))) (setq KEY_X (gpnt2d_x TOP_KEYWAY_LEFT1));-----This is the 'x' value of the TOP_KEYWAY_LEFT1 (setq KEY_Y (gpnt2d_y TOP_KEYWAY_RIGHT1));-----This is the 'y' value of the TOP_KEYWAY_RIGHT1 (setq BOTTOM_KEYWAY_LEFT1 (gpnt2d (- X (/ KEYWAY_WIDTH 2.0)) (- KEY_Y KEYWAY_DEPTH))) (setq BOTTOM_KEYWAY_RIGHT1 (gpnt2d (+ X (/ KEYWAY_WIDTH 2.0)) (- KEY_Y KEYWAY_DEPTH))) (setq TOP_KEYWAY_LEFT2 (gpnt2d (- X (/ KEYWAY_WIDTH 2.0)) (- Y C))) (setq TOP_KEYWAY_RIGHT2 (gpnt2d (+ X (/ KEYWAY_WIDTH 2.0)) (- Y C))) (setq KEY_X (gpnt2d_x TOP_KEYWAY_LEFT2));-----This is the 'x' value of the TOP_KEYWAY_LEFT2 (setq KEY_Y (gpnt2d_y TOP_KEYWAY_RIGHT2));-----This is the 'y' value of the TOP_KEYWAY_RIGHT2 (setq BOTTOM_KEYWAY_LEFT2 (gpnt2d (- X (/ KEYWAY_WIDTH 2.0)) (+ KEY_Y KEYWAY_DEPTH))) (setq BOTTOM_KEYWAY_RIGHT2 (gpnt2d (+ X (/ KEYWAY_WIDTH 2.0)) (+ KEY_Y KEYWAY_DEPTH))) (ARC :CENTER GEAR_CENTER_POINT BOTTOM_KEYWAY_LEFT1 BOTTOM_KEYWAY_LEFT2) (ARC :CENTER GEAR_CENTER_POINT BOTTOM_KEYWAY_RIGHT2 BOTTOM_KEYWAY_RIGHT1) (LINE :TWO_POINTS BOTTOM_KEYWAY_LEFT1 TOP_KEYWAY_LEFT1) (LINE :TWO_POINTS TOP_KEYWAY_LEFT1 TOP_KEYWAY_RIGHT1) (LINE :TWO_POINTS TOP_KEYWAY_RIGHT1 BOTTOM_KEYWAY_RIGHT1) (LINE :TWO_POINTS BOTTOM_KEYWAY_LEFT2 TOP_KEYWAY_LEFT2) (LINE :TWO_POINTS TOP_KEYWAY_LEFT2 TOP_KEYWAY_RIGHT2) (LINE :TWO_POINTS TOP_KEYWAY_RIGHT2 BOTTOM_KEYWAY_RIGHT2) (punch) (delete_3d (concatenate 'string "/" TEMPORARY_WORKPLANE));-----Erase the hub 2d profile and workplane ; (EXTRUDE :wp TEMPORARY_WORKPLANE :distance GEAR_WIDTH) ; (DELETE_2D :all_2d);---------Erase the bore circle and keyway (current_wp SELECTED_WP) );progn );if );progn );if );if );progn );:spur ;****************************************************************************************************************************** ;***********************************************IF A HELICAL GEAR WAS CHOSEN: ;****************************************************************************************************************************** (:HELICAL (progn (INVOLUTE_CALCULATION_FUNCTION CIRCULAR_THICKNESS 0);-----Call the INVOLUTE_CALCULATION_FUNCTION function (RADIAL_LINE_ROOT_FILLET_INTERSECTION_FUNCTION);-----Call the RADIAL_LINE_ROOT_FILLET_INTERSECTION_FUNCTION function (ROOT_FILLET_CENTER_POINT_FUNCTION);-----Call the ROOT_FILLET_CENTER_POINT_FUNCTION function (ROOT_CIRCLE_ROOT_FILLET_INTERSECTION_FUNCTION);-----Call the ROOT_CIRCLE_ROOT_FILLET_INTERSECTION_FUNCTION function (SECOND_ROOT_CIRCLE_ROOT_FILLET_INTERSECTION_FUNCTION);-----Call the SECOND_ROOT_CIRCLE_ROOT_FILLET_INTERSECTION_FUNCTION function (CREATE_SPUR_OR_HELICAL_2D_PROFILE_FUNCTION);-----Run the CREATE_SPUR_OR_HELICAL_2D_PROFILE_FUNCTION function to create 2D profile ;-----Set the variable MATCH_VTX (for Match Vertex) to nil for use later. (setf MATCH_VTX nil) ;-----Add a / to the TEMPORARY_WORKPLANE value (should probably be "Metric-GEARDESIGNER1") (setf TEMPORARY_WORKPLANE (concatenate 'string "/" TEMPORARY_WORKPLANE)) ;-----Slide the workplane (TEMPORARY_WORKPLANE) over to the GEAR_CENTER_POINT (0,0) - This becomes important when the second workplane is created ;-----and needs to be rotated per the HELIX_ANGLE ;(sd-call-cmds (slide_wp_origin TEMPORARY_WORKPLANE GEAR_CENTER_POINT)) ;(sd-call-cmds (slide_wp_origin TEMPORARY_WORKPLANE (gpnt2d SELECTED_X SELECTED_Y))) ;-----Make the TEMPORARY_WORKPLANE (should probably be "Metric-GEARDESIGNER1") the active workplane (sd-call-cmds (current_wp TEMPORARY_WORKPLANE)) ;-----Will create a second base workplane name "Metric-GEARDESIGNERX", where X is a unique number (should probably be "Metric-GEARDESIGNER2") (setq TEMPORARY_WORKPLANE_2 (sd-gen-obj-basename :workplane :prefix "Metric-GEARDESIGNER")) ;-----Since SolidDesigner will take the users variables as millimeters only, we need to scale up the value of GEAR_WIDTH by 25.4 ;-----if the units selected by the user is INCH and save the variable as GEAR_WIDTH_2. (ecase UNITS;-----evaluates the value of "UNITS" (:INCH;-----If the user selected INCH units (setq GEAR_WIDTH_2 (* GEAR_WIDTH 25.4)) );:INCH (:MM;-----If the user selected MM units (setq GEAR_WIDTH_2 GEAR_WIDTH) );MM );ecase ;-----Create the second workplane TEMPORARY_WORKPLANE_2 (probably named "Metric-GEARDESIGNER2") (sd-call-cmds (create_workplane :copy :source TEMPORARY_WORKPLANE :name TEMPORARY_WORKPLANE_2 :owner "/" :par_wp :ref_wp TEMPORARY_WORKPLANE :offset GEAR_WIDTH_2)) ;-----Add a / to the TEMPORARY_WORKPLANE_2 value (should probably be "Metric-GEARDESIGNER2") (setf TEMPORARY_WORKPLANE_2 (concatenate 'string "/" TEMPORARY_WORKPLANE_2)) ;-----Since the creation of the new workplane TEMPORARY_WORKPLANE_2 (probably "Metric-GEARDESIGNER2") changes the active workplane to the workplane just created ;-----("Metric-GEARDESIGNER2"), we need to change the active workplane back to the first workplane, TEMPORARY_WORKPLANE ("Metric-GEARDESIGNER1") (sd-call-cmds (current_wp TEMPORARY_WORKPLANE)) ;-----Obtain the first point for creating the match line called FIRST_POINT (setq FIRST_POINT (first (sd-call-cmds (get_selection :focus_type *sd-match-vertex-2d-seltype* :select RIGHT_SIDE_INVOLUTE_POINT_ONE)))) ;-----Once the first point (FIRST_POINT) is obtained, add that information to the variable MATCH_VTX for creating the match line (push FIRST_POINT MATCH_VTX) ;-----Make the TEMPORARY_WORKPLANE_2 (should probably be "Metric-GEARDESIGNER2") the active workplane to prepare for obtaining the second ;-----match point (sd-call-cmds (current_wp TEMPORARY_WORKPLANE_2)) ;-----Obtain the second point for creating the match line called SECOND_POINT (setq SECOND_POINT (first (sd-call-cmds (get_selection :focus_type *sd-match-vertex-2d-seltype* :select RIGHT_SIDE_INVOLUTE_POINT_ONE)))) ;-----Once the second point (SECOND_POINT) is obtained, add that information to the variable MATCH_VTX for creating the match line (push SECOND_POINT MATCH_VTX) ;-----Create the match line (when MATCH_VTX (sd-call-cmds (apply #'create_match_line (nreverse MATCH_VTX))) );when ;-----When the match line is created, the two created workplanes TEMPORARY_WORKPLANE and TEMPORARY_WORKPLANE_2 (probably "Metric-GEARDESIGNER1" and ;-----"Metric-GEARDESIGNER2" respectively) are joined in a workplane set, which assigns a set number to the beginning of the previously assined ;-----workplane names (ie. "/Metric-GEARDESIGNER1" becomes "/s1/Metric-GEARDESIGNER1"). Thus, the previous values of TEMPORARY_WORKPLANE and TEMPORARY_WORKPLANE_2 ;-----can no longer be used to used to reference the two created workplanes (again, because they now have new workplane set names). So, we ;-----have to obtain the new workplane set names. ;-----Since TEMPORARY_WORKPLANE_2 is still the active workplane, we can easily obtain its new name and reset the TEMPORARY_WORKPLANE_2 variable ;-----as follows: (setq TEMPORARY_WORKPLANE_2 (oli::sd-inq-obj-pathname (oli::sd-inq-curr-wp))) ;-----Resetting TEMPORARY_WORKPLANE is a bit more complex. There is no command in SolidDesigner to get all of the workplane name except for the ;-----basename (ie. Have "/s1/Metric-GEARDESIGNER1", just get "/s1"), so we have to obtain all of the individual elements of the entire path for use ;-----in creating a new path for TEMPORARY_WORKPLANE_2. Here, we take the current workplane name and divide it in its separate elements using ;-----the command SD-PATHNAME-TO-PATHLIST. This command parses a pathname into a list of its component names. For example, a pathname of the form ;-----"/s1/Metric-GEARDESIGNER1" is converted to ("/" "s1" "Metric-GEARDESIGNER1"). (SETQ PATHNAME (oli::sd-pathname-to-pathlist TEMPORARY_WORKPLANE_2)) ;-----Set the variable LENGTH_OF_PATHNAME_LIST to the number of components in the variable PATHNAME (using the above example of "/" "s1" "Metric-GEARDESIGNER1", ;-----the variable LENGTH_OF_PATHNAME_LIST would be set to 3). (setq LENGTH_OF_PATHNAME_LIST (length PATHNAME)) ;-----Now that we know how many components make up the pathname of the workplanes along with the individual components used, we can construct a new pathname ;-----which will represent TEMPORARY_WORKPLANE. We will do this by using a loop. ;-----Set a variable LOOP-COUNT to nil for use as our loop counter (setq LOOP-COUNT nil) ;-----Set a generic variable N as an increment variable in our loop (setq N 2) ;-----Set another generic variable K as an increment variable in our loop (setq K (- length_of_pathname_list 1)) ;-----The following DOTIMES builds the full name TEMPORARY_WORKPLANE (dotimes (loop-count K) (progn (setq J (- LENGTH_OF_PATHNAME_LIST N)) (if (= J 0.0) (progn (setq TEMPORARY_WORKPLANE (concatenate 'string (elt PATHNAME 0) TEMPORARY_WORKPLANE)) );progn );if (unless (= J 0.0) (setq TEMPORARY_WORKPLANE (concatenate 'string (elt PATHNAME (- LENGTH_OF_PATHNAME_LIST N)) TEMPORARY_WORKPLANE)) );unless (setq N (+ N 1.0)) );progn );dotimes (if (string= "INCH" (elt length&length_factor 0)) (progn (ecase UNITS;-----evaluates the value of "UNITS" (:INCH;-----If the user selected INCH units (progn (sd-call-cmds (current_wp TEMPORARY_WORKPLANE)) (sd-call-cmds (position_wp TEMPORARY_WORKPLANE :translate :two_ptv 0,0,0 (gpnt3d (* SELECTED_X 25.4) (* SELECTED_Y 25.4) 0))) (sd-call-cmds (current_wp TEMPORARY_WORKPLANE_2)) (sd-call-cmds (position_wp TEMPORARY_WORKPLANE_2 :translate :two_ptv 0,0,0 (gpnt3d (* SELECTED_X 25.4) (* SELECTED_Y 25.4) 0))) );progn );:INCH (:MM;-------If the user selected MM units (sd-call-cmds (current_wp TEMPORARY_WORKPLANE)) (sd-call-cmds (position_wp TEMPORARY_WORKPLANE :translate :two_ptv 0,0,0 (gpnt3d SELECTED_X SELECTED_Y 0))) (sd-call-cmds (current_wp TEMPORARY_WORKPLANE_2)) (sd-call-cmds (position_wp TEMPORARY_WORKPLANE_2 :translate :two_ptv 0,0,0 (gpnt3d SELECTED_X SELECTED_Y 0))) );:MM );ecase );progn );if (if (string= "MM" (elt length&length_factor 0)) (progn (ecase UNITS;-----evaluates the value of "UNITS" (:INCH;-----If the user selected INCH units (progn (sd-call-cmds (current_wp TEMPORARY_WORKPLANE)) (sd-call-cmds (position_wp TEMPORARY_WORKPLANE :translate :two_ptv 0,0,0 (gpnt3d (* SELECTED_X 25.4) (* SELECTED_Y 25.4) 0))) (sd-call-cmds (current_wp TEMPORARY_WORKPLANE_2)) (sd-call-cmds (position_wp TEMPORARY_WORKPLANE_2 :translate :two_ptv 0,0,0 (gpnt3d (* SELECTED_X 25.4) (* SELECTED_Y 25.4) 0))) );progn );:INCH (:MM;-------If the user selected MM units (sd-call-cmds (current_wp TEMPORARY_WORKPLANE)) (sd-call-cmds (position_wp TEMPORARY_WORKPLANE :translate :two_ptv 0,0,0 (gpnt3d SELECTED_X SELECTED_Y 0))) (sd-call-cmds (current_wp TEMPORARY_WORKPLANE_2)) (sd-call-cmds (position_wp TEMPORARY_WORKPLANE_2 :translate :two_ptv 0,0,0 (gpnt3d SELECTED_X SELECTED_Y 0))) );:MM );ecase );progn );if (ecase UNITS;-----evaluates the value of "UNITS" (:INCH;-----If the user selected INCH units (progn ;-----Now with the match line created workplanes names set, we can rotate the current workplane per the HELIX_ANGLE ;-----First, we must do a few calculations to obtain the desired workplane rotation to result in the correct helix angle (setq A (* GEAR_WIDTH (tan (/ (* HELIX_ANGLE pi) 180.0)))) (setq B (asin (/ A ADDENDUM_CIRCLE_RADIUS))) (setq ROTATION_VALUE_FOR_HELIX_ANGLE (/ (* B 180.0) pi)) ;-----Now that the users HELIX_ANGLE has been converted to the rotation angle needed to supply the correct HELIX_ANGLE, ;-----we can rotate the workplane per the new calculated value ROTATION_VALUE_FOR_HELIX_ANGLE. (sd-call-cmds (position_wp (oli::sd-inq-curr-wp) :rotate :axis :w :rotation_angle (sd-deg-to-rad ROTATION_VALUE_FOR_HELIX_ANGLE))) ;-----Since the use of SD-CALL-CMDS sets everything to millimeters, we need to scale up the 2D geometry by 25.4 (scale_2d :select :all_2d :center_point GEAR_CENTER_POINT :scale_factor 25.4) (sd-call-cmds (current_wp TEMPORARY_WORKPLANE)) ;-----Since the use of SD-CALL-CMDS sets everything to millimeters, we need to scale up the 2D geometry by 25.4 (scale_2d :select :all_2d :center_point GEAR_CENTER_POINT :scale_factor 25.4) );progn );:INCH (:MM;-----If the user selected MM units ;-----Now with the match line created workplanes names set, we can rotate the current workplane per the HELIX_ANGLE ;-----First, we must do a few calculations to obtain the desired workplane rotation to result in the correct helix angle (setq A (* GEAR_WIDTH (tan (/ (* HELIX_ANGLE pi) 180.0)))) (setq B (asin (/ A ADDENDUM_CIRCLE_RADIUS))) (setq ROTATION_VALUE_FOR_HELIX_ANGLE (/ (* B 180.0) pi)) (sd-call-cmds (position_wp (oli::sd-inq-curr-wp) :rotate :axis :w :rotation_angle (sd-deg-to-rad ROTATION_VALUE_FOR_HELIX_ANGLE))) );MM );ecase ;-----Now that the helix profiles have been created, loft between them: (if (and (= BORE_DIAMETER 0) (= HUB_DIAMETER 0));-----If there is no bore and no hub (progn ; (extrude :wp (concatenate 'string "/" TEMPORARY_WORKPLANE) :distance GEAR_WIDTH :keep_wp :no) (add_loft :keep_tool :no :loft_check :no) (current_wp SELECTED_WP) (if (string= "INCH" (elt length&length_factor 0)) (progn (sd-call-cmds (units :inch)) );:progn );if (if (string= "MM" (elt length&length_factor 0)) (progn (sd-call-cmds (units :mm)) );:progn );if );progn );if (if (and (> BORE_DIAMETER 0) (= HUB_DIAMETER 0));-----If there is a bore but no hub (if (= KEYWAY_WIDTH 0);-----------------------------If there is no keyway (progn (add_loft :keep_tool :yes :loft_check :no) (sd-call-cmds (current_wp TEMPORARY_WORKPLANE)) (delete_2d :all_2d);---------Erase the tooth 2d profile (sd-call-cmds (current_wp TEMPORARY_WORKPLANE_2)) (delete_2d :all_2d);---------Erase the tooth 2d profile (circle :cen_dia GEAR_CENTER_POINT BORE_DIAMETER) (punch) (delete_3d TEMPORARY_WORKPLANE_2);-----Erase the workplane TEMPORARY_WORKPLANE_2 (delete_3d TEMPORARY_WORKPLANE);-----Erase the workplane TEMPORARY_WORKPLANE (current_wp SELECTED_WP) (if (string= "INCH" (elt length&length_factor 0)) (progn (sd-call-cmds (units :inch)) );:progn );if (if (string= "MM" (elt length&length_factor 0)) (progn (sd-call-cmds (units :mm)) );:progn );if );progn );if );if (if (and (> BORE_DIAMETER 0) (= HUB_DIAMETER 0));-----If there is a bore but no hub (if (> KEYWAY_WIDTH 0);----------------------------If there is a keyway (progn (if (= NO_OF_KEYS 1);---------------------------If there is one keyway (progn (add_loft :keep_tool :yes :loft_check :no) (sd-call-cmds (current_wp TEMPORARY_WORKPLANE)) (delete_2d :all_2d);---------Erase the tooth 2d profile (sd-call-cmds (current_wp TEMPORARY_WORKPLANE_2)) (delete_2d :all_2d);---------Erase the tooth 2d profile (setq A (/ BORE_DIAMETER 2.0)) (setq B (/ KEYWAY_WIDTH 2.0)) (setq C (+ (sqrt (- (* A A) (* B B))) KEYWAY_DEPTH A));-----This is the distance from the bottom of the bore to the top of the keyway (setq C (- C A));-----This is the distance from the center of the bore to the top of the keyway (setq TOP_KEYWAY_LEFT (gpnt2d (- X (/ KEYWAY_WIDTH 2.0)) (+ Y C))) (setq TOP_KEYWAY_RIGHT (gpnt2d (+ X (/ KEYWAY_WIDTH 2.0)) (+ Y C))) (setq KEY_X (gpnt2d_x TOP_KEYWAY_LEFT));-----This is the 'x' value of the TOP_KEYWAY_LEFT (setq KEY_Y (gpnt2d_y TOP_KEYWAY_RIGHT));-----This is the 'y' value of the TOP_KEYWAY_RIGHT (setq BOTTOM_KEYWAY_LEFT (gpnt2d (- X (/ KEYWAY_WIDTH 2.0)) (- KEY_Y KEYWAY_DEPTH))) (setq BOTTOM_KEYWAY_RIGHT (gpnt2d (+ X (/ KEYWAY_WIDTH 2.0)) (- KEY_Y KEYWAY_DEPTH))) (ARC :CENTER GEAR_CENTER_POINT BOTTOM_KEYWAY_LEFT BOTTOM_KEYWAY_RIGHT) (LINE :TWO_POINTS BOTTOM_KEYWAY_LEFT TOP_KEYWAY_LEFT) (LINE :TWO_POINTS TOP_KEYWAY_LEFT TOP_KEYWAY_RIGHT) (LINE :TWO_POINTS TOP_KEYWAY_RIGHT BOTTOM_KEYWAY_RIGHT) (punch) (delete_3d TEMPORARY_WORKPLANE_2);-----Erase the workplane TEMPORARY_WORKPLANE_2 (delete_3d TEMPORARY_WORKPLANE);-----Erase the workplane TEMPORARY_WORKPLANE (current_wp SELECTED_WP) (if (string= "INCH" (elt length&length_factor 0)) (progn (sd-call-cmds (units :inch)) );:progn );if (if (string= "MM" (elt length&length_factor 0)) (progn (sd-call-cmds (units :mm)) );:progn );if );progn );if (if (= NO_OF_KEYS 2);----------------------------If there are two keyways (progn (add_loft :keep_tool :yes :loft_check :no) (sd-call-cmds (current_wp TEMPORARY_WORKPLANE)) (delete_2d :all_2d);---------Erase the tooth 2d profile (sd-call-cmds (current_wp TEMPORARY_WORKPLANE_2)) (delete_2d :all_2d);---------Erase the tooth 2d profile (setq A (/ BORE_DIAMETER 2.0)) (setq B (/ KEYWAY_WIDTH 2.0)) (setq C (+ (sqrt (- (* A A) (* B B))) KEYWAY_DEPTH A));-----This is the distance from the bottom of the bore to the top of the keyway (setq C (- C A));-----This is the distance from the center of the bore to the top of the keyway (setq TOP_KEYWAY_LEFT1 (gpnt2d (- X (/ KEYWAY_WIDTH 2.0)) (+ Y C))) (setq TOP_KEYWAY_RIGHT1 (gpnt2d (+ X (/ KEYWAY_WIDTH 2.0)) (+ Y C))) (setq KEY_X (gpnt2d_x TOP_KEYWAY_LEFT1));-----This is the 'x' value of the TOP_KEYWAY_LEFT1 (setq KEY_Y (gpnt2d_y TOP_KEYWAY_RIGHT1));-----This is the 'y' value of the TOP_KEYWAY_RIGHT1 (setq BOTTOM_KEYWAY_LEFT1 (gpnt2d (- X (/ KEYWAY_WIDTH 2.0)) (- KEY_Y KEYWAY_DEPTH))) (setq BOTTOM_KEYWAY_RIGHT1 (gpnt2d (+ X (/ KEYWAY_WIDTH 2.0)) (- KEY_Y KEYWAY_DEPTH))) (setq TOP_KEYWAY_LEFT2 (gpnt2d (- X (/ KEYWAY_WIDTH 2.0)) (- Y C))) (setq TOP_KEYWAY_RIGHT2 (gpnt2d (+ X (/ KEYWAY_WIDTH 2.0)) (- Y C))) (setq KEY_X (gpnt2d_x TOP_KEYWAY_LEFT2));-----This is the 'x' value of the TOP_KEYWAY_LEFT2 (setq KEY_Y (gpnt2d_y TOP_KEYWAY_RIGHT2));-----This is the 'y' value of the TOP_KEYWAY_RIGHT2 (setq BOTTOM_KEYWAY_LEFT2 (gpnt2d (- X (/ KEYWAY_WIDTH 2.0)) (+ KEY_Y KEYWAY_DEPTH))) (setq BOTTOM_KEYWAY_RIGHT2 (gpnt2d (+ X (/ KEYWAY_WIDTH 2.0)) (+ KEY_Y KEYWAY_DEPTH))) (ARC :CENTER GEAR_CENTER_POINT BOTTOM_KEYWAY_LEFT1 BOTTOM_KEYWAY_LEFT2) (ARC :CENTER GEAR_CENTER_POINT BOTTOM_KEYWAY_RIGHT2 BOTTOM_KEYWAY_RIGHT1) (LINE :TWO_POINTS BOTTOM_KEYWAY_LEFT1 TOP_KEYWAY_LEFT1) (LINE :TWO_POINTS TOP_KEYWAY_LEFT1 TOP_KEYWAY_RIGHT1) (LINE :TWO_POINTS TOP_KEYWAY_RIGHT1 BOTTOM_KEYWAY_RIGHT1) (LINE :TWO_POINTS BOTTOM_KEYWAY_LEFT2 TOP_KEYWAY_LEFT2) (LINE :TWO_POINTS TOP_KEYWAY_LEFT2 TOP_KEYWAY_RIGHT2) (LINE :TWO_POINTS TOP_KEYWAY_RIGHT2 BOTTOM_KEYWAY_RIGHT2) ;;; (extrude :wp (concatenate 'string "/" TEMPORARY_WORKPLANE) :distance GEAR_WIDTH :keep_wp :no) (punch) (delete_3d TEMPORARY_WORKPLANE_2);-----Erase the workplane TEMPORARY_WORKPLANE_2 (delete_3d TEMPORARY_WORKPLANE);-----Erase the workplane TEMPORARY_WORKPLANE (current_wp SELECTED_WP) (if (string= "INCH" (elt length&length_factor 0)) (progn (sd-call-cmds (units :inch)) );:progn );if (if (string= "MM" (elt length&length_factor 0)) (progn (sd-call-cmds (units :mm)) );:progn );if );progn );if );progn );if );if (if (> HUB_DIAMETER 0);------------------------------If there is a hub (if (= BORE_DIAMETER 0);----------------------------If there is no bore (progn (add_loft :keep_tool :yes :loft_check :no) (sd-call-cmds (current_wp TEMPORARY_WORKPLANE)) (delete_2d :all_2d);---------Erase the tooth 2d profile (sd-call-cmds (current_wp TEMPORARY_WORKPLANE_2)) (delete_2d :all_2d);---------Erase the tooth 2d profile (circle :cen_dia GEAR_CENTER_POINT HUB_DIAMETER);-----Draw the circle for the hub diameter (extrude :wp TEMPORARY_WORKPLANE_2 :distance HUB_PROJECTION :keep_wp :no);-----Extrude the hub diameter (delete_3d TEMPORARY_WORKPLANE);-----Erase the workplane TEMPORARY_WORKPLANE (current_wp SELECTED_WP) (if (string= "INCH" (elt length&length_factor 0)) (progn (sd-call-cmds (units :inch)) );:progn );if (if (string= "MM" (elt length&length_factor 0)) (progn (sd-call-cmds (units :mm)) );:progn );if );progn );if );if (if (> HUB_DIAMETER 0);------------------------------If there is a hub (if (and (> BORE_DIAMETER 0) (= KEYWAY_WIDTH 0));---------------------------If there is a bore but no keyway (progn (add_loft :keep_tool :yes :loft_check :no) (sd-call-cmds (current_wp TEMPORARY_WORKPLANE)) (delete_2d :all_2d);---------Erase the tooth 2d profile (sd-call-cmds (current_wp TEMPORARY_WORKPLANE_2)) (delete_2d :all_2d);---------Erase the tooth 2d profile (circle :cen_dia GEAR_CENTER_POINT HUB_DIAMETER);-----Draw the circle for the hub diameter (extrude :wp TEMPORARY_WORKPLANE_2 :distance HUB_PROJECTION :keep_wp :yes);-----Extrude the hub diameter (sd-call-cmds (current_wp TEMPORARY_WORKPLANE)) (circle :cen_dia GEAR_CENTER_POINT BORE_DIAMETER);-----Draw the circle for the bore diameter (punch) (delete_3d TEMPORARY_WORKPLANE);-----Erase the workplane TEMPORARY_WORKPLANE (delete_3d TEMPORARY_WORKPLANE_2);-----Erase the workplane TEMPORARY_WORKPLANE_2 (current_wp SELECTED_WP) (if (string= "INCH" (elt length&length_factor 0)) (progn (sd-call-cmds (units :inch)) );:progn );if (if (string= "MM" (elt length&length_factor 0)) (progn (sd-call-cmds (units :mm)) );:progn );if );progn );if );if (if (> HUB_DIAMETER 0);------------------------------If there is a hub (if (and (> KEYWAY_WIDTH 0) (> BORE_DIAMETER 0));----------------------------If there is a keyway and a bore (progn (if (= NO_OF_KEYS 1);---------------------------If there is one keyway (progn (add_loft :keep_tool :yes :loft_check :no) (sd-call-cmds (current_wp TEMPORARY_WORKPLANE)) (delete_2d :all_2d);---------Erase the tooth 2d profile (sd-call-cmds (current_wp TEMPORARY_WORKPLANE_2)) (delete_2d :all_2d);---------Erase the tooth 2d profile (setq A (/ BORE_DIAMETER 2.0)) (setq B (/ KEYWAY_WIDTH 2.0)) (setq C (+ (sqrt (- (* A A) (* B B))) KEYWAY_DEPTH A));-----This is the distance from the bottom of the bore to the top of the keyway (setq C (- C A));-----This is the distance from the center of the bore to the top of the keyway (setq TOP_KEYWAY_LEFT (gpnt2d (- X (/ KEYWAY_WIDTH 2.0)) (+ Y C))) (setq TOP_KEYWAY_RIGHT (gpnt2d (+ X (/ KEYWAY_WIDTH 2.0)) (+ Y C))) (setq KEY_X (gpnt2d_x TOP_KEYWAY_LEFT));-----This is the 'x' value of the TOP_KEYWAY_LEFT (setq KEY_Y (gpnt2d_y TOP_KEYWAY_RIGHT));-----This is the 'y' value of the TOP_KEYWAY_RIGHT (setq BOTTOM_KEYWAY_LEFT (gpnt2d (- X (/ KEYWAY_WIDTH 2.0)) (- KEY_Y KEYWAY_DEPTH))) (setq BOTTOM_KEYWAY_RIGHT (gpnt2d (+ X (/ KEYWAY_WIDTH 2.0)) (- KEY_Y KEYWAY_DEPTH))) (circle :cen_dia GEAR_CENTER_POINT HUB_DIAMETER);-----Draw the circle for the hub diameter (extrude :wp TEMPORARY_WORKPLANE_2 :distance HUB_PROJECTION :keep_wp :yes);-----Extrude the hub diameter (delete_2d :all_2d);---------Erase the hub circle (ARC :CENTER GEAR_CENTER_POINT BOTTOM_KEYWAY_LEFT BOTTOM_KEYWAY_RIGHT) (LINE :TWO_POINTS BOTTOM_KEYWAY_LEFT TOP_KEYWAY_LEFT) (LINE :TWO_POINTS TOP_KEYWAY_LEFT TOP_KEYWAY_RIGHT) (LINE :TWO_POINTS TOP_KEYWAY_RIGHT BOTTOM_KEYWAY_RIGHT) (punch) (delete_3d TEMPORARY_WORKPLANE_2);-----Erase the workplane TEMPORARY_WORKPLANE_2 (delete_3d TEMPORARY_WORKPLANE);-----Erase the workplane TEMPORARY_WORKPLANE (current_wp SELECTED_WP) (if (string= "INCH" (elt length&length_factor 0)) (progn (sd-call-cmds (units :inch)) );:progn );if (if (string= "MM" (elt length&length_factor 0)) (progn (sd-call-cmds (units :mm)) );:progn );if );progn );if (if (= NO_OF_KEYS 2);---------------------------If there are two keyways (progn (add_loft :keep_tool :yes :loft_check :no) (sd-call-cmds (current_wp TEMPORARY_WORKPLANE)) (delete_2d :all_2d);---------Erase the tooth 2d profile (sd-call-cmds (current_wp TEMPORARY_WORKPLANE_2)) (delete_2d :all_2d);---------Erase the tooth 2d profile (setq A (/ BORE_DIAMETER 2.0)) (setq B (/ KEYWAY_WIDTH 2.0)) (setq C (+ (sqrt (- (* A A) (* B B))) KEYWAY_DEPTH A));-----This is the distance from the bottom of the bore to the top of the keyway (setq C (- C A));-----This is the distance from the center of the bore to the top of the keyway (setq TOP_KEYWAY_LEFT1 (gpnt2d (- X (/ KEYWAY_WIDTH 2.0)) (+ Y C))) (setq TOP_KEYWAY_RIGHT1 (gpnt2d (+ X (/ KEYWAY_WIDTH 2.0)) (+ Y C))) (setq KEY_X (gpnt2d_x TOP_KEYWAY_LEFT1));-----This is the 'x' value of the TOP_KEYWAY_LEFT1 (setq KEY_Y (gpnt2d_y TOP_KEYWAY_RIGHT1));-----This is the 'y' value of the TOP_KEYWAY_RIGHT1 (setq BOTTOM_KEYWAY_LEFT1 (gpnt2d (- X (/ KEYWAY_WIDTH 2.0)) (- KEY_Y KEYWAY_DEPTH))) (setq BOTTOM_KEYWAY_RIGHT1 (gpnt2d (+ X (/ KEYWAY_WIDTH 2.0)) (- KEY_Y KEYWAY_DEPTH))) (setq TOP_KEYWAY_LEFT2 (gpnt2d (- X (/ KEYWAY_WIDTH 2.0)) (- Y C))) (setq TOP_KEYWAY_RIGHT2 (gpnt2d (+ X (/ KEYWAY_WIDTH 2.0)) (- Y C))) (setq KEY_X (gpnt2d_x TOP_KEYWAY_LEFT2));-----This is the 'x' value of the TOP_KEYWAY_LEFT2 (setq KEY_Y (gpnt2d_y TOP_KEYWAY_RIGHT2));-----This is the 'y' value of the TOP_KEYWAY_RIGHT2 (setq BOTTOM_KEYWAY_LEFT2 (gpnt2d (- X (/ KEYWAY_WIDTH 2.0)) (+ KEY_Y KEYWAY_DEPTH))) (setq BOTTOM_KEYWAY_RIGHT2 (gpnt2d (+ X (/ KEYWAY_WIDTH 2.0)) (+ KEY_Y KEYWAY_DEPTH))) (circle :cen_dia GEAR_CENTER_POINT HUB_DIAMETER);-----Draw the circle for the hub diameter (extrude :wp TEMPORARY_WORKPLANE_2 :distance HUB_PROJECTION :keep_wp :yes);-----Extrude the hub diameter (delete_2d :all_2d);---------Erase the hub circle (ARC :CENTER GEAR_CENTER_POINT BOTTOM_KEYWAY_LEFT1 BOTTOM_KEYWAY_LEFT2) (ARC :CENTER GEAR_CENTER_POINT BOTTOM_KEYWAY_RIGHT2 BOTTOM_KEYWAY_RIGHT1) (LINE :TWO_POINTS BOTTOM_KEYWAY_LEFT1 TOP_KEYWAY_LEFT1) (LINE :TWO_POINTS TOP_KEYWAY_LEFT1 TOP_KEYWAY_RIGHT1) (LINE :TWO_POINTS TOP_KEYWAY_RIGHT1 BOTTOM_KEYWAY_RIGHT1) (LINE :TWO_POINTS BOTTOM_KEYWAY_LEFT2 TOP_KEYWAY_LEFT2) (LINE :TWO_POINTS TOP_KEYWAY_LEFT2 TOP_KEYWAY_RIGHT2) (LINE :TWO_POINTS TOP_KEYWAY_RIGHT2 BOTTOM_KEYWAY_RIGHT2) (punch) (delete_3d TEMPORARY_WORKPLANE_2);-----Erase the workplane TEMPORARY_WORKPLANE_2 (delete_3d TEMPORARY_WORKPLANE);-----Erase the workplane TEMPORARY_WORKPLANE (current_wp SELECTED_WP) (if (string= "INCH" (elt length&length_factor 0)) (progn (sd-call-cmds (units :inch)) );:progn );if (if (string= "MM" (elt length&length_factor 0)) (progn (sd-call-cmds (units :mm)) );:progn );if );progn );if );progn );if );if );progn );:HELICAL ;****************************************************************************************************************************** ;***********************************************IF A BEVEL GEAR WAS CHOSEN:**************************************************** ;****************************************************************************************************************************** ((:BEVEL :PINION) (progn (setq TEMPORARY_PARTNAME (sd-gen-obj-basename :part :prefix "Metric-GEARDESIGNER_Bevel_Tooth"));-----Will create a base workplane name "Metric-GEARDESIGNER_Bevel_ToothX", where X is a unique number (setq TEMPORARY_PARTNAME_2 (sd-gen-obj-basename :part :prefix "Metric-GEARDESIGNER_Bevel_Center"));-----Will create a base workplane name "Metric-GEARDESIGNER_Bevel_CenterX", where X is a unique number (setq TEMPORARY_PARTNAME_3 (sd-gen-obj-basename :part :prefix "Metric-GEARDESIGNER_Bevel_Gear"));-----Will create a base workplane name "Metric-GEARDESIGNER_Bevel_GearX", where X is a unique number (sd-call-cmds (CREATE_PART :NAME TEMPORARY_PARTNAME)) (setq TEMPORARY_WORKPLANE (sd-gen-obj-basename :workplane :prefix "Metric-GEARDESIGNER"));-----Will create a base workplane name "Metric-GEARDESIGNERX", where X is a unique number (setq MOUNTING_DISTANCE_OFFSET_VALUE 0.0) ;-----We are going to create two 2D profiles for creating the bevel tooth - one profile for the heel of the tooth and a second for the toe of the tooth. ;-----The distance between these two profiles will be the user-specified FACE_WIDTH. So, save the FACE_WIDTH as WORKPLANE_OFFSET_VALUE: (setq WORKPLANE_OFFSET_VALUE FACE_WIDTH) ;-----Since SolidDesigner will take the users variables as millimeters only, we need to scale up the value of WORKPLANE_OFFSET_VALUE by 25.4 ;-----if the units selected by the user is INCH and save the variable as WORKPLANE_OFFSET_VALUE_2. I only need to use this new variable when ;-----creating the new workplane. (ecase UNITS;-----evaluates the value of "UNITS" (:INCH;-----If the user selected INCH units (setq WORKPLANE_OFFSET_VALUE_2 (* WORKPLANE_OFFSET_VALUE 25.4)) );:INCH (:MM;-----If the user selected MM units (setq WORKPLANE_OFFSET_VALUE_2 WORKPLANE_OFFSET_VALUE) );MM );ecase ;-----Now create a new workplane TEMPORARY_WORKPLANE (should probably be "Metric-GEARDESIGNER1") on top of the user-specified workplane. (sd-call-cmds (CREATE_WORKPLANE :NEW :NAME TEMPORARY_WORKPLANE :PAR_WP :REF_WP SELECTED_WP)); ;-----We are about ready to create the 2D geometry for the toe of the bevel tooth, but before we do, we need to calculate what value for backlash ;-----we should use. The user may have specified a backlash value for the toe of the tooth. If they did, we need to calculate a value to use ;-----for the backlash. Creating the backlash for the heel of the tooth is simple since the heel of the tooth remains unchanged during the course ;-----of creating the gear (ie. it doesn't get milled back to a specific distance like the toe of the tooth does). However, the front of the gear ;-----(which includes the toe of the gear) DOES get milled back a specific distance (it gets milled back to obtain the user-specified face width). ;-----What this means is that the program creates two 2D profiles: one of the heel of the tooth and a second for the toe of the tooth. The 2D profile ;-----for the toe of the tooth, however, gets scaled down in order to obtain the addendum angle. Therefore, since the 2D profile is drawn large and ;-----then scaled down, we need to calculate a scale factor to use to either increase or decrease the users backlash so that when the 2D profile ;-----is scaled down, the backlash the user wants will be obtained. To do this, we first calculate a scale factor to scale the 2D toe profile down. ;-----Once we have this, we can divide 1 by this value to obtain how much larger the backlash should be created before it gets scaled down. (setq A (* FACE_WIDTH (tan (oli:sd-deg-to-rad FACE_ANGLE)))) (setq B (- ADDENDUM A)) (setq SECOND_BEVEL_GEAR_2D_SCALE_FACTOR (/ B Addendum)) ;-----Now that we have the above value, we can calculate the percentage the users toe backlash should be either scaled up or down by: (unless (= BEVEL_TOE_BACKLASH 0.0) (setq BEVEL_TOE_BACKLASH (* BEVEL_TOE_BACKLASH (/ 1.0 SECOND_BEVEL_GEAR_2D_SCALE_FACTOR))) );unless ;-----To begin the creation of the bevel gear, we first create the 2D geometry at the toe of the gear by calling the following two functions: (ecase TYPE_OF_GEAR;-----evaluates the value of "TYPE_OF_GEAR" (:BEVEL (INVOLUTE_CALCULATION_FUNCTION (/ CIRCULAR_PITCH 2.0) BEVEL_TOE_BACKLASH);-----Call the INVOLUTE_CALCULATION_FUNCTION function );BEVEL (:PINION (INVOLUTE_CALCULATION_FUNCTION ORIGINALLY_CALCULATED_BEVEL_HEEL_CIRCULAR_THICKNESS BEVEL_TOE_BACKLASH);-----Call the INVOLUTE_CALCULATION_FUNCTION function );PINION );ecase (CREATE_BEVEL_2D_PROFILE_FUNCTION);-----Run the CREATE_BEVEL_2D_PROFILE_FUNCTION function to create 2D profile ;-----Set the variable MATCH_VTX (for Match Vertex) to nil for use later. (setf MATCH_VTX nil) ;-----Add a / to the TEMPORARY_WORKPLANE value (should probably be "Metric-GEARDESIGNER1") (setf TEMPORARY_WORKPLANE (concatenate 'string "/" TEMPORARY_WORKPLANE)) ;-----Will create a second base workplane name "Metric-GEARDESIGNERX", where X is a unique number (should probably be "Metric-GEARDESIGNER2") (setq TEMPORARY_WORKPLANE_2 (sd-gen-obj-basename :workplane :prefix "Metric-GEARDESIGNER")) ;-----Obtain the first point for creating the match line called FIRST_POINT (setq FIRST_POINT (first (sd-call-cmds (get_selection :focus_type *sd-match-vertex-2d-seltype* :select 0,0))));RIGHT_SIDE_INVOLUTE_POINT_ONE)))) ;-----Once the first point (FIRST_POINT) is obtained, add that information to the variable MATCH_VTX for creating the match line (push FIRST_POINT MATCH_VTX) ;-----Now create a second workplane for creating the 2D profile for the heel of the gear tooth. Create it parallel to the first workplane ;-----(should probably be "Metric-GEARDESIGNER1"), with a distance of WORKPLANE_OFFSET_VALUE_2 away: (sd-call-cmds (create_workplane :new :name TEMPORARY_WORKPLANE_2 :owner "/" :par_wp :ref_wp TEMPORARY_WORKPLANE :offset (* -1.0 WORKPLANE_OFFSET_VALUE_2))) ;-----Now that we have a second workplane created (for the heel of the gear), we create the 2D geometry at the heel of the gear by calling the following two functions: (ecase TYPE_OF_GEAR;-----evaluates the value of "TYPE_OF_GEAR" (:BEVEL (INVOLUTE_CALCULATION_FUNCTION (/ CIRCULAR_PITCH 2.0) BEVEL_HEEL_BACKLASH);-----Call the INVOLUTE_CALCULATION_FUNCTION function );BEVEL (:PINION (INVOLUTE_CALCULATION_FUNCTION ORIGINALLY_CALCULATED_BEVEL_HEEL_CIRCULAR_THICKNESS BEVEL_HEEL_BACKLASH);-----Call the INVOLUTE_CALCULATION_FUNCTION function );PINION );ecase (CREATE_BEVEL_2D_PROFILE_FUNCTION);-----Run the CREATE_BEVEL_2D_PROFILE_FUNCTION function to create 2D profile ;-----Add a / to the TEMPORARY_WORKPLANE_2 value (should probably be "Metric-GEARDESIGNER2") (setf TEMPORARY_WORKPLANE_2 (concatenate 'string "/" TEMPORARY_WORKPLANE_2)) ;-----Make the TEMPORARY_WORKPLANE_2 (should probably be "Metric-GEARDESIGNER2") the active workplane to prepare for obtaining the second ;-----match point (sd-call-cmds (current_wp TEMPORARY_WORKPLANE_2)) ;*********************************** ;-----Will create a second base workplane name "Metric-GEARDESIGNERX", where X is a unique number (should probably be "Metric-GEARDESIGNER3") (setq TEMPORARY_WORKPLANE_10 (sd-gen-obj-basename :workplane :prefix "Metric-GEARDESIGNER")) (sd-call-cmds (create_workplane :new :name TEMPORARY_WORKPLANE_10 :owner "/" :par_wp :ref_wp TEMPORARY_WORKPLANE :offset (* -1.0 WORKPLANE_OFFSET_VALUE_2))) ;-----Add a / to the TEMPORARY_WORKPLANE_10 value (should probably be "Metric-GEARDESIGNER3") (setf TEMPORARY_WORKPLANE_10 (concatenate 'string "/" TEMPORARY_WORKPLANE_10)) ;*********************************** ;-----Make the TEMPORARY_WORKPLANE_2 (should probably be "Metric-GEARDESIGNER2") the active workplane to prepare for obtaining the second ;-----match point (sd-call-cmds (current_wp TEMPORARY_WORKPLANE_2)) ;-----Obtain the second point for creating the match line called SECOND_POINT (setq SECOND_POINT (first (sd-call-cmds (get_selection :focus_type *sd-match-vertex-2d-seltype* :select 0,0))));RIGHT_SIDE_INVOLUTE_POINT_ONE)))) ;-----Once the second point (SECOND_POINT) is obtained, add that information to the variable MATCH_VTX for creating the match line (push SECOND_POINT MATCH_VTX) ;-----Create the match line (when MATCH_VTX (sd-call-cmds (apply #'create_match_line (nreverse MATCH_VTX))) );when (remove_from_vp_drawlist (first (sd-inq-vp-names)) :with-wp (oli:sd-inq-curr-part) complete);-----Turns off bevel tooth (so it's not seen on screen) ;-----When the match line is created, the two created workplanes TEMPORARY_WORKPLANE and TEMPORARY_WORKPLANE_2 (probably "Metric-GEARDESIGNER1" and ;-----"Metric-GEARDESIGNER2" respectively) are joined in a workplane set, which assigns a set number to the beginning of the previously assined ;-----workplane names (ie. "/Metric-GEARDESIGNER1" becomes "/s1/Metric-GEARDESIGNER1"). Thus, the previous values of TEMPORARY_WORKPLANE and TEMPORARY_WORKPLANE_2 ;-----can no longer be used to used to reference the two created workplanes (again, because they now have new workplane set names). So, we ;-----have to obtain the new workplane set names. ;-----Since TEMPORARY_WORKPLANE_2 is still the active workplane, we can easily obtain its new name and reset the TEMPORARY_WORKPLANE_2 variable ;-----as follows: (setq TEMPORARY_WORKPLANE_2 (oli::sd-inq-obj-pathname (oli::sd-inq-curr-wp))) ;-----Resetting TEMPORARY_WORKPLANE is a bit more complex. There is no command in SolidDesigner to get all of the workplane name except for the ;-----basename (ie. Have "/s1/Metric-GEARDESIGNER1", just get "/s1"), so we have to obtain all of the individual elements of the entire path for use ;-----in creating a new path for TEMPORARY_WORKPLANE_2. Here, we take the current workplane name and divide it in its separate elements using ;-----the command SD-PATHNAME-TO-PATHLIST. This command parses a pathname into a list of its component names. For example, a pathname of the form ;-----"/s1/Metric-GEARDESIGNER1" is converted to ("/" "s1" "Metric-GEARDESIGNER1"). (setq PATHNAME (oli::sd-pathname-to-pathlist TEMPORARY_WORKPLANE_2)) ;-----Set the variable LENGTH_OF_PATHNAME_LIST to the number of components in the variable PATHNAME (using the above example of "/" "s1" "Metric-GEARDESIGNER1", ;-----the variable LENGTH_OF_PATHNAME_LIST would be set to 3). (setq LENGTH_OF_PATHNAME_LIST (length PATHNAME)) ;-----Now that we know how many components make up the pathname of the workplanes along with the individual components used, we can construct a new pathname ;-----which will represent TEMPORARY_WORKPLANE. We will do this by using a loop. ;-----Set a variable LOOP-COUNT to nil for use as our loop counter (setq LOOP-COUNT nil) ;-----Set a generic variable N as an increment variable in our loop (setq N 2) ;-----Set another generic variable K as an increment variable in our loop (setq K (- length_of_pathname_list 1)) ;-----The following DOTIMES builds the full name TEMPORARY_WORKPLANE (dotimes (loop-count K) (progn (setq J (- LENGTH_OF_PATHNAME_LIST N)) (if (= J 0.0) (progn (setq TEMPORARY_WORKPLANE (concatenate 'string (elt PATHNAME 0) TEMPORARY_WORKPLANE)) );progn );if (unless (= J 0.0) (setq TEMPORARY_WORKPLANE (concatenate 'string (elt PATHNAME (- LENGTH_OF_PATHNAME_LIST N)) TEMPORARY_WORKPLANE)) );unless (setq N (+ N 1.0)) );progn );dotimes ;-----Evaluate if INCH units were selected. If they were, scale everything up. (ecase UNITS;-----evaluates the value of "UNITS" (:INCH;-----If the user selected INCH units (progn ;-----Make the TEMPORARY_WORKPLANE (should probably be "Metric-GEARDESIGNER1") the active workplane to prepare for scaling up the 2D profile ;-----(if necessary) (sd-call-cmds (current_wp TEMPORARY_WORKPLANE)) ;-----Since the use of SD-CALL-CMDS sets everything to millimeters, we need to scale up the 2D geometry by 25.4 (scale_2d :select :all_2d :center_point GEAR_CENTER_POINT :scale_factor 25.4) ;-----Make the TEMPORARY_WORKPLANE_2 (should probably be "Metric-GEARDESIGNER2") the active workplane to prepare for scaling up the 2D profile ;-----(if necessary) (sd-call-cmds (current_wp TEMPORARY_WORKPLANE_2)) ;-----Since the use of SD-CALL-CMDS sets everything to millimeters, we need to scale up the 2D geometry by 25.4 (scale_2d :select :all_2d :center_point GEAR_CENTER_POINT :scale_factor 25.4) );progn );:INCH (:MM;-------If the user selected MM units );:MM );ecase ;-----Make the TEMPORARY_WORKPLANE (should probably be "Metric-GEARDESIGNER") the active workplane to prepare for obtaining the second ;-----match point (sd-call-cmds (current_wp TEMPORARY_WORKPLANE)) ;-----Now we scale the second 2D tooth profile by the SECOND_BEVEL_GEAR_2D_SCALE_FACTOR variable. We have to specify the scale origin as the center of the ;-----tooth at the pitch circle radius to maintain the pitch angle line. (scale_2d :select :all_2d :center_point (gpnt2d 0 PITCH_CIRCLE_RADIUS) :scale_factor SECOND_BEVEL_GEAR_2D_SCALE_FACTOR) ;-----Will create a third base workplane name "Metric-GEARDESIGNERX", where X is a unique number (should probably be "Metric-GEARDESIGNER3") (setq TEMPORARY_WORKPLANE_3 (sd-gen-obj-basename :workplane :prefix "Metric-GEARDESIGNER")) ;-----Make the TEMPORARY_WORKPLANE_2 (should probably be "Metric-GEARDESIGNER2") the active workplane: (sd-call-cmds (current_wp TEMPORARY_WORKPLANE_2)) ;-----Create the third workplane TEMPORARY_WORKPLANE_3 (probably named "Metric-GEARDESIGNER3") (sd-call-cmds (create_workplane :copy :source TEMPORARY_WORKPLANE_2 :name TEMPORARY_WORKPLANE_3 :owner "/" :rotate :axis :v :rotation_angle (oli:sd-deg-to-rad 90))) ;-----Add a / to the TEMPORARY_WORKPLANE_3 value (should probably be "Metric-GEARDESIGNER3") (setf TEMPORARY_WORKPLANE_3 (concatenate 'string "/" TEMPORARY_WORKPLANE_3)) ;************************************** ;-----The mounting distance specified by the user may be larger than the horizontal distance between the pitch apex and the intersection between the ;-----pitch diameter and pitch angle. When this happens, the heel of the gear needs to be extended back away from the pitch apex (in the same fashion ;-----as the toe of the first bevel tooth is extended in the beginning of the program). So, we first must check to see if the supplied mounting ;-----surface value is larger than the horizontal distance between the pitch apex and the intersection between the pitch diameter and pitch angle. If ;-----this is the case, then we must extend the heel of the gear away from the pitch apex. We will do this by moving the workplane which contains the ;-----2D geometry of the heel of the tooth (TEMPORARY_WORKPLANE) away from the workplane which has the 2D geometry of the toe of the tooth ;-----(TEMPORARY_WORKPLANE_2), scaling it up, and then lofting between the toe and heel 2D profiles. (if (> MOUNTING_DISTANCE (* (/ USERS_INPUTTED_PITCH_DIAMETER 2.0) (tan (oli:sd-deg-to-rad (- 90.0 PITCH_ANGLE))))) (progn ;-----Make the TEMPORARY_WORKPLANE_2 (should probably be the new "/s1/Metric-GEARDESIGNER2") the active workplane: (sd-call-cmds (current_wp TEMPORARY_WORKPLANE_2)) (setq A (/ (/ USERS_INPUTTED_PITCH_DIAMETER 2.0) (sin (oli:sd-deg-to-rad PITCH_ANGLE)))) (setq B (/ MOUNTING_DISTANCE (cos (oli:sd-deg-to-rad PITCH_ANGLE)))) (setq C (- B A)) (setq D (* C (tan (oli:sd-deg-to-rad (- USERS_INPUTTED_FACE_ANGLE PITCH_ANGLE))))) (setq E (/ (+ ADDENDUM D) ADDENDUM));-----This is the scale factor (setq MOUNTING_DISTANCE_OFFSET_VALUE (- (/ B (sin (oli:sd-deg-to-rad (- 90.0 PITCH_ANGLE)))) (/ PITCH_CIRCLE_RADIUS (sin (oli:sd-deg-to-rad PITCH_ANGLE))))) (setq F (/ (* ROOT_CIRCLE_RADIUS (sin (oli:sd-deg-to-rad (+ 90 ROOT_ANGLE)))) (sin (oli:sd-deg-to-rad USERS_INPUTTED_ROOT_ANGLE)))) (setq INCREASED_ROOT_CIRCLE_RADIUS (/ (* (+ MOUNTING_DISTANCE_OFFSET_VALUE F) (sin (oli:sd-deg-to-rad USERS_INPUTTED_ROOT_ANGLE ))) (sin (oli:sd-deg-to-rad (+ 90 ROOT_ANGLE))))) ;-----Move the workplane away from the 2D toe profile (sd-call-cmds (position_wp TEMPORARY_WORKPLANE_2 :translate :dir_len :neg_w :len (- B A) :done)) ;-----Now we scale the workplane with the 2D heel profile moved away from the 2D toe profile, so we can now scale that profile (since we moved it away). ;-----We have to specify the scale origin as the center of the tooth at the pitch circle radius to maintain the pitch angle line. (scale_2d :select :all_2d :center_point (gpnt2d 0 PITCH_CIRCLE_RADIUS) :scale_factor E) );progn );if ;-----Now that the profiles have been created, loft between them: (sd-call-cmds (add_loft :keep_tool :yes :loft_check :no)) (display selected_wp) ;(remove_from_vp_drawlist (first (sd-inq-vp-names)) :with-wp SELECTED_WP complete);-----Turns off users selected workplane (remove_from_vp_drawlist (first (sd-inq-vp-names)) :with-wp TEMPORARY_WORKPLANE complete);-----Turns off workplane (should probably be the new "/s1/Metric-GEARDESIGNER1") (remove_from_vp_drawlist (first (sd-inq-vp-names)) :with-wp TEMPORARY_WORKPLANE_2 complete);-----Turns off workplane (should probably be the new "/s1/Metric-GEARDESIGNER2") (remove_from_vp_drawlist (first (sd-inq-vp-names)) :with-wp TEMPORARY_WORKPLANE_3 complete);-----Turns off workplane (should probably be the new "/Metric-GEARDESIGNER1") (remove_from_vp_drawlist (first (sd-inq-vp-names)) :with-wp TEMPORARY_WORKPLANE_10 complete);-----Turns off workplane (should probably be the new "/Metric-GEARDESIGNER3") ;-----The above tooth now starts at the heel and extends the length of the FACE_WIDTH to the toe. However, since the front of the gear ;-----(by the toe of the tooth) will get milled, we need to extend (or offset) the toe of the tooth so that when the milling operation ;-----occurs, it will mill the complete tooth. Thus, we first calculate how much to offset the tooth, then offset the toe of the tooth ;-----in order to add material to be milled: (setq A (sqrt (+ (* FACE_WIDTH FACE_WIDTH) (* DEDENDUM DEDENDUM)))) (setq B (- (oli:sd-rad-to-deg (atan (/ DEDENDUM FACE_WIDTH))) ROOT_ANGLE)) (setq C (+ (- 90.0 PITCH_ANGLE) ROOT_ANGLE)) (setq D (/ (* A (sin (oli:sd-deg-to-rad B))) (sin (oli:sd-deg-to-rad C)))) (setq GEAR_TOOTH_OFFSET_DISTANCE (* D (sin (oli:sd-deg-to-rad PITCH_ANGLE)))) (sd-call-cmds (move :check :keep_tangent :no :blend_auto :no :update_rels :no (gpnt3D 0.0 PITCH_CIRCLE_RADIUS 0.0) :transformation :translate :dir :face_normal (gpnt3D 0.0 PITCH_CIRCLE_RADIUS 0.0) :len (+ GEAR_TOOTH_OFFSET_DISTANCE (/ GEAR_TOOTH_OFFSET_DISTANCE 3.0)) :done)) ;-----Make the TEMPORARY_WORKPLANE_3 (should probably be "Metric-GEARDESIGNER3") the active workplane: (sd-call-cmds (current_wp TEMPORARY_WORKPLANE_3)) ;-----Erase the bevel gear 2D profile from the newly created workplane TEMPORARY_WORKPLANE_3: (delete_2D :all_2d) ;-----Now rotate the third workplane TEMPORARY_WORKPLANE_3 (probably named "Metric-GEARDESIGNER3") by the pitch angle so we can ;-----establish a "center line" for rotating the gear teeth: (sd-call-cmds (position_wp TEMPORARY_WORKPLANE_3 :rotate :axis :neg_w :rotation_angle (oli:sd-deg-to-rad PITCH_ANGLE))) ;-----We can now create a radial assembly of the bevel tooth (TEMPORARY_PARTNAME) to create all of the bevel teeth: (sd-call-cmds (create_multiple_pa_radial :copy :count (- NUMBER_OF_TEETH 1.0) :axis :u :angle_increment (oli:sd-deg-to-rad (/ 360.0 NUMBER_OF_TEETH)))) ;-----We now have all of the teeth drawn and united as a single part (TEMPORARY_PARTNAME). Now we need to create the cone which ;-----will "fill in" the center of the gear. The first side of the cone is drawn starting at 0,0 of the current workplane ;-----(TEMPORARY_WORKPLANE_3) which is the intersection of the gear centerline and the center point of the large bevel tooth ;-----center point (unless is was moved for mounting distance reasons). We therefore draw a 2D line from that center point at the ;-----users pitch angle (PITCH_ANGLE) at a length of the base circle radius (BASE_CIRCLE_RADIUS): (if (= MOUNTING_DISTANCE_OFFSET_VALUE 0) (line :angle 0,0 (+ 90 PITCH_ANGLE) ROOT_CIRCLE_RADIUS) (line :angle (gpnt2d (+ 0 MOUNTING_DISTANCE_OFFSET_VALUE) 0) (+ 90 PITCH_ANGLE) INCREASED_ROOT_CIRCLE_RADIUS) );if ;-----Now obtain the X and Y points to draw the second line from where the first line just ended (at the base_circle_radius) ;-----to the pitch apex) (where the root, face and pitch angle and gear center lines intersect). The first X and Y points will ;-----be for where the line starts (at the base circle radius), and the second set of points will be for where the line ends ;-----(at the pitch apex): (display "ROOT CIRCLE RADIUS:") (display ROOT_CIRCLE_RADIUS) (display "ROOT ANGLE:") (display ROOT_ANGLE) (if (= MOUNTING_DISTANCE_OFFSET_VALUE 0) (progn (setq BEVEL_CONE_POINT_1 (gpnt2d (* -1.0 (* ROOT_CIRCLE_RADIUS (sin (oli:sd-deg-to-rad PITCH_ANGLE)))) (* ROOT_CIRCLE_RADIUS (cos (oli:sd-deg-to-rad PITCH_ANGLE))))) (setq BEVEL_CONE_POINT_2 (gpnt2d (- (* -1.0 (* ROOT_CIRCLE_RADIUS (sin (oli:sd-deg-to-rad PITCH_ANGLE))))(* (* ROOT_CIRCLE_RADIUS (cos (oli:sd-deg-to-rad PITCH_ANGLE))) (tan (oli:sd-deg-to-rad (- 90.0 (- PITCH_ANGLE ROOT_ANGLE)))))) (+ 0.0 MOUNTING_DISTANCE_OFFSET_VALUE))) );progn (progn (display "Hello") (setq BEVEL_CONE_POINT_1 (gpnt2d (+ (* -1.0 (* INCREASED_ROOT_CIRCLE_RADIUS (sin (oli:sd-deg-to-rad PITCH_ANGLE)))) MOUNTING_DISTANCE_OFFSET_VALUE) (* INCREASED_ROOT_CIRCLE_RADIUS (cos (oli:sd-deg-to-rad PITCH_ANGLE))))) (setq BEVEL_CONE_POINT_2 (gpnt2d (- (* -1.0 (* ROOT_CIRCLE_RADIUS (sin (oli:sd-deg-to-rad PITCH_ANGLE))))(* (* ROOT_CIRCLE_RADIUS (cos (oli:sd-deg-to-rad PITCH_ANGLE))) (tan (oli:sd-deg-to-rad (- 90.0 (- PITCH_ANGLE ROOT_ANGLE)))))) 0.0)) );progn );if ;-----We can now draw the line from the end of the line just drawn (at the BASE_CIRCLE_RADIUS) to the pitch apex using to the two point definitions ;-----obtained above: (line :two_points BEVEL_CONE_POINT_1 BEVEL_CONE_POINT_2) ;-----Now draw the last line from the pitch apex to 0,0: (line :two_points BEVEL_CONE_POINT_2 (gpnt2d (+ 0 MOUNTING_DISTANCE_OFFSET_VALUE) 0)) ;-----Add a / to the TEMPORARY_PARTNAME_2 value (should probably be "Metric-GEARDESIGNER_Bevel_Center1") (setf TEMPORARY_PARTNAME_2 (concatenate 'string "/" TEMPORARY_PARTNAME_2)) ;-----Since we now have the 2D triangle profile drawn for the bevel cone, we can now turn the profile: (sd-call-cmds (turn :axis :u :sel_part TEMPORARY_PARTNAME_2 :wp TEMPORARY_WORKPLANE_3 :rotation_angle (oli:sd-deg-to-rad 360) :keep_profile :yes)) ;-----Will create a fourth base workplane name "Metric-GEARDESIGNERX", where X is a unique number (should probably be "Metric-GEARDESIGNER4") (setq TEMPORARY_WORKPLANE_4 (sd-gen-obj-basename :workplane :prefix "Metric-GEARDESIGNER")) ;-----Since we now have the 3D cone created, we now need to machine the front of the face down from the pitch apex. To do this, we ;-----first need to create a workplane at the pitch apex. We do this by first copying the existing workplane, rotating it 90 degrees, ;-----moving it the distance required to position it at the pitch apex, then moving it to the front face (which requires moving it to ;-----towards the heel of the gear by the following distance: (- MOUNTING_DISTANCE GEAR_WIDTH)): (sd-call-cmds (create_workplane :new :name TEMPORARY_WORKPLANE_4 :owner "/" :par_wp :ref_wp TEMPORARY_WORKPLANE_3 :offset 0.0 :done)) ;-----Add a / to the TEMPORARY_WORKPLANE_4 value (should probably be "Metric-GEARDESIGNER4") (setf TEMPORARY_WORKPLANE_4 (concatenate 'string "/" TEMPORARY_WORKPLANE_4)) (sd-call-cmds (position_wp TEMPORARY_WORKPLANE_4 :rotate :axis :neg_v :rotation_angle (oli:sd-deg-to-rad 90.0) :done)) (sd-call-cmds (position_wp TEMPORARY_WORKPLANE_4 :translate :dir :w :len (/ PITCH_CIRCLE_RADIUS (sin (oli:sd-deg-to-rad PITCH_ANGLE))) :done)) (sd-call-cmds (position_wp TEMPORARY_WORKPLANE_4 :translate :dir :neg_w :len (- MOUNTING_DISTANCE GEAR_WIDTH) :done)) ;-----Now draw a circle on the new workplane (TEMPORARY_WORKPLANE_4) to mill the face of the gear. Make it twice the PITCH_DIAMETER: (CIRCLE :CEN_RAD 0,0 (* 2.0 PITCH_DIAMETER)) ;-----Add a / to the TEMPORARY_PARTNAME_3 value (should probably be "Metric-GEARDESIGNER_Bevel_Gear1") (setf TEMPORARY_PARTNAME_3 (concatenate 'string "/" TEMPORARY_PARTNAME_3)) ;-----Set another generic variable K as an increment variable in our loop (setq K (- length_of_pathname_list 1)) ;-----Now that all of the teeth have been created, we need to unite them. This loop will united each newly-created tooth to the original tooth one ;-----at a time until all of the teeth have been united into the original tooth (NEW_PART). Before the loop starts, we create a dummy ;-----variable N to keep count of which gear tooth is to be worked on. When the teeth are radially created, each new tooth has a unique part name ;-----(ie. if the base tooth name is "Metric-GEARDESIGNER_Bevel_Tooth1", one first tooth created will be named "Metric-GEARDESIGNER_Bevel_Tooth1.2". Notice how the ;-----suffix begins with the number 2. Therefore, we will set our dummy variable N to 2, thus allowing us to begin working on the first created tooth ;-----"Metric-GEARDESIGNER_Bevel_Tooth1.2": (setq N 2) ;-----Add a / to the TEMPORARY_PARTNAME value (should probably be "Metric-GEARDESIGNER_Bevel_Tooth1") (setf TEMPORARY_PARTNAME (concatenate 'string "/" TEMPORARY_PARTNAME)) ;-----Now we will run the loop, one time for each tooth created (so if there are twelve teeth, there were eleven teeth created, so we will run the ;-----the loop eleven times), which will united each radially-created tooth to the original tooth (TEMPORARY_PARTNAME). But first, unite the original ;-----bevel tooth to TEMPORARY_PARTNAME_3 (should probably be "Metric-GEARDESIGNER_Bevel_Gear1"): (sd-call-cmds (unite_3d :tools :blank TEMPORARY_PARTNAME_3 :tools TEMPORARY_PARTNAME :keep_tools :no)) ;-----Now run the loop: (setq K (- NUMBER_OF_TEETH 1)) (dotimes (loop-count K) (progn (display :clear) (display "Working on tooth number:") (display (- N 1.0)) (sd-call-cmds (unite_3d :tools :blank TEMPORARY_PARTNAME_3 :tools (concatenate 'string TEMPORARY_PARTNAME "." (format nil "~a" N)) :keep_tools :no)) (setq N (+ N 1)) );progn );dotimes (display :clear) (display "Uniting cone to teeth") ;-----Now unite the cone to the teeth just united: (sd-call-cmds (unite_3d :tools :blank TEMPORARY_PARTNAME_3 :tools TEMPORARY_PARTNAME_2 :keep_tools :no)) (display :clear) (display "Milling front face") ;-----Now mill the front face of the gear to obtain the face width by the horizontal distance between the back cone apex and the pitch apex times two: (sd-call-cmds (mill :auto_direction :yes :parts TEMPORARY_PARTNAME_3 :distance (* 50.4 (/ (* ADDENDUM_CIRCLE_RADIUS (sin (oli:sd-deg-to-rad (- 90.0 FACE_ANGLE)))) (sin (oli:sd-deg-to-rad (+ PITCH_ANGLE FACE_ANGLE))))) :direction :+W)) ;-----So now we have the gear teeth and cone united, and the front face milled to the face angle. Now we need to bore the back side of the gear along ;-----the angle of the back cone. We first change to that workplane, delete the existing 2D geometry, create a new bore tool and bore the gear: ;-----Make the TEMPORARY_WORKPLANE_3 (should probably be the new "Metric-GEARDESIGNER1") the active workplane: (sd-call-cmds (current_wp TEMPORARY_WORKPLANE_3)) ;-----Erase the bevel gear 2D geometry from workplane TEMPORARY_WORKPLANE_3: (delete_2D :all_2d) ;-----Draw the first line for the bore line from 0,0 along the back cone angle at a distance of twice the addendum circle radius: (line :angle (gpnt2d (+ 0 MOUNTING_DISTANCE_OFFSET_VALUE) 0) (+ 90.0 PITCH_ANGLE) (* ADDENDUM_CIRCLE_RADIUS 2.0)) ;-----Now draw a vertical line from 0,0: (line :vertical (gpnt2d (+ 0 MOUNTING_DISTANCE_OFFSET_VALUE) 0) (gpnt2d 0 (* (* ADDENDUM_CIRCLE_RADIUS 2.0) (sin (oli:sd-deg-to-rad (- 90.0 PITCH_ANGLE)))))) ;-----Now draw the last line of the triangle which is a horizontal line: (line :horizontal (gpnt2d (+ 0 MOUNTING_DISTANCE_OFFSET_VALUE) (* (* ADDENDUM_CIRCLE_RADIUS 2.0) (sin (oli:sd-deg-to-rad (- 90.0 PITCH_ANGLE))))) (* -1.0 (* (* ADDENDUM_CIRCLE_RADIUS 2.0) (cos (oli:sd-deg-to-rad (- 90.0 PITCH_ANGLE)))))) (display :clear) (display "Boring back cone") ;-----Before boring the back cone, move the workplane (and the boring tool) towards or 'into' the gear. Although this will now not bore the gear exactly ;-----along the back face as desired, it will hopefully prevent any SolidDesigner errors from trying to bore along the exact surface of the gear teeth. (sd-call-cmds (position_wp TEMPORARY_WORKPLANE_3 :translate :dir_len :neg_u :len .000254 :done)) ;-----Now bore the back cone of the gear to make it smooth: (sd-call-cmds (bore :axis :u :parts TEMPORARY_PARTNAME_3 :wp TEMPORARY_WORKPLANE_3 :rotation_angle (oli:sd-deg-to-rad 360.0) :keep_wp :yes :keep_profile :yes)) ;-----Now move the workplane back to its original position. (sd-call-cmds (position_wp TEMPORARY_WORKPLANE_3 :translate :dir_len :u :len .000254 :done)) ;-----Erase the bevel gear 2D geometry from workplane TEMPORARY_WORKPLANE_3: (delete_2D :all_2d) ;-----The next thing we now need to do is bore the outside diameter to the users specified outside diameter. The default outside diameter is the diameter ;-----at the tip of the bevel tooth at the heel, but they may want a smaller outside diameter. We will first check and see if the user specified an ;-----outside diameter smaller than the default outside diameter. If they did, we will then draw a rectangle in the current workplane which will be used ;-----as a tool to bore the users outside diameter. Then we will bore the outside diameter on the gear. If the user did not specify an outside diameter ;-----smaller than the default outside diameter, do nothing. ;-----Make the TEMPORARY_WORKPLANE_3 (should probably be the new "Metric-GEARDESIGNER1") the active workplane: (sd-call-cmds (current_wp TEMPORARY_WORKPLANE_3)) (if (< OUTSIDE_DIAMETER (+ (/ NUMBER_OF_TEETH ( / 1 MODE)) (* 2.0 (* ORIGINALLY_CALCULATED_ADDENDUM (cos (oli:sd-deg-to-rad PITCH_ANGLE)))))) (progn (display :clear) (display "Boring Outside Diameter") (rectangle (gpnt2d (+ 0 MOUNTING_DISTANCE) (/ OUTSIDE_DIAMETER 2.0)) (gpnt2d (* -1.0 (* OUTSIDE_DIAMETER 4.0)) (* OUTSIDE_DIAMETER 2.0));-----The size of the rectangle was just made up to insure that it will be large enough );rectangle ;-----Now bore outside diameter of the gear: (sd-call-cmds (bore :axis :u :parts TEMPORARY_PARTNAME_3 :wp TEMPORARY_WORKPLANE_3 :rotation_angle (oli:sd-deg-to-rad 360.0) :keep_wp :no)) );progn );if (unless (< OUTSIDE_DIAMETER (+ (/ NUMBER_OF_TEETH ( / 1 MODE)) (* 2.0 (* ORIGINALLY_CALCULATED_ADDENDUM (cos (oli:sd-deg-to-rad PITCH_ANGLE)))))) (delete_3d TEMPORARY_WORKPLANE_3) );unless (display :clear) (display "Milling back cone") ;-----Now we can mill the back cone of the gear in order to obtain the specified gear width. First we change the current workplane to the workplane ;-----which is positioned on the front face of the gear (already with a circle on it which is the milling tool), copy that workplane the distance ;-----specified by the user as the gear width (GEAR_WIDTH), then mill the back end of the gear some arbitrary distance which will guarantee that ;-----it will mill it far enough ;-----Make the TEMPORARY_WORKPLANE_4 (should probably be the new "Metric-GEARDESIGNER2") the active workplane: (sd-call-cmds (current_wp TEMPORARY_WORKPLANE_4)) ;-----Will create a fifth base workplane name "Metric-GEARDESIGNERX", where X is a unique number (should probably be a new "Metric-GEARDESIGNER3") (setq TEMPORARY_WORKPLANE_5 (sd-gen-obj-basename :workplane :prefix "Metric-GEARDESIGNER")) ;-----Create the fifth workplane TEMPORARY_WORKPLANE_5 (probably named "Metric-GEARDESIGNER3") (sd-call-cmds (create_workplane :copy :source TEMPORARY_WORKPLANE_4 :name TEMPORARY_WORKPLANE_5 :owner "/" :par_wp :ref_wp TEMPORARY_WORKPLANE_4 :offset (* -1 GEAR_WIDTH))) ;-----Now mill the back (heel) side of the part by the horizontal distance between the back cone apex and the pitch apex times two to obtain the gear width: (sd-call-cmds (mill :auto_direction :yes :parts TEMPORARY_PARTNAME_3 :distance (* 50.4 (/ (* ADDENDUM_CIRCLE_RADIUS (sin (oli:sd-deg-to-rad (- 90.0 FACE_ANGLE)))) (sin (oli:sd-deg-to-rad (+ PITCH_ANGLE FACE_ANGLE))))) :direction :-W :keep_wp :no)) ;-----Make the TEMPORARY_WORKPLANE_10 (should probably be the new "/Metric-GEARDESIGNER3") the active workplane: (sd-call-cmds (current_wp TEMPORARY_WORKPLANE_10)) ;-----Rotate the bevel gear to make the face of the gear parallel with the users specified workplane: (sd-call-cmds (position_pa TEMPORARY_PARTNAME_3 :rotate :axis :u :rotation_angle (oli:sd-deg-to-rad PITCH_ANGLE))) ;-----Now move the gear to align the front face of the gear with the users specified workplane: (progn (setq A (- MOUNTING_DISTANCE (/ PITCH_CIRCLE_RADIUS (sin (oli:sd-deg-to-rad PITCH_ANGLE))))) (setq B (+ A FACE_WIDTH)) (sd-call-cmds (position_pa TEMPORARY_PARTNAME_3 :translate :dir_len :w B)) );progn ;-----Make the original temporary workplane TEMPORARY_WORKPLANE (should probably be "/s1/Metric-GEARDESIGNER") the active workplane so we can delete the ;-----entire workplane set in the final delete_3d command: (sd-call-cmds (current_wp TEMPORARY_WORKPLANE)) ;-----Erase the workplanes used to create the gear: (delete_3D TEMPORARY_WORKPLANE_4 TEMPORARY_WORKPLANE_10 (oli:sd-inq-parent-obj (oli:sd-inq-curr-wp))) ;-----Erase the little piece that is left after boring the back cone: (setq TEMPORARY_PARTNAME_4 (concatenate 'string TEMPORARY_PARTNAME_3 ".1")) (delete_3D TEMPORARY_PARTNAME_4) ;-----Set the users specified workplane as the current workplane: (sd-call-cmds (CURRENT_WP SELECTED_WP)) ;-----Now move the gear to the users specified center point: (sd-call-cmds (position_pa TEMPORARY_PARTNAME_3 :translate :two_ptv 0,0,0 GEAR_CENTER_POINT_3D)) (if (and (> BORE_DIAMETER 0) (= HUB_DIAMETER 0));-----If there is a bore but no hub (if (= KEYWAY_WIDTH 0);-----------------------------If there is no keyway (progn (setq TEMPORARY_WORKPLANE (sd-gen-obj-basename :workplane :prefix "Metric-GEARDESIGNER"));-----Will create a base workplane name "Metric-GEARDESIGNERX", where X is a unique number (sd-call-cmds (CREATE_WORKPLANE :NEW :NAME TEMPORARY_WORKPLANE :PAR_WP :REF_WP SELECTED_WP)) (sd-call-cmds (circle :cen_dia GEAR_CENTER_POINT_2D BORE_DIAMETER)) (punch) (delete_3d (concatenate 'string "/" TEMPORARY_WORKPLANE));-----Erase the workplane TEMPORARY_WORKPLANE (current_wp SELECTED_WP) );progn );if );if (if (and (> BORE_DIAMETER 0) (= HUB_DIAMETER 0));-----If there is a bore but no hub (if (> KEYWAY_WIDTH 0);----------------------------If there is a keyway (progn (if (= NO_OF_KEYS 1);---------------------------If there is one keyway (progn (setq TEMPORARY_WORKPLANE (sd-gen-obj-basename :workplane :prefix "Metric-GEARDESIGNER"));-----Will create a base workplane name "Metric-GEARDESIGNERX", where X is a unique number (sd-call-cmds (CREATE_WORKPLANE :NEW :NAME TEMPORARY_WORKPLANE :PAR_WP :REF_WP SELECTED_WP)) (setq X SELECTED_X) (setq Y SELECTED_Y) (setq A (/ BORE_DIAMETER 2.0)) (setq B (/ KEYWAY_WIDTH 2.0)) (setq C (+ (sqrt (- (* A A) (* B B))) KEYWAY_DEPTH A));-----This is the distance from the bottom of the bore to the top of the keyway (setq C (- C A));-----This is the distance from the center of the bore to the top of the keyway (setq TOP_KEYWAY_LEFT (gpnt2d (- X (/ KEYWAY_WIDTH 2.0)) (+ Y C))) (setq TOP_KEYWAY_RIGHT (gpnt2d (+ X (/ KEYWAY_WIDTH 2.0)) (+ Y C))) (setq KEY_X (gpnt2d_x TOP_KEYWAY_LEFT));-----This is the 'x' value of the TOP_KEYWAY_LEFT (setq KEY_Y (gpnt2d_y TOP_KEYWAY_RIGHT));-----This is the 'y' value of the TOP_KEYWAY_RIGHT (setq BOTTOM_KEYWAY_LEFT (gpnt2d (- X (/ KEYWAY_WIDTH 2.0)) (- KEY_Y KEYWAY_DEPTH))) (setq BOTTOM_KEYWAY_RIGHT (gpnt2d (+ X (/ KEYWAY_WIDTH 2.0)) (- KEY_Y KEYWAY_DEPTH))) (ARC :CENTER (gpnt2d X Y) BOTTOM_KEYWAY_LEFT BOTTOM_KEYWAY_RIGHT) (LINE :TWO_POINTS BOTTOM_KEYWAY_LEFT TOP_KEYWAY_LEFT) (LINE :TWO_POINTS TOP_KEYWAY_LEFT TOP_KEYWAY_RIGHT) (LINE :TWO_POINTS TOP_KEYWAY_RIGHT BOTTOM_KEYWAY_RIGHT) (punch) (delete_3d (concatenate 'string "/" TEMPORARY_WORKPLANE));-----Erase the workplane TEMPORARY_WORKPLANE (current_wp SELECTED_WP) (if (string= "INCH" (elt length&length_factor 0)) (progn (sd-call-cmds (units :inch)) );:progn );if (if (string= "MM" (elt length&length_factor 0)) (progn (sd-call-cmds (units :mm)) );:progn );if );progn );if (if (= NO_OF_KEYS 2);----------------------------If there are two keyways (progn (setq TEMPORARY_WORKPLANE (sd-gen-obj-basename :workplane :prefix "Metric-GEARDESIGNER"));-----Will create a base workplane name "Metric-GEARDESIGNERX", where X is a unique number (sd-call-cmds (CREATE_WORKPLANE :NEW :NAME TEMPORARY_WORKPLANE :PAR_WP :REF_WP SELECTED_WP)) (setq X SELECTED_X) (setq Y SELECTED_Y) (setq A (/ BORE_DIAMETER 2.0)) (setq B (/ KEYWAY_WIDTH 2.0)) (setq C (+ (sqrt (- (* A A) (* B B))) KEYWAY_DEPTH A));-----This is the distance from the bottom of the bore to the top of the keyway (setq C (- C A));-----This is the distance from the center of the bore to the top of the keyway (setq TOP_KEYWAY_LEFT1 (gpnt2d (- X (/ KEYWAY_WIDTH 2.0)) (+ Y C))) (setq TOP_KEYWAY_RIGHT1 (gpnt2d (+ X (/ KEYWAY_WIDTH 2.0)) (+ Y C))) (setq KEY_X (gpnt2d_x TOP_KEYWAY_LEFT1));-----This is the 'x' value of the TOP_KEYWAY_LEFT1 (setq KEY_Y (gpnt2d_y TOP_KEYWAY_RIGHT1));-----This is the 'y' value of the TOP_KEYWAY_RIGHT1 (setq BOTTOM_KEYWAY_LEFT1 (gpnt2d (- X (/ KEYWAY_WIDTH 2.0)) (- KEY_Y KEYWAY_DEPTH))) (setq BOTTOM_KEYWAY_RIGHT1 (gpnt2d (+ X (/ KEYWAY_WIDTH 2.0)) (- KEY_Y KEYWAY_DEPTH))) (setq TOP_KEYWAY_LEFT2 (gpnt2d (- X (/ KEYWAY_WIDTH 2.0)) (- Y C))) (setq TOP_KEYWAY_RIGHT2 (gpnt2d (+ X (/ KEYWAY_WIDTH 2.0)) (- Y C))) (setq KEY_X (gpnt2d_x TOP_KEYWAY_LEFT2));-----This is the 'x' value of the TOP_KEYWAY_LEFT2 (setq KEY_Y (gpnt2d_y TOP_KEYWAY_RIGHT2));-----This is the 'y' value of the TOP_KEYWAY_RIGHT2 (setq BOTTOM_KEYWAY_LEFT2 (gpnt2d (- X (/ KEYWAY_WIDTH 2.0)) (+ KEY_Y KEYWAY_DEPTH))) (setq BOTTOM_KEYWAY_RIGHT2 (gpnt2d (+ X (/ KEYWAY_WIDTH 2.0)) (+ KEY_Y KEYWAY_DEPTH))) (ARC :CENTER (gpnt2d X Y) BOTTOM_KEYWAY_LEFT1 BOTTOM_KEYWAY_LEFT2) (ARC :CENTER (gpnt2d X Y) BOTTOM_KEYWAY_RIGHT2 BOTTOM_KEYWAY_RIGHT1) (LINE :TWO_POINTS BOTTOM_KEYWAY_LEFT1 TOP_KEYWAY_LEFT1) (LINE :TWO_POINTS TOP_KEYWAY_LEFT1 TOP_KEYWAY_RIGHT1) (LINE :TWO_POINTS TOP_KEYWAY_RIGHT1 BOTTOM_KEYWAY_RIGHT1) (LINE :TWO_POINTS BOTTOM_KEYWAY_LEFT2 TOP_KEYWAY_LEFT2) (LINE :TWO_POINTS TOP_KEYWAY_LEFT2 TOP_KEYWAY_RIGHT2) (LINE :TWO_POINTS TOP_KEYWAY_RIGHT2 BOTTOM_KEYWAY_RIGHT2) (punch) (delete_3d (concatenate 'string "/" TEMPORARY_WORKPLANE));-----Erase the workplane TEMPORARY_WORKPLANE (current_wp SELECTED_WP) (if (string= "INCH" (elt length&length_factor 0)) (progn (sd-call-cmds (units :inch)) );:progn );if (if (string= "MM" (elt length&length_factor 0)) (progn (sd-call-cmds (units :mm)) );:progn );if );progn );if );progn );if );if (if (> HUB_DIAMETER 0);------------------------------If there is a hub (if (= BORE_DIAMETER 0);----------------------------If there is no bore (progn (setq TEMPORARY_WORKPLANE (sd-gen-obj-basename :workplane :prefix "Metric-GEARDESIGNER"));-----Will create a base workplane name "Metric-GEARDESIGNERX", where X is a unique number (sd-call-cmds (CREATE_WORKPLANE :NEW :NAME TEMPORARY_WORKPLANE :PAR_WP :REF_WP SELECTED_WP)) (setq X SELECTED_X) (setq Y SELECTED_Y) (circle :cen_dia (gpnt2d X Y) HUB_DIAMETER);-----Draw the circle for the hub diameter (extrude :wp (concatenate 'string "/" TEMPORARY_WORKPLANE) :distance HUB_PROJECTION :direction :-W :keep_wp :no);-----Extrude the hub diameter ; (delete_3d (concatenate 'string "/" TEMPORARY_WORKPLANE));-----Erase the workplane TEMPORARY_WORKPLANE (current_wp SELECTED_WP) (if (string= "INCH" (elt length&length_factor 0)) (progn (sd-call-cmds (units :inch)) );:progn );if (if (string= "MM" (elt length&length_factor 0)) (progn (sd-call-cmds (units :mm)) );:progn );if );progn );if );if (if (> HUB_DIAMETER 0);------------------------------If there is a hub (if (and (> BORE_DIAMETER 0) (= KEYWAY_WIDTH 0));---------------------------If there is a bore but no keyway (progn (setq TEMPORARY_WORKPLANE (sd-gen-obj-basename :workplane :prefix "Metric-GEARDESIGNER"));-----Will create a base workplane name "Metric-GEARDESIGNERX", where X is a unique number (sd-call-cmds (CREATE_WORKPLANE :NEW :NAME TEMPORARY_WORKPLANE :PAR_WP :REF_WP SELECTED_WP)) (setq X SELECTED_X) (setq Y SELECTED_Y) (circle :cen_dia (gpnt2d X Y) HUB_DIAMETER);-----Draw the circle for the hub diameter (extrude :wp (concatenate 'string "/" TEMPORARY_WORKPLANE) :distance HUB_PROJECTION :direction :-W :keep_wp :yes);-----Extrude the hub diameter (delete_2d :all_2d);---------Erase the tooth 2d profile (circle :cen_dia (gpnt2d X Y) BORE_DIAMETER);-----Draw the circle for the bore diameter (punch) (delete_3d (concatenate 'string "/" TEMPORARY_WORKPLANE));-----Erase the workplane TEMPORARY_WORKPLANE (current_wp SELECTED_WP) (if (string= "INCH" (elt length&length_factor 0)) (progn (sd-call-cmds (units :inch)) );:progn );if (if (string= "MM" (elt length&length_factor 0)) (progn (sd-call-cmds (units :mm)) );:progn );if );progn );if );if (if (> HUB_DIAMETER 0);------------------------------If there is a hub (if (and (> KEYWAY_WIDTH 0) (> BORE_DIAMETER 0));----------------------------If there is a keyway and a bore (progn (if (= NO_OF_KEYS 1);---------------------------If there is one keyway (progn (setq TEMPORARY_WORKPLANE (sd-gen-obj-basename :workplane :prefix "Metric-GEARDESIGNER"));-----Will create a base workplane name "Metric-GEARDESIGNERX", where X is a unique number (sd-call-cmds (CREATE_WORKPLANE :NEW :NAME TEMPORARY_WORKPLANE :PAR_WP :REF_WP SELECTED_WP)) (setq X SELECTED_X) (setq Y SELECTED_Y) (circle :cen_dia (gpnt2d X Y) HUB_DIAMETER);-----Draw the circle for the hub diameter (extrude :wp (concatenate 'string "/" TEMPORARY_WORKPLANE) :distance HUB_PROJECTION :direction :-W :keep_wp :yes);-----Extrude the hub diameter (delete_2d :all_2d);---------Erase the tooth 2d profile (setq A (/ BORE_DIAMETER 2.0)) (setq B (/ KEYWAY_WIDTH 2.0)) (setq C (+ (sqrt (- (* A A) (* B B))) KEYWAY_DEPTH A));-----This is the distance from the bottom of the bore to the top of the keyway (setq C (- C A));-----This is the distance from the center of the bore to the top of the keyway (setq TOP_KEYWAY_LEFT (gpnt2d (- X (/ KEYWAY_WIDTH 2.0)) (+ Y C))) (setq TOP_KEYWAY_RIGHT (gpnt2d (+ X (/ KEYWAY_WIDTH 2.0)) (+ Y C))) (setq KEY_X (gpnt2d_x TOP_KEYWAY_LEFT));-----This is the 'x' value of the TOP_KEYWAY_LEFT (setq KEY_Y (gpnt2d_y TOP_KEYWAY_RIGHT));-----This is the 'y' value of the TOP_KEYWAY_RIGHT (setq BOTTOM_KEYWAY_LEFT (gpnt2d (- X (/ KEYWAY_WIDTH 2.0)) (- KEY_Y KEYWAY_DEPTH))) (setq BOTTOM_KEYWAY_RIGHT (gpnt2d (+ X (/ KEYWAY_WIDTH 2.0)) (- KEY_Y KEYWAY_DEPTH))) (ARC :CENTER (gpnt2d X Y) BOTTOM_KEYWAY_LEFT BOTTOM_KEYWAY_RIGHT) (LINE :TWO_POINTS BOTTOM_KEYWAY_LEFT TOP_KEYWAY_LEFT) (LINE :TWO_POINTS TOP_KEYWAY_LEFT TOP_KEYWAY_RIGHT) (LINE :TWO_POINTS TOP_KEYWAY_RIGHT BOTTOM_KEYWAY_RIGHT) (punch) (delete_3d (concatenate 'string "/" TEMPORARY_WORKPLANE));-----Erase the workplane TEMPORARY_WORKPLANE (current_wp SELECTED_WP) (if (string= "INCH" (elt length&length_factor 0)) (progn (sd-call-cmds (units :inch)) );:progn );if (if (string= "MM" (elt length&length_factor 0)) (progn (sd-call-cmds (units :mm)) );:progn );if );progn );if (if (= NO_OF_KEYS 2);----------------------------If there are two keyways (progn (setq TEMPORARY_WORKPLANE (sd-gen-obj-basename :workplane :prefix "Metric-GEARDESIGNER"));-----Will create a base workplane name "Metric-GEARDESIGNERX", where X is a unique number (sd-call-cmds (CREATE_WORKPLANE :NEW :NAME TEMPORARY_WORKPLANE :PAR_WP :REF_WP SELECTED_WP)) (setq X SELECTED_X) (setq Y SELECTED_Y) (circle :cen_dia (gpnt2d X Y) HUB_DIAMETER);-----Draw the circle for the hub diameter (extrude :wp (concatenate 'string "/" TEMPORARY_WORKPLANE) :distance H-UB_PROJECTION :keep_wp :yes);-----Extrude the hub diameter (delete_2d :all_2d);---------Erase the tooth 2d profile (setq A (/ BORE_DIAMETER 2.0)) (setq B (/ KEYWAY_WIDTH 2.0)) (setq C (+ (sqrt (- (* A A) (* B B))) KEYWAY_DEPTH A));-----This is the distance from the bottom of the bore to the top of the keyway (setq C (- C A));-----This is the distance from the center of the bore to the top of the keyway (setq TOP_KEYWAY_LEFT1 (gpnt2d (- X (/ KEYWAY_WIDTH 2.0)) (+ Y C))) (setq TOP_KEYWAY_RIGHT1 (gpnt2d (+ X (/ KEYWAY_WIDTH 2.0)) (+ Y C))) (setq KEY_X (gpnt2d_x TOP_KEYWAY_LEFT1));-----This is the 'x' value of the TOP_KEYWAY_LEFT1 (setq KEY_Y (gpnt2d_y TOP_KEYWAY_RIGHT1));-----This is the 'y' value of the TOP_KEYWAY_RIGHT1 (setq BOTTOM_KEYWAY_LEFT1 (gpnt2d (- X (/ KEYWAY_WIDTH 2.0)) (- KEY_Y KEYWAY_DEPTH))) (setq BOTTOM_KEYWAY_RIGHT1 (gpnt2d (+ X (/ KEYWAY_WIDTH 2.0)) (- KEY_Y KEYWAY_DEPTH))) (setq TOP_KEYWAY_LEFT2 (gpnt2d (- X (/ KEYWAY_WIDTH 2.0)) (- Y C))) (setq TOP_KEYWAY_RIGHT2 (gpnt2d (+ X (/ KEYWAY_WIDTH 2.0)) (- Y C))) (setq KEY_X (gpnt2d_x TOP_KEYWAY_LEFT2));-----This is the 'x' value of the TOP_KEYWAY_LEFT2 (setq KEY_Y (gpnt2d_y TOP_KEYWAY_RIGHT2));-----This is the 'y' value of the TOP_KEYWAY_RIGHT2 (setq BOTTOM_KEYWAY_LEFT2 (gpnt2d (- X (/ KEYWAY_WIDTH 2.0)) (+ KEY_Y KEYWAY_DEPTH))) (setq BOTTOM_KEYWAY_RIGHT2 (gpnt2d (+ X (/ KEYWAY_WIDTH 2.0)) (+ KEY_Y KEYWAY_DEPTH))) (ARC :CENTER (gpnt2d X Y) BOTTOM_KEYWAY_LEFT1 BOTTOM_KEYWAY_LEFT2) (ARC :CENTER (gpnt2d X Y) BOTTOM_KEYWAY_RIGHT2 BOTTOM_KEYWAY_RIGHT1) (LINE :TWO_POINTS BOTTOM_KEYWAY_LEFT1 TOP_KEYWAY_LEFT1) (LINE :TWO_POINTS TOP_KEYWAY_LEFT1 TOP_KEYWAY_RIGHT1) (LINE :TWO_POINTS TOP_KEYWAY_RIGHT1 BOTTOM_KEYWAY_RIGHT1) (LINE :TWO_POINTS BOTTOM_KEYWAY_LEFT2 TOP_KEYWAY_LEFT2) (LINE :TWO_POINTS TOP_KEYWAY_LEFT2 TOP_KEYWAY_RIGHT2) (LINE :TWO_POINTS TOP_KEYWAY_RIGHT2 BOTTOM_KEYWAY_RIGHT2) (punch) (delete_3d (concatenate 'string "/" TEMPORARY_WORKPLANE));-----Erase the workplane TEMPORARY_WORKPLANE (current_wp SELECTED_WP) (if (string= "INCH" (elt length&length_factor 0)) (progn (sd-call-cmds (units :inch)) );:progn );if (if (string= "MM" (elt length&length_factor 0)) (progn (sd-call-cmds (units :mm)) );:progn );if );progn );if );progn );if );if (add_to_vp_drawlist (first (sd-inq-vp-names)) :with-wp (oli:sd-inq-curr-part) complete);-----Turns off bevel gear (so it's not seen on screen) (display :clear) (display :hide) );progn );:BEVEL );ecase (setq PITCH_DIAMETER_SHOW PITCH_DIAMETER) (setq ROOT_FILLET_RADIUS_SHOW ROOT_FILLET_RADIUS) (setq ROOT_CIRCLE_RADIUS_SHOW ROOT_CIRCLE_RADIUS) (setq BASE_CIRCLE_RADIUS_SHOW BASE_CIRCLE_RADIUS) (setq CIRCULAR_THICKNESS_SHOW CIRCULAR_THICKNESS) (setq ADDENDUM_SHOW ADDENDUM) (setq BEVEL_HEEL_CIRCULAR_THICKNESS_SHOW BEVEL_HEEL_CIRCULAR_THICKNESS) (setq BEVEL_HEEL_CHORDAL_THICKNESS_SHOW BEVEL_HEEL_CHORDAL_THICKNESS) (setq BEVEL_TOE_CIRCULAR_THICKNESS_SHOW BEVEL_TOE_CIRCULAR_THICKNESS) (setq BEVEL_TOE_CHORDAL_THICKNESS_SHOW BEVEL_TOE_CHORDAL_THICKNESS) (setq BEVEL_HEEL_BACKLASH_SHOW BEVEL_HEEL_BACKLASH) (setq CIRCULAR_PITCH_SHOW CIRCULAR_PITCH) (setq CONE_DISTANCE_SHOW CONE_DISTANCE) (setq DEDENDUM_SHOW DEDENDUM) (setq FACE_WIDTH_SHOW FACE_WIDTH) (setq OUTSIDE_DIAMETER_SHOW OUTSIDE_DIAMETER) (ecase TYPE_OF_GEAR;-----evaluates the value of "TYPE_OF_GEAR" (:SPUR;-----If a SPUR gear was choose (progn (sd-defdialog 'display-only :dialog-title "Gear Results" :variables '( (PARAMETER_VALUES :title "Parameters" :expand-shrink ((GEAR_TYPE_DISPLAY PRESSURE_ANGLE_DISPLAY NUMBER_OF_TEETH_DISPLAY MODE_DISPLAY GEAR_WIDTH_DISPLAY BORE_DIAMETER_DISPLAY HUB_DIAMETER_DISPLAY HUB_PROJECTION_DISPLAY KEYWAY_WIDTH_DISPLAY KEYWAY_DEPTH_DISPLAY NO_OF_KEYS_DISPLAY) (PITCH_DIAMETER_DISPLAY CIRCULAR_PITCH_DISPLAY ROOT_DIAMETER_DISPLAY BASE_DIAMETER_DISPLAY OUTSIDE_DIAMETER_DISPLAY ADDENDUM_DISPLAY DEDENDUM_DISPLAY WORKIING_DEPTH-DISPLAY CIRCULAR_THICK_DISPLAY FILLET_RADIUS_DISPLAY)) :expand-shrink-range ((:input :label "Input") (:output :label "Output"))) (PRESSURE_ANGLE_DISPLAY :value-type :display-only :initial-value PRESSURE_ANGLE :title "Press. Angle") (PITCH_DIAMETER_DISPLAY :value-type :display-only :initial-value (/ NUMBER_OF_TEETH ( / 1 MODE)) :title "Pitch Diam.") (CIRCULAR_PITCH_DISPLAY :value-type :display-only :initial-value CIRCULAR_PITCH_SHOW :title "Circ. Pitch") (ROOT_DIAMETER_DISPLAY :value-type :display-only :initial-value (* 2.0 (- (/ (/ NUMBER_OF_TEETH ( / 1 MODE)) 2.0) (/ 1.25 ( / 1 MODE)))) :title "Root Diam.") (BASE_DIAMETER_DISPLAY :value-type :display-only :initial-value (* 2.0 BASE_CIRCLE_RADIUS) :title "Base Diam.") (OUTSIDE_DIAMETER_DISPLAY :value-type :display-only :initial-value (* 2.0 ADDENDUM_CIRCLE_RADIUS) :title "Outer Diam.") (ADDENDUM_DISPLAY :value-type :display-only :initial-value (/ 1.0 ( / 1 MODE)) :title "Addendum") (DEDENDUM_DISPLAY :value-type :display-only :initial-value (/ 1.25 ( / 1 MODE)) :title "Dedendum") (WORKIING_DEPTH-DISPLAY :value-type :display-only :initial-value (/ 2.0 ( / 1 MODE)) :title "Work. Depth") (CIRCULAR_THICK_DISPLAY :value-type :display-only :initial-value (/ (/ pi ( / 1 MODE)) 2.0) :title "Circ. Thick.") (FILLET_RADIUS_DISPLAY :value-type :display-only :initial-value (/ 0.157 ( / 1 MODE)) :title "Fillet Radius") (GEAR_TYPE_DISPLAY :value-type :display-only :initial-value TYPE_OF_GEAR :title "Gear Type") (NUMBER_OF_TEETH_DISPLAY :value-type :display-only :initial-value NUMBER_OF_TEETH :title "# Of Teeth") (MODE_DISPLAY :value-type :display-only :initial-value MODE :title "Diam. Pitch") (GEAR_WIDTH_DISPLAY :value-type :display-only :initial-value GEAR_WIDTH :title "Gear Width") (BORE_DIAMETER_DISPLAY :value-type :display-only :initial-value BORE_DIAMETER :title "Bore Diam.") (HUB_DIAMETER_DISPLAY :value-type :display-only :initial-value HUB_DIAMETER :title "Hub Diam.") (HUB_PROJECTION_DISPLAY :value-type :display-only :initial-value HUB_PROJECTION :title "Hub Projec.") (KEYWAY_WIDTH_DISPLAY :value-type :display-only :initial-value KEYWAY_WIDTH :title "Key. Width") (KEYWAY_DEPTH_DISPLAY :value-type :display-only :initial-value KEYWAY_DEPTH :title "Key. Depth") (NO_OF_KEYS_DISPLAY :value-type :display-only :initial-value NO_OF_KEYS :title "# Of Keyways"))) );progn );:SPUR (:HELICAL;-----If a HELICAL gear was choose (progn (sd-defdialog 'display-only :dialog-title "Gear Results" :variables '( (PARAMETER_VALUES :title "Parameters" :expand-shrink ((GEAR_TYPE_DISPLAY PRESSURE_ANGLE_DISPLAY NUMBER_OF_TEETH_DISPLAY MODE_DISPLAY HELIX_ANGLE_DISPLAY GEAR_WIDTH_DISPLAY BORE_DIAMETER_DISPLAY HUB_DIAMETER_DISPLAY HUB_PROJECTION_DISPLAY KEYWAY_WIDTH_DISPLAY KEYWAY_DEPTH_DISPLAY NO_OF_KEYS_DISPLAY) (PITCH_DIAMETER_DISPLAY CIRCULAR_PITCH_DISPLAY ROOT_DIAMETER_DISPLAY BASE_DIAMETER_DISPLAY OUTSIDE_DIAMETER_DISPLAY ADDENDUM_DISPLAY DEDENDUM_DISPLAY WORKIING_DEPTH-DISPLAY CIRCULAR_THICK_DISPLAY FILLET_RADIUS_DISPLAY)) :expand-shrink-range ((:input :label "Input") (:output :label "Output"))) (PRESSURE_ANGLE_DISPLAY :value-type :display-only :initial-value PRESSURE_ANGLE :title "Press. Angle") (HELIX_ANGLE_DISPLAY :value-type :display-only :initial-value HELIX_ANGLE :title "Helix Angle") (PITCH_DIAMETER_DISPLAY :value-type :display-only :initial-value PITCH_DIAMETER_SHOW :title "Pitch Diam.") (CIRCULAR_PITCH_DISPLAY :value-type :display-only :initial-value CIRCULAR_PITCH_SHOW :title "Circ. Pitch") (ROOT_DIAMETER_DISPLAY :value-type :display-only :initial-value (* 2.0 ROOT_CIRCLE_RADIUS_SHOW) :title "Root Diam.") (BASE_DIAMETER_DISPLAY :value-type :display-only :initial-value (* 2.0 BASE_CIRCLE_RADIUS_SHOW) :title "Base Diam.") (OUTSIDE_DIAMETER_DISPLAY :value-type :display-only :initial-value (* 2.0 ADDENDUM_CIRCLE_RADIUS) :title "Outer Diam.") (ADDENDUM_DISPLAY :value-type :display-only :initial-value ADDENDUM_SHOW :title "Addendum") (DEDENDUM_DISPLAY :value-type :display-only :initial-value DEDENDUM_SHOW :title "Dedendum") (WORKIING_DEPTH-DISPLAY :value-type :display-only :initial-value (/ 2.0 ( / 1 MODE)) :title "Work. Depth") (CIRCULAR_THICK_DISPLAY :value-type :display-only :initial-value CIRCULAR_THICKNESS_SHOW :title "Circ. Thick.") (FILLET_RADIUS_DISPLAY :value-type :display-only :initial-value ROOT_FILLET_RADIUS_SHOW :title "Fillet Radius") (GEAR_TYPE_DISPLAY :value-type :display-only :initial-value TYPE_OF_GEAR :title "Gear Type") (NUMBER_OF_TEETH_DISPLAY :value-type :display-only :initial-value NUMBER_OF_TEETH :title "# Of Teeth") (MODE_DISPLAY :value-type :display-only :initial-value MODE :title "Diam. Pitch") (GEAR_WIDTH_DISPLAY :value-type :display-only :initial-value GEAR_WIDTH :title "Gear Width") (BORE_DIAMETER_DISPLAY :value-type :display-only :initial-value BORE_DIAMETER :title "Bore Diam.") (HUB_DIAMETER_DISPLAY :value-type :display-only :initial-value HUB_DIAMETER :title "Hub Diam.") (HUB_PROJECTION_DISPLAY :value-type :display-only :initial-value HUB_PROJECTION :title "Hub Projec.") (KEYWAY_WIDTH_DISPLAY :value-type :display-only :initial-value KEYWAY_WIDTH :title "Key. Width") (KEYWAY_DEPTH_DISPLAY :value-type :display-only :initial-value KEYWAY_DEPTH :title "Key. Depth") (NO_OF_KEYS_DISPLAY :value-type :display-only :initial-value NO_OF_KEYS :title "# Of Keyways"))) );progn );:HELICAL (:BEVEL;-----If a BEVEL GEAR was choose (progn (sd-defdialog 'display-only :dialog-title "Gear Results" :variables '( (NUMBER_OF_TEETH_DISPLAY :value-type :display-only :initial-value NUMBER_OF_TEETH :title "# Of Teeth") (MODE_DISPLAY :value-type :display-only :initial-value MODE :title "Diam. Pitch") (PRESSURE_ANGLE_DISPLAY :value-type :display-only :initial-value PRESSURE_ANGLE :title "Press. Angle") (PITCH_ANGLE_DISPLAY :value-type :display-only :initial-value PITCH_ANGLE :title "Pitch Angle") (FACE_ANGLE_DISPLAY :value-type :display-only :initial-value USERS_INPUTTED_FACE_ANGLE :title "Face Angle") (ROOT_ANGLE_DISPLAY :value-type :display-only :initial-value USERS_INPUTTED_ROOT_ANGLE :title "Root Angle") (GEAR_WIDTH_DISPLAY :value-type :display-only :initial-value GEAR_WIDTH :title "Gear Width") (BORE_DIAMETER_DISPLAY :value-type :display-only :initial-value BORE_DIAMETER :title "Bore Diam.") (HUB_DIAMETER_DISPLAY :value-type :display-only :initial-value HUB_DIAMETER :title "Hub Diam.") (HUB_PROJECTION_DISPLAY :value-type :display-only :initial-value HUB_PROJECTION :title "Hub Projec.") (KEYWAY_WIDTH_DISPLAY :value-type :display-only :initial-value KEYWAY_WIDTH :title "Key. Width") (KEYWAY_DEPTH_DISPLAY :value-type :display-only :initial-value KEYWAY_DEPTH :title "Key. Depth") (NO_OF_KEYS_DISPLAY :value-type :display-only :initial-value NO_OF_KEYS :title "# Of Keyways") ("Specific Parameters") (PITCH_DIAMETER_DISPLAY :value-type :display-only :initial-value USERS_INPUTTED_PITCH_DIAMETER :title "Pitch Diam.") (CIRCULAR_PITCH_DISPLAY :value-type :display-only :initial-value CIRCULAR_PITCH_SHOW :title "Circ. Pitch") (CONE_DISTANCE_DISPLAY :value-type :display-only :initial-value CONE_DISTANCE_SHOW :title "Cone Dist.") (ADDENDUM_DISPLAY :value-type :display-only :initial-value ADDENDUM_SHOW :title "Addendum") (DEDENDUM_DISPLAY :value-type :display-only :initial-value DEDENDUM_SHOW :title "Dedendum") (WHOLE_DEPTH_DISPLAY :value-type :display-only :initial-value (+ ADDENDUM_SHOW DEDENDUM_SHOW) :title "Whole Depth") (FACE_WIDTH_DISPLAY :value-type :display-only :initial-value FACE_WIDTH_SHOW :title "Face Width") (OUTSIDE_DIAMETER_DISPLAY :value-type :display-only :initial-value OUTSIDE_DIAMETER_SHOW :title "Outside Dia.") ("Heel End of Tooth") (BEVEL_HEEL_CIRCULAR_THICKNESS_DISPLAY :value-type :display-only :initial-value BEVEL_HEEL_CIRCULAR_THICKNESS_SHOW :title "Circ. Thick.") (BEVEL_HEEL_CHORDAL_THICKNESS_DISPLAY :value-type :display-only :initial-value BEVEL_HEEL_CHORDAL_THICKNESS_SHOW :title "Chord. Thick.") (BEVEL_HEEL_BACKLASH_DISPLAY :value-type :display-only :initial-value BEVEL_HEEL_BACKLASH_SHOW :title "Backlash") ("Toe End of Tooth") (BEVEL_TOE_CIRCULAR_THICKNESS_DISPLAY :value-type :display-only :initial-value BEVEL_TOE_CIRCULAR_THICKNESS_SHOW :title "Circ. Thick.") (BEVEL_TOE_CHORDAL_THICKNESS_DISPLAY :value-type :display-only :initial-value BEVEL_TOE_CHORDAL_THICKNESS_SHOW :title "Chord. Thick.") (BEVEL_TOE_BACKLASH_DISPLAY :value-type :display-only :initial-value USERS_INPUTTED_BEVEL_TOE_BACKLASH :title "Backlash") ("Save Parameters To File") (SAVE_TO_FILE :title "Save Parameters To File" :expand-shrink (RESULTS_FILENAME)) (RESULTS_FILENAME :value-type :filename) );' :ok-action-precondition :ok :ok-action '(progn (if RESULTS_FILENAME (progn (setq RESULTS_FILENAME (elt RESULTS_FILENAME 0)) (DISPLAY RESULTS_FILENAME) (display "Pinion Results") (display " ") (display "Number of teeth:") (display NUMBER_OF_TEETH) (display " ") (display "Module:") (display MODE) (display " ") (display "Pressure angle:") (display PRESSURE_ANGLE) (display " ") (display "Pitch Angle:") (display PITCH_ANGLE) (display " ") (display "Face Angle:") (display USERS_INPUTTED_FACE_ANGLE) (display " ") (display "Root Angle:") (display USERS_INPUTTED_ROOT_ANGLE) (display " ") (display "Gear Width:") (display GEAR_WIDTH) (display " ") (display "Bore Diameter:") (display BORE_DIAMETER) (display " ") (display "Hub Diameter:") (display HUB_DIAMETER) (display " ") (display "Hub Projection:") (display HUB_PROJECTION) (display " ") (display "Keyway width:") (display KEYWAY_WIDTH) (display " ") (display "Keyway depth:") (display KEYWAY_DEPTH) (display " ") (display "Number of keyways:") (display NO_OF_KEYS) (display " ") (display "-------------------") (display "Specific Parameters") (display "-------------------") (display " ") (display "Pitch diameter:") (display USERS_INPUTTED_PITCH_DIAMETER) (display " ") (display "Circular pitch:") (display CIRCULAR_PITCH_SHOW) (display " ") (display "Cone distance:") (display CONE_DISTANCE_SHOW) (display " ") (display "Addendum:") (display ADDENDUM_SHOW) (display " ") (display "Dedendum:") (display DEDENDUM_SHOW) (display " ") (display "Whole depth:") (display (+ ADDENDUM_SHOW DEDENDUM_SHOW)) (display " ") (display "Face width:") (display FACE_WIDTH_SHOW) (display " ") (display "Outside diameter:") (display OUTSIDE_DIAMETER_SHOW) (display " ") (display "-----") (display "Heel End of Tooth") (display "-----") (display "Circular thickness:") (display BEVEL_HEEL_CIRCULAR_THICKNESS_SHOW) (display " ") (display "Chordal thickness:") (display BEVEL_HEEL_CHORDAL_THICKNESS_SHOW) (display " ") (display "Backlash:") (display BEVEL_HEEL_BACKLASH_SHOW) (display " ") (display "-----") (display "Toe End of Tooth") (display "-----") (display "Circular thickness:") (display BEVEL_TOE_CIRCULAR_THICKNESS_SHOW) (display " ") (display "Chordal thickness:") (display BEVEL_TOE_CHORDAL_THICKNESS_SHOW) (display " ") (display "Backlash:") (display USERS_INPUTTED_BEVEL_TOE_BACKLASH) (save_output_box_list RESULTS_FILENAME) (display :clear) (display :hide) );progn );if );'progn );sd-defdialog );progn );:BEVEL (:PINION;-----If a BEVEL PINION was choose (progn (sd-defdialog 'display-only :dialog-title "Gear Results" :variables '( (NUMBER_OF_TEETH_DISPLAY :title "Number of Teeth") (NUMBER_OF_GEAR_TEETH_DISPLAY :value-type :display-only :initial-value NUMBER_OF_BEVEL_TEETH :title "Bevel Teeth") (NUMBER_OF_PINION_TEETH_DISPLAY :value-type :display-only :initial-value NUMBER_OF_PINION_TEETH :title "Pinion Teeth") (MODE_DISPLAY :value-type :display-only :initial-value MODE :title "Diam. Pitch") (PRESSURE_ANGLE_DISPLAY :value-type :display-only :initial-value PRESSURE_ANGLE :title "Press. Angle") (PITCH_ANGLE_DISPLAY :value-type :display-only :initial-value PITCH_ANGLE :title "Pitch Angle") (FACE_ANGLE_DISPLAY :value-type :display-only :initial-value USERS_INPUTTED_FACE_ANGLE :title "Face Angle") (ROOT_ANGLE_DISPLAY :value-type :display-only :initial-value USERS_INPUTTED_ROOT_ANGLE :title "Root Angle") (GEAR_WIDTH_DISPLAY :value-type :display-only :initial-value GEAR_WIDTH :title "Gear Width") (BORE_DIAMETER_DISPLAY :value-type :display-only :initial-value BORE_DIAMETER :title "Bore Diam.") (HUB_DIAMETER_DISPLAY :value-type :display-only :initial-value HUB_DIAMETER :title "Hub Diam.") (HUB_PROJECTION_DISPLAY :value-type :display-only :initial-value HUB_PROJECTION :title "Hub Projec.") (KEYWAY_WIDTH_DISPLAY :value-type :display-only :initial-value KEYWAY_WIDTH :title "Key. Width") (KEYWAY_DEPTH_DISPLAY :value-type :display-only :initial-value KEYWAY_DEPTH :title "Key. Depth") (NO_OF_KEYS_DISPLAY :value-type :display-only :initial-value NO_OF_KEYS :title "# Of Keyways") ("Specific Parameters") (PITCH_DIAMETER_DISPLAY :value-type :display-only :initial-value USERS_INPUTTED_PITCH_DIAMETER :title "Pitch Diam.") (CIRCULAR_PITCH_DISPLAY :value-type :display-only :initial-value CIRCULAR_PITCH_SHOW :title "Circ. Pitch") (CONE_DISTANCE_DISPLAY :value-type :display-only :initial-value CONE_DISTANCE_SHOW :title "Cone Dist.") (ADDENDUM_DISPLAY :value-type :display-only :initial-value ADDENDUM_SHOW :title "Addendum") (DEDENDUM_DISPLAY :value-type :display-only :initial-value DEDENDUM_SHOW :title "Dedendum") (WHOLE_DEPTH_DISPLAY :value-type :display-only :initial-value (+ ADDENDUM_SHOW DEDENDUM_SHOW) :title "Whole Depth") (FACE_WIDTH_DISPLAY :value-type :display-only :initial-value FACE_WIDTH_SHOW :title "Face Width") (OUTSIDE_DIAMETER_DISPLAY :value-type :display-only :initial-value OUTSIDE_DIAMETER_SHOW :title "Outside Dia.") ("Heel End of Tooth") (BEVEL_HEEL_CIRCULAR_THICKNESS_DISPLAY :value-type :display-only :initial-value BEVEL_HEEL_CIRCULAR_THICKNESS_SHOW :title "Circ. Thick.") (BEVEL_HEEL_CHORDAL_THICKNESS_DISPLAY :value-type :display-only :initial-value BEVEL_HEEL_CHORDAL_THICKNESS_SHOW :title "Chord. Thick.") (BEVEL_HEEL_BACKLASH_DISPLAY :value-type :display-only :initial-value BEVEL_HEEL_BACKLASH_SHOW :title "Backlash") ("Toe End of Tooth") (BEVEL_TOE_CIRCULAR_THICKNESS_DISPLAY :value-type :display-only :initial-value BEVEL_TOE_CIRCULAR_THICKNESS_SHOW :title "Circ. Thick.") (BEVEL_TOE_CHORDAL_THICKNESS_DISPLAY :value-type :display-only :initial-value BEVEL_TOE_CHORDAL_THICKNESS_SHOW :title "Chord. Thick.") (BEVEL_TOE_BACKLASH_DISPLAY :value-type :display-only :initial-value USERS_INPUTTED_BEVEL_TOE_BACKLASH :title "Backlash") ("Save Parameters To File") (SAVE_TO_FILE :title "Save Parameters To File" :expand-shrink (RESULTS_FILENAME)) (RESULTS_FILENAME :value-type :filename) );' :ok-action-precondition :ok :ok-action '(progn (if RESULTS_FILENAME (progn (setq RESULTS_FILENAME (elt RESULTS_FILENAME 0)) (DISPLAY RESULTS_FILENAME) (display "Pinion Results") (display " ") (display "Number of gear teeth:") (display NUMBER_OF_BEVEL_TEETH) (display " ") (display "Number of pinion teeth:") (display NUMBER_OF_PINION_TEETH) (display " ") (display "Module:") (display MODE) (display " ") (display "Pressure angle:") (display PRESSURE_ANGLE) (display " ") (display "Pitch Angle:") (display PITCH_ANGLE) (display " ") (display "Face Angle:") (display USERS_INPUTTED_FACE_ANGLE) (display " ") (display "Root Angle:") (display USERS_INPUTTED_ROOT_ANGLE) (display " ") (display "Gear Width:") (display GEAR_WIDTH) (display " ") (display "Bore Diameter:") (display BORE_DIAMETER) (display " ") (display "Hub Diameter:") (display HUB_DIAMETER) (display " ") (display "Hub Projection:") (display HUB_PROJECTION) (display " ") (display "Keyway width:") (display KEYWAY_WIDTH) (display " ") (display "Keyway depth:") (display KEYWAY_DEPTH) (display " ") (display "Number of keyways:") (display NO_OF_KEYS) (display " ") (display "-------------------") (display "Specific Parameters") (display "-------------------") (display " ") (display "Pitch diameter:") (display USERS_INPUTTED_PITCH_DIAMETER) (display " ") (display "Circular pitch:") (display CIRCULAR_PITCH_SHOW) (display " ") (display "Cone distance:") (display CONE_DISTANCE_SHOW) (display " ") (display "Addendum:") (display ADDENDUM_SHOW) (display " ") (display "Dedendum:") (display DEDENDUM_SHOW) (display " ") (display "Whole depth:") (display (+ ADDENDUM_SHOW DEDENDUM_SHOW)) (display " ") (display "Face width:") (display FACE_WIDTH_SHOW) (display " ") (display "Outside diameter:") (display OUTSIDE_DIAMETER_SHOW) (display " ") (display "-----") (display "Heel End of Tooth") (display "-----") (display "Circular thickness:") (display BEVEL_HEEL_CIRCULAR_THICKNESS_SHOW) (display " ") (display "Chordal thickness:") (display BEVEL_HEEL_CHORDAL_THICKNESS_SHOW) (display " ") (display "Backlash:") (display BEVEL_HEEL_BACKLASH_SHOW) (display " ") (display "-----") (display "Toe End of Tooth") (display "-----") (display "Circular thickness:") (display BEVEL_TOE_CIRCULAR_THICKNESS_SHOW) (display " ") (display "Chordal thickness:") (display BEVEL_TOE_CHORDAL_THICKNESS_SHOW) (display " ") (display "Backlash:") (display USERS_INPUTTED_BEVEL_TOE_BACKLASH) (save_output_box_list RESULTS_FILENAME) (display :clear) (display :hide) );progn );if );'progn );sd-defdialog );progn );:PINION );ecase (CLEAR_VARIABLES_FUNCTION) );progn );sd-defdialog 'Metric-GEARDESIGNER