Пример #1
0
 public void setProfile(GearInfo info, bool isA)
 {
     info_ = info;
     calc_ = GearDrawing.calcGears(info)[isA ? 0 : 1];
     recalc();
     Invalidate();
 }
Пример #2
0
 public static GearCalc[] calcGears(GearInfo info)
 {
     GearCalc[] ret = new GearCalc[2];
     if (!info.ok)
     {
         return(ret);
     }
     ret[0].moduleInch     = 1.0 / info.pitchGpi;
     ret[1].moduleInch     = 1.0 / info.pitchGpi;
     ret[0].radius         = (double)info.aNumTeeth * ret[0].moduleInch / 2;
     ret[1].radius         = (double)info.bNumTeeth * ret[1].moduleInch / 2;
     ret[0].baseRadius     = ret[0].radius * Math.Cos(info.pressureAngle * Math.PI / 180);
     ret[1].baseRadius     = ret[1].radius * Math.Cos(info.pressureAngle * Math.PI / 180);
     ret[0].centerDistance = ret[0].radius + ret[1].radius;
     ret[1].centerDistance = ret[0].radius + ret[1].radius;
     ret[0].addendum       = ret[0].moduleInch * info.stubRatio * (1 + info.profileShift);
     ret[1].addendum       = ret[0].moduleInch * info.stubRatio * (1 - info.profileShift);
     ret[0].dedendum       = ret[0].moduleInch * info.stubRatio * (1.25f - info.profileShift);
     ret[1].dedendum       = ret[0].moduleInch * info.stubRatio * (1.25f + info.profileShift);
     ret[0].profileShift   = info.profileShift;
     ret[1].profileShift   = -info.profileShift;
     ret[0].numTeeth       = info.aNumTeeth;
     ret[1].numTeeth       = info.bNumTeeth;
     ret[0].ok             = true;
     ret[1].ok             = true;
     return(ret);
 }
Пример #3
0
 public void setProfile(GearInfo info, bool isA)
 {
     info_ = info;
     calc_ = GearDrawing.calcGears(info)[isA ? 0 : 1];
     recalc();
     Invalidate();
 }
Пример #4
0
 public void setInfo(GearInfo info, GearCalc gearA, GearCalc gearB, PointF[] profileA, PointF[] profileB)
 {
     info_             = info;
     calcPinion_       = gearA;
     calcGear_         = gearB;
     profileA_         = profileA;
     profileB_         = profileB;
     labelExample.Text = makeFileName(true, false);
 }
Пример #5
0
 public void setInfo(GearInfo info, GearCalc gearA, GearCalc gearB, PointF[] profileA, PointF[] profileB)
 {
     info_ = info;
     calcPinion_ = gearA;
     calcGear_ = gearB;
     profileA_ = profileA;
     profileB_ = profileB;
     labelExample.Text = makeFileName(true, false);
 }
Пример #6
0
        private GearInfo readGearInfo(bool changeUi)
        {
            GearInfo gi = new GearInfo();

            gi.ok            = true;
            gi.pitchGpi      = fieldDouble(textPitch, ref gi.ok, changeUi);
            gi.aNumTeeth     = fieldInt(textGearsA, ref gi.ok, changeUi);
            gi.bNumTeeth     = fieldInt(textGearsB, ref gi.ok, changeUi);
            gi.pressureAngle = fieldDouble(textPressureAngle, ref gi.ok, changeUi);
            gi.stubRatio     = fieldDouble(textStubRatio, ref gi.ok, changeUi);
            gi.profileShift  = fieldDouble(textProfileShift, ref gi.ok, changeUi);
            return(gi);
        }
Пример #7
0
        private void configureEverything()
        {
            this.Validate();
            ExtractSettings(new RegistrySave(@"\Software\Enchanted Age\Gear Generator\Gears"));
            GearInfo gi = verifyGearUi(true);

            gearDrawing1.setInfo(gi);
            toothForm1.setProfile(gi, true);
            toothForm2.setProfile(gi, false);
            if (export != null)
            {
                export.setInfo(toothForm1.Info, toothForm1.Calc, toothForm2.Calc, toothForm1.Profile, toothForm2.Profile);
            }
        }
Пример #8
0
 public void setInfo(GearInfo info)
 {
     info_ = info;
     recalc();
 }
Пример #9
0
 public static GearCalc[] calcGears(GearInfo info)
 {
     GearCalc[] ret = new GearCalc[2];
     if (!info.ok)
     {
         return ret;
     }
     ret[0].moduleInch = 1.0 / info.pitchGpi;
     ret[1].moduleInch = 1.0 / info.pitchGpi;
     ret[0].radius = (double)info.aNumTeeth * ret[0].moduleInch / 2;
     ret[1].radius = (double)info.bNumTeeth * ret[1].moduleInch / 2;
     ret[0].baseRadius = ret[0].radius * Math.Cos(info.pressureAngle * Math.PI / 180);
     ret[1].baseRadius = ret[1].radius * Math.Cos(info.pressureAngle * Math.PI / 180);
     ret[0].centerDistance = ret[0].radius + ret[1].radius;
     ret[1].centerDistance = ret[0].radius + ret[1].radius;
     ret[0].addendum = ret[0].moduleInch * info.stubRatio * (1 + info.profileShift);
     ret[1].addendum = ret[0].moduleInch * info.stubRatio * (1 - info.profileShift);
     ret[0].dedendum = ret[0].moduleInch * info.stubRatio * (1.25f - info.profileShift);
     ret[1].dedendum = ret[0].moduleInch * info.stubRatio * (1.25f + info.profileShift);
     ret[0].profileShift = info.profileShift;
     ret[1].profileShift = -info.profileShift;
     ret[0].numTeeth = info.aNumTeeth;
     ret[1].numTeeth = info.bNumTeeth;
     ret[0].ok = true;
     ret[1].ok = true;
     return ret;
 }
Пример #10
0
 public void setInfo(GearInfo info)
 {
     info_ = info;
     recalc();
 }
Пример #11
0
        private GearInfo verifyGearUi(bool changeUi)
        {
            GearInfo gi = readGearInfo(changeUi);

            if (gi.pitchGpi < 1 || gi.pitchGpi > 150)
            {
                if (changeUi)
                {
                    textPitch.Focus();
                    textPitch.SelectAll();
                }
                labelError.Show();
                gi.ok = false;
                return(gi);
            }
            if (gi.aNumTeeth < 6 || gi.aNumTeeth > 1000)
            {
                if (changeUi)
                {
                    textGearsA.Focus();
                    textGearsA.SelectAll();
                }
                labelError.Show();
                gi.ok = false;
                return(gi);
            }
            if (gi.bNumTeeth < 6 || gi.bNumTeeth > 1000)
            {
                if (changeUi)
                {
                    textGearsB.Focus();
                    textGearsB.SelectAll();
                }
                labelError.Show();
                gi.ok = false;
                return(gi);
            }
            if (gi.pressureAngle > 32 || gi.pressureAngle < 3)
            {
                if (changeUi)
                {
                    textPressureAngle.Focus();
                    textPressureAngle.SelectAll();
                }
                labelError.Show();
                gi.ok = false;
                return(gi);
            }
            if (gi.stubRatio < 0.25 || gi.stubRatio > 1.5)
            {
                if (changeUi)
                {
                    textStubRatio.Focus();
                    textStubRatio.SelectAll();
                }
                labelError.Show();
                gi.ok = false;
                return(gi);
            }
            if (gi.profileShift < -1 || gi.profileShift > 1)
            {
                if (changeUi)
                {
                    textProfileShift.Focus();
                    textProfileShift.SelectAll();
                }
                labelError.Show();
                gi.ok = false;
                return(gi);
            }
            labelError.Hide();
            return(gi);
        }