Example #1
0
 public void SetParameterList(DaneWalka walek, Lathe lathe, string cmc, List <List <QTurningTool> > turnings)
 {
     Walek    = walek;
     Lathe    = lathe;
     Cmc      = cmc;
     Turnings = turnings;
 }
Example #2
0
        public void Calculate(DaneWalka walek, Lathe lathe, QTurningTool tool, string cmc)
        {
            Walek       = walek;
            Lathe       = lathe;
            Tool        = tool;
            Obrobka     = "";
            CmcMaterial = cmc;
            Stopien     = 0;

            for (int i = 0; i < Walek.Stopnie; i++)
            {
                RodzajObrobki();
                GlebokoscSkrawania();
                Posuw();
                PredkoscSkrawania();
                PredkoscObrotowa();
                WydajnoscObjetosciowa();
                GruboscWiora();
                OporWlasciwy();
                GlownaSilaSkrawania();
                DostepnaMoc();
                PotrzebnaMoc();
                CzasMaszynowy();
                Stopien++;
            }
        }
Example #3
0
        public IEnumerable <TurnToolTab> GetTools(Lathe lathe, string zabieg)
        {
            var query = from t in db.TurnToolTabs
                        where t.Accuracy.Contains(zabieg) && t.Kappa >= 55
                        select t;

            return(query);
        }
Example #4
0
        //public double AP { get; set; } //glebokosc skrawania [mm]
        //public double F { get; set; } //posuw [mm/obr]
        //public double VC { get; set; } //predkosc skrawania [m/min]
        //public double N { get; set; } //predkosc obrotowa napedu obrabiarki [obr/min]
        //public double Q { get; set; } //wydajnosc objetosciowa [cm3/min]
        //public double TG { get; set; } //czas maszynowy obrobki [min]
        //public double T { get; set; } //okres trwalosci [min]
        //public double FC { get; private set; } //glowna sila skrawania [N]
        //public double KC { get; private set; } //opor wlasciwy skrawania
        //public double HM { get; private set; } //grubosc wiora
        //public double PC { get; private set; } //moc skrawania netto [kW]
        //public double PE { get; private set; } //dostepna moc [kW]

        internal void SetParameter(DaneWalka walek, Lathe lathe, QTurningTool tool, string cmc)
        {
            Walek       = walek;
            Lathe       = lathe;
            Tool        = tool;
            Obrobka     = "";
            CmcMaterial = cmc;
        }
Example #5
0
        public void BasicTest()
        {
            var lathe = new Lathe();

            Check.That(lathe.Name).IsNull();
            Check.That(lathe.Sturm).IsNull();
            Check.That(lathe.NbPoints).IsEqualTo(0);
            Check.That(lathe.Spline).IsNull();
        }
Example #6
0
        public void ConstructorTest()
        {
            var lathe = new Lathe("MyLathe")
            {
                Sturm  = Lathe.SturmFlag.sturm,
                Spline = Lathe.ObjectSplineType.bezier_spline
            };

            Check.That(lathe.Name).IsEqualTo("MyLathe");
            Check.That(lathe.Sturm).IsEqualTo(Lathe.SturmFlag.sturm);
            Check.That(lathe.Spline).IsEqualTo(Lathe.ObjectSplineType.bezier_spline);
        }
Example #7
0
        public void ToPovCodeTest()
        {
            var lathe = new Lathe("MyLathe")
            {
                Sturm  = Lathe.SturmFlag.sturm,
                Spline = Lathe.ObjectSplineType.bezier_spline
            };

            lathe.Add(0, 0).Add(6, 0).Add(6, 8).Add(0, 8).Add(0, 0)  //outer rim
            .Add(1, 1).Add(5, 1).Add(5, 7).Add(1, 7).Add(1, 1);      //inner rim

            var povCode = lathe.ToPovCode();

            Check.That(povCode).IsEqualTo("lathe {\n bezier_spline\n 10\n < 0, 0>, < 6, 0>, < 6, 8>, < 0, 8>, < 0, 0>, < 1, 1>, < 5, 1>, < 5, 7>, < 1, 7>, < 1, 1>\n sturm\n}");
        }
Example #8
0
            public Nose(float middleHeight, float baseHeight, int numPoints, float bottomFlatness)
            {
                var spline = BSpline <Vec3> .FromControlPoints(2,
                                                               new Vec3 (-1f, 0f, 0f),
                                                               new Vec3 (0f, middleHeight, 0f),
                                                               new Vec3 (1f, baseHeight, 0f));

                Profile = Path <P, Vec3> .FromBSpline(spline, 8);

                Cone = Lathe <V> .Turn(Profile,
                                       turnAxis : Axis.X,
                                       offset : new Vec3(0f),
                                       stepAngle : MathHelper.TwoPi / numPoints)
                       .ManipulateVertices(
                    Manipulators.Scale <V> (1f, 1f - bottomFlatness, 1f).Where(v => v.position.Y < 0f), true)
                       .RotateY(90f.Radians())
                       .Color(_color);

                XSection = Path <P, Vec3> .FromVecs(
                    from v in Cone.Vertices.Furthest (Dir3D.Back)
                    select v.position);
            }
Example #9
0
            public Canopy(float frontHeight, float backHeight, float bend, int numPoints)
            {
                var spline = BSpline <Vec3> .FromControlPoints(2,
                                                               new Vec3 (-1.1f, 0f, 0f),
                                                               new Vec3 (-1f, 0.2f, 0f),
                                                               new Vec3 (-0f, frontHeight, 0f),
                                                               new Vec3 (1f, backHeight, 0f),
                                                               new Vec3 (2.5f, 0.1f, 0f),
                                                               new Vec3 (2.5f, 0f, 0f)
                                                               );

                Profile = Path <P, Vec3> .FromBSpline(spline, numPoints);

                var angle = 105f.Radians();

                Geometry = Lathe <V> .Turn(Profile, Axis.X, new Vec3 (0f), MathHelper.Pi / numPoints,
                                           -angle, angle)
                           .RotateY(90f.Radians())
                           .RotateX(bend.Radians())
                           .Scale(0.85f, 1f, 1f)
                           .Translate(0f, 0.6f, -2.3f)
                           .Color(VertexColor <Vec3> .DarkGlass)
                           .Reflectivity(0.4f);
            }
Example #10
0
        //getting turnings base on data
        //LT = longitudal turning
        //FC = facing
        //PR = profiling
        //CH =
        public List <List <QTurningTool> > GetTurningTools(IEnumerable <TurnToolTab> tools, Lathe lathe, DaneWalka walek, List <string> grades, int iloscPrzejsc, int stopien)
        {
            var dlugosc   = Convert.ToDouble(lathe.Gniazdo.Substring(0, 2));
            var szerokosc = Convert.ToDouble(lathe.Gniazdo.Substring(3, 2));
            var ap        = Convert.ToDecimal(walek.APMAX.Max());
            var turnings  = new List <List <QTurningTool> >();

            if (stopien == 0)
            {
                var TurnRG = from l in db.QTurningTools
                             where l.B == dlugosc && l.H == szerokosc && l.MaxAp >= walek.APRGREAL.Max() &&
                             l.Kr <= 90 &&
                             l.Re <= (decimal)2.4 &&
                             l.Re >= (decimal)1.6 &&
                             l.Ht == "L" &&
                             l.OpA == "LT" &&
                             l.Geometry.Contains("PR")
                             select l;
                turnings.Add(TurnRG.ToList());
            }
            else
            {
                var list = walek.DMT.FindAll(elem => elem > walek.DMT[stopien - 1]);
                list.Add(walek.SRC);
                list.Sort();
                var apStopnia = (list.First() - walek.DMT[stopien - 1]) / 2 / iloscPrzejsc;

                var TurnRG = from l in db.QTurningTools
                             where l.B == dlugosc && l.H == szerokosc && l.MaxAp >= apStopnia &&
                             l.Kr < 90 &&
                             l.Re <= (decimal)2.4 &&
                             l.Re >= (decimal)1.6 &&
                             l.Ht == "L" &&
                             l.OpA == "LT" &&
                             l.Geometry.Contains("PR")
                             select l;
                turnings.Add(TurnRG.ToList());
            }

            var TurnMT = from l in db.QTurningTools
                         where l.B == dlugosc && l.H == szerokosc && l.MaxAp > walek.QMT &&
                         l.Kr >= 90 &&
                         l.Re <= (decimal)1.2 &&
                         l.Ht == "L" &&
                         l.OpA == "LT" &&
                         l.Geometry.Contains("PM")
                         select l;

            turnings.Add(TurnMT.ToList());

            var TurnFN = from l in db.QTurningTools
                         where l.B == dlugosc && l.H == szerokosc && l.MaxAp > walek.QFN &&
                         l.Kr > 90 &&
                         l.Re <= (decimal)0.4 &&
                         l.Ht == "L" &&
                         l.OpA == "LT" &&
                         l.Geometry.Contains("PF")
                         select l;

            turnings.Add(TurnFN.ToList());


            turnings = SortByGrade(grades, turnings);
            turnings = SortByMaxAp(turnings);
            if (turnings[0].Count == 0)
            {
                throw new ArgumentException("Nie odnaleziono narzędzi do obróbki zrubnej.");
            }
            return(turnings);
        }
Example #11
0
        /*
         * [MenuItem("GameObject/3D Object/Archimatix Nodes/Meshers/Lathe")]
         * static void Init() {
         *      AXEditorUtilities.addNodeToCurrentModel("Lathe");
         * }
         */

        public override void drawControlHandlesofInputParametricObjects(ref List <string> visited, Matrix4x4 consumerM)
        {
            Lathe gener = (generator as Lathe);

            //if (visited.Contains ("c_"+parametricObject.Guid))
            //	return;
            //visited.Add ("c_"+parametricObject.Guid);


            // SECTION
            if (gener.sectionSrc_po != null && gener.sectionSrc_po.generator != null)
            {
                GeneratorHandler gh = getGeneratorHandler(gener.sectionSrc_po);

                if (gh != null)
                {
                    Matrix4x4 localSecM = parametricObject.model.transform.localToWorldMatrix * generator.parametricObject.worldDisplayMatrix;                    // * generator.getLocalConsumerMatrixPerInputSocket(gener.sectionSrc_po);
                    if (gener.sectionSrc_po.is2D())
                    {
                        gh.drawTransformHandles(visited, localSecM, true);
                    }
                    gh.drawControlHandles(ref visited, localSecM, true);
                }
            }



            // PLAN

            Matrix4x4 prevHandlesMatrix = Handles.matrix;



            float y           = .5f * HandleUtility.GetHandleSize(Vector3.zero);
            float yd          = 0.5f * HandleUtility.GetHandleSize(Vector3.zero) + .2f * parametricObject.bounds.extents.y;
            float handleSizer = .15f * HandleUtility.GetHandleSize(Vector3.zero);

            Handles.matrix *= Matrix4x4.TRS(new Vector3(0, -yd, 0), Quaternion.identity, Vector3.one);

            Vector3 pos;

            Color lightLineColor = new Color(1, .8f, .6f, .7f);
            Color brightOrange   = new Color(1, .8f, 0, .9f);


            // RADIUS //

            Handles.color = brightOrange;

            //Handles.DrawLine(new Vector3(gener.radius, y, 0), new Vector3(gener.radius, -y, 0));
            Handles.DrawLine(new Vector3(0, 0, 0), new Vector3(0, -y, 0));

            //Handles.DrawLine(new Vector3(0, -y*.66f, 0), new Vector3(gener.radius, -y*.66f, 0));

            // RADIUS LABEL
            GUIStyle labelStyle = new GUIStyle();

            labelStyle.alignment        = TextAnchor.MiddleCenter;
            labelStyle.normal.textColor = Color.white;

            Handles.Label(new Vector3(gener.radius + handleSizer, -y / 4, 0), "rad=" + System.Math.Round(gener.radius, 2), labelStyle);


            // RADIUS HANDLE
            pos = new Vector3(gener.radius, 0, 0);
            EditorGUI.BeginChangeCheck();
            pos = Handles.FreeMoveHandle(
                pos,
                Quaternion.identity,
                .15f * HandleUtility.GetHandleSize(pos),
                Vector3.zero,
                (controlID, positione, rotation, size) =>
            {
                if (GUIUtility.hotControl > 0 && controlID == GUIUtility.hotControl)
                {
                    ArchimatixEngine.mouseDownOnSceneViewHandle();
                }
                Handles.SphereCap(controlID, positione, rotation, size);
            });


            if (EditorGUI.EndChangeCheck())
            {
                Undo.RegisterCompleteObjectUndo(parametricObject.model, "Radius");
                //.parametricObject.setAltered();
                gener.P_Radius.initiateRipple_setFloatValueFromGUIChange(pos.x);
                gener.radius = pos.x;

                gener.parametricObject.model.isAltered(23);
                for (int i = 0; i < generator.P_Output.Dependents.Count; i++)
                {
                    generator.P_Output.Dependents [i].parametricObject.generator.adjustWorldMatrices();
                }

                generator.adjustWorldMatrices();
            }



            Handles.color = new Color(1, .8f, .6f, .05f);

            Handles.DrawSolidArc(Vector3.zero,
                                 Vector3.up,
                                 Vector2.right,
                                 -gener.sweepAngle,
                                 gener.radius + .2f);



            Handles.color = lightLineColor;
            Handles.DrawLine(new Vector3(0, 0, 0), new Vector3(gener.radius, 0, 0));



            // TOTAL ANGLE SWEEP
            Handles.color = new Color(1, .5f, 0f, .3f);

            Quaternion rot = Quaternion.Euler(0, 360 - gener.sweepAngle, 0);

            EditorGUI.BeginChangeCheck();
            rot = Handles.Disc(rot, Vector3.zero, Vector3.up, gener.radius, false, 1);

            if (EditorGUI.EndChangeCheck())
            {
                Undo.RegisterCompleteObjectUndo(parametricObject.model, "RadialRepeat Total Angle");


                gener.P_SweepAngle.initiateRipple_setFloatValueFromGUIChange(360 - rot.eulerAngles.y);

                gener.parametricObject.model.isAltered(23);
                for (int i = 0; i < generator.P_Output.Dependents.Count; i++)
                {
                    generator.P_Output.Dependents [i].parametricObject.generator.adjustWorldMatrices();
                }
            }
            Handles.color = new Color(1, .5f, 0f, 1f);

            Handles.DrawWireArc(Vector3.zero, Vector3.up, Vector3.right, (-gener.sweepAngle), gener.radius);


            Handles.matrix *= Matrix4x4.TRS(Vector3.zero, Quaternion.Euler(0, 360 - gener.sweepAngle, 0), Vector3.one);



            // SEGMENT CLICKERS

            // (-)

            /*
             * Handles.color = new Color(.7f, .7f, 1, .9f);
             * pos = new Vector3(gener.radius, 0, -handleSizer*2);
             * if(Handles.Button(pos, Quaternion.Euler(0,180,0), handleSizer, handleSizer, Handles.ConeCap))
             * {
             *      Undo.RegisterCompleteObjectUndo (parametricObject.model, "Segs");
             *
             *      gener.P_Segs.intiateRipple_setIntValueFromGUIChange(gener.segs-1);
             *
             *      gener.parametricObject.model.autobuild();
             *      for (int i = 0; i < generator.P_Output.Dependents.Count; i++)
             *              generator.P_Output.Dependents [i].parametricObject.generator.adjustWorldMatrices ();
             * }
             *
             * // [+]
             * Handles.color = new Color(.7f, 1f, .7f, .9f);
             * pos = new Vector3(gener.radius, 0, handleSizer*2);
             * if(Handles.Button(pos, Quaternion.Euler(0,0,0), handleSizer, handleSizer, Handles.ConeCap))
             * {
             *      Undo.RegisterCompleteObjectUndo (parametricObject.model, "Segs");
             *
             *      gener.P_Segs.intiateRipple_setIntValueFromGUIChange(gener.segs+1);
             *
             *      gener.parametricObject.model.autobuild();
             *      for (int i = 0; i < generator.P_Output.Dependents.Count; i++)
             *              generator.P_Output.Dependents [i].parametricObject.generator.adjustWorldMatrices ();
             * }
             *
             * Handles.Label(new Vector3(gener.radius,  -y/4, -handleSizer*4), ""+(gener.segs) + " segs", labelStyle);
             */


            // ANGLESWEEP KNOB

            /*
             * Handles.color = brightOrange;
             * Handles.SphereCap(0,
             *      new Vector3(gener.radius, 0, 0),
             *      Quaternion.identity,
             *      .15f*HandleUtility.GetHandleSize(pos));
             */

            Handles.Label(new Vector3(0, -y, 0), "" + System.Math.Round(gener.snappedSweepAngle, 0) + " degs", labelStyle);



            Handles.matrix = prevHandlesMatrix;
        }
Example #12
0
        public void DemoObjectsTest()
        {
            scene.Name = "DemoObjects";
            AddBlueSphere();

            var cone = new Cone()
                       .AddModifiers(new Pigment()
            {
                Color = _Magenta
            })
                       .Translate(2, 0, 0);

            scene.Add(cone);

            var cylinder = new Cylinder()
                           .AddModifiers(new Pigment()
            {
                Color = _Cyan
            })
                           .Translate(-2, 0, 0);

            scene.Add(cylinder);

            var ovus = new Ovus()
                       .AddModifiers(new Pigment()
            {
                Color = _Yellow
            })
                       .Translate(0, 0, 2);

            scene.Add(ovus);

            var torus = new Torus()
                        .AddModifiers(new Pigment()
            {
                Color = _Green
            })
                        .Translate(0, 0, 5);

            scene.Add(torus);

            var box = new Box()
                      .AddModifiers(new Pigment()
            {
                Color = _Red
            })
                      .Translate(0, 0, -2);

            scene.Add(box);

            var plane = new Plane()
            {
                Distance = -1
            };

            plane.AddModifiers(new Pigment()
            {
                Color = _RGB(1, 0.5, 0.25)
            });
            scene.Add(plane);

            var lathe = new Lathe()
                        .Add(2, 0).Add(3, 0).Add(3, 1).Add(2, 5).Add(2, 0)
                        .AddModifiers(new Pigment()
            {
                Color = _RGB(1, 1, 0.5)
            })
                        .Scale(0.25, 0.25, 0.25)
                        .Translate(2, 0, -2);

            scene.Add(lathe);

            var sor = new SurfaceOfRevolution()
                      .Add(2, 0).Add(3, 0).Add(1, 1).Add(2, 5).Add(2, 0)
                      .AddModifiers(new Pigment()
            {
                Color = _RGB(0.5, 1, 0.5)
            })
                      .Scale(0.25, 0.25, 0.25)
                      .Translate(2, 0, 2);

            scene.Add(sor);

            var path = engine.Render(scene, options, false);
        }
Example #13
0
 internal void SetLatheImage(Lathe lathe)
 {
     ImageLathe = "/images/" + lathe.Obraz;
 }
Example #14
0
 internal void SetImages(Lathe lathe, List <List <Parameter> > lists, DaneWalka walek)
 {
     SetWalekImage(walek);
     SetLatheImage(lathe);
     SetParameterImage(lists);
 }