Пример #1
0
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            Util.Gears gear = new Util.Gears();
            Helical  = new List <Brep>();
            Profiles = new List <Curve>();
            Pitches  = new List <Circle>();

            DA.GetDataList <Curve>(0, Profiles);
            DA.GetDataList <Circle>(1, Pitches);
            DA.GetData <double>(2, ref Angle);
            DA.GetData <double>(3, ref Heigh);
            DA.GetData <Boolean>(4, ref ifSolid);
            int flip = 0;

            for (int i = 0; i < Profiles.Count; i++)
            {
                if (flip == 0)
                {
                    Helical.Add(gear.buildHelical(Profiles[i], Pitches[i], 90.0 - Angle, Heigh, ifSolid));
                    flip -= 1;
                }
                else
                {
                    Helical.Add(gear.buildHelical(Profiles[i], Pitches[i], 90.0 + Angle, Heigh, ifSolid));
                    flip += 1;
                }
            }

            DA.SetDataList(0, Helical);
        }
Пример #2
0
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            Util.Gears gear = new Util.Gears();
            Circles.Clear();
            Spur.Clear();
            Ratio.Clear();
            List <int>    ratioInt = new List <int>();
            List <Circle> Pitch    = new List <Circle>();

            DA.GetDataList <Circle>(0, Circles);
            DA.GetData <double>(1, ref Teeth);
            DA.GetData <double>(2, ref Angle);
            DA.GetData <double>(3, ref shift);
            DA.GetData <double>(4, ref addendum);
            DA.GetData <double>(5, ref dedendum);

            Spur  = gear.buildGear(Circles, Teeth, Angle, shift, addendum, dedendum, out ratioInt);
            Ratio = new Util.GCD(ratioInt).getGCD();

            DA.SetDataList(0, Spur);
            Pitch = Circles;
            DA.SetDataList(1, Pitch);
            DA.SetDataList(2, Ratio);

            texts     = gear.texts;
            locations = gear.locations;
            sizes     = gear.sizes;
        }
Пример #3
0
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            Util.Gears gear = new Util.Gears();
            LModules.Clear();
            Tangents.Clear();
            HelicalRacks.Clear();

            DA.GetDataList <Line>("Line", Tangents);
            DA.GetDataList <System.Object>("CircleModule", LModules);
            DA.GetData <double>("Teeth", ref Teeth);
            DA.GetData <double>("Angle", ref Angle);
            DA.GetData <double>("HelicalAngle", ref betaAngle);
            DA.GetData <double>("Depth", ref Depth);
            DA.GetData <double>("addendum", ref addendum);
            DA.GetData <double>("dedendum", ref dedendum);

            for (int i = 0; i < Tangents.Count; i++)
            {
                System.Object obj = LModules[0];
                if (LModules.Count - 1 < i)
                {
                    obj = LModules[LModules.Count - 1];
                }
                else
                {
                    obj = LModules[i];
                }
                double n;
                Circle c = new Circle();
                if (GH_Convert.ToCircle(obj, ref c, GH_Conversion.Both))
                {
                    HelicalRacks.Add(gear.buildHelicalRack(Tangents[i], c, Teeth, Angle, betaAngle, Depth, addendum, dedendum));
                }
                if (GH_Convert.ToDouble(obj, out n, GH_Conversion.Primary))
                {
                    HelicalRacks.Add(gear.buildHelicalRack(Tangents[i], n, Teeth, Angle, betaAngle, Depth, addendum, dedendum));
                }
            }


            DA.SetDataList(0, HelicalRacks);

            texts     = gear.texts;
            locations = gear.locations;
            sizes     = gear.sizes;
        }
Пример #4
0
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            Util.Gears gear = new Util.Gears();
            LModules = new List <System.Object>();
            Tangents = new List <Line>();
            Rack     = new List <Curve>();

            DA.GetDataList <Line>(0, Tangents);
            DA.GetDataList <System.Object>(1, LModules);
            DA.GetData <double>(2, ref Teeth);
            DA.GetData <double>(3, ref Angle);
            DA.GetData <double>(4, ref addendum);
            DA.GetData <double>(5, ref dedendum);

            for (int i = 0; i < Tangents.Count; i++)
            {
                System.Object obj = LModules[0];
                if (LModules.Count - 1 < i)
                {
                    obj = LModules[LModules.Count - 1];
                }
                else
                {
                    obj = LModules[i];
                }
                double n;
                Circle c = new Circle();
                if (GH_Convert.ToCircle(obj, ref c, GH_Conversion.Both))
                {
                    Rack.Add(gear.buildRack(Tangents[i], c, Teeth, Angle, addendum, dedendum));
                }
                if (GH_Convert.ToDouble(obj, out n, GH_Conversion.Primary))
                {
                    Rack.Add(gear.buildRack(Tangents[i], n, Teeth, Angle, addendum, dedendum));
                }
            }


            DA.SetDataList(0, Rack);

            texts     = gear.texts;
            locations = gear.locations;
            sizes     = gear.sizes;
        }
Пример #5
0
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            Util.Gears gear = new Util.Gears();
            Pitches.Clear();

            DA.GetData <Circle>(0, ref Base);
            DA.GetData <double>(1, ref Radius);
            DA.GetData <double>(2, ref Angle);
            DA.GetData <double>(3, ref Location);

            Pitches.Add(Base);
            Pitches.Add(gear.buildPitchFromRadius(Base, Radius, Angle, Location, out Axe));

            DA.SetDataList(0, Pitches);
            DA.SetData(1, Axe);

            texts     = gear.texts;
            locations = gear.locations;
            sizes     = gear.sizes;
        }
Пример #6
0
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            Util.Gears gear = new Util.Gears();
            Pitches.Clear();

            DA.GetData <Curve>(0, ref refC);
            DA.GetData <double>(1, ref Radius);
            refC.TryGetPolyline(out refAxe);

            Pitches = gear.buildPitch(refAxe, Radius);
            outAxe  = Curve.CreateInterpolatedCurve(new List <Point3d> {
                refAxe[0], refAxe[1], Pitches[1].Center
            }, 1);

            DA.SetDataList(0, Pitches);
            DA.SetData(1, outAxe);

            texts     = gear.texts;
            locations = gear.locations;
            sizes     = gear.sizes;
        }