private static RawProfile CreateDefaultData()
        {
            var profile = new RawProfile(false);

            var ini = new RawInitPoint2D(profile);

            ini.X.SetValue(true, 0);
            ini.Y.SetValue(true, 0);

            var line1 = new RawLine2D(profile);

            line1.DeltaY.SetValue(true, 10);

            var line2 = new RawLine2D(profile);

            line2.DeltaX.SetValue(true, -10);

            var line3 = new RawLine2D(profile);

            line3.Y.SetValue(true, 0);

            var line4 = new RawLine2D(profile);

            line4.X.SetValue(true, 0);


            profile.Add(ini);
            profile.Add(line1);
            profile.Add(line2);
            profile.Add(line3);
            profile.Add(line4);

            return(profile);
        }
        public Profile2D GetClosedProfile()
        {
            var p = new RawProfile(false);

            var centerPoint = SquareShapeHelper.GetCenterPoint(StartPoint, PuntoStartX, PuntoStartY, Larghezza, Altezza);


            var ini = new RawInitPoint2D(p);

            ini.X.SetValue(true, centerPoint.X + Larghezza / 2);
            ini.Y.SetValue(true, centerPoint.Y + Altezza / 2);
            p.Add(ini);

            var p1 = new RawLine2D(p);

            p1.X.SetValue(true, centerPoint.X + Larghezza / 2);
            p1.Y.SetValue(true, centerPoint.Y - Altezza / 2);
            p.Add(p1);

            var p2 = new RawLine2D(p);

            p2.X.SetValue(true, centerPoint.X - Larghezza / 2);
            p2.Y.SetValue(true, centerPoint.Y - Altezza / 2);
            p.Add(p2);

            var p3 = new RawLine2D(p);

            p3.X.SetValue(true, centerPoint.X - Larghezza / 2);
            p3.Y.SetValue(true, centerPoint.Y + Altezza / 2);
            p.Add(p3);

            var p4 = new RawLine2D(p);

            p4.X.SetValue(true, centerPoint.X + Larghezza / 2);
            p4.Y.SetValue(true, centerPoint.Y + Altezza / 2);
            p.Add(p4);

            if (Chamfer > 0 && ChamferAbilited)
            {
                p1.Chamfer.SetValue(true, Chamfer);
                p2.Chamfer.SetValue(true, Chamfer);
                p3.Chamfer.SetValue(true, Chamfer);
                p4.Chamfer.SetValue(true, Chamfer);
            }
            else if (Chamfer > 0 && !ChamferAbilited)
            {
                p1.EndRadius.SetValue(true, Chamfer);
                p2.EndRadius.SetValue(true, Chamfer);
                p3.EndRadius.SetValue(true, Chamfer);
                p4.EndRadius.SetValue(true, Chamfer);
            }

            var rslt = p.GetProfileResult(true);

            rslt.SetPlotStyle();

            return(rslt);
        }
Example #3
0
        private void AddDummyProfile(TipoTornitura tipoTornitura)
        {
            switch (tipoTornitura)
            {
            case TipoTornitura.Esterna:
            {
                var profile = new RawProfile(true);

                var ini = new RawInitPoint2D(profile);
                ini.X.SetValue(true, 0);
                ini.Y.SetValue(true, 25);

                var line1 = new RawLine2D(profile);
                line1.DeltaX.SetValue(true, -10);

                var line2 = new RawLine2D(profile);
                line2.DeltaY.SetValue(true, 10);
                line2.DeltaX.SetValue(true, -10);

                var line3 = new RawLine2D(profile);
                line3.DeltaY.SetValue(true, 10);

                profile.Add(ini);
                profile.Add(line1);
                profile.Add(line2);
                profile.Add(line3);

                Profile = profile;
            } break;

            case TipoTornitura.Interna:
            {
                var profile = new RawProfile(true);

                var ini = new RawInitPoint2D(profile);
                ini.X.SetValue(true, 0);
                ini.Y.SetValue(true, 70);

                var line1 = new RawLine2D(profile);
                line1.DeltaX.SetValue(true, -10);

                var line2 = new RawLine2D(profile);
                line2.DeltaY.SetValue(true, -10);
                line2.DeltaX.SetValue(true, -10);

                var line3 = new RawLine2D(profile);
                line3.DeltaY.SetValue(true, -10);

                profile.Add(ini);
                profile.Add(line1);
                profile.Add(line2);
                profile.Add(line3);

                Profile = profile;
            } break;
            }
        }
        /*
         * la gestione del axisLabel può essere raggruppata in classe abstract
         */
        public RawInitPointViewModel(RawInitPoint2D rawPoint2D, ProfileEditorViewModel.AxisSystem axisSystem, ProfileEditorViewModel parent)
            : base(rawPoint2D, axisSystem, parent)
        {
            _rawPoint2D = rawPoint2D;

            X = new RawInputViewModel(_rawPoint2D.X);
            Y = new RawInputViewModel(_rawPoint2D.Y);

            X.OnSourceUpdated += RawLine_SourceUpdated;
            Y.OnSourceUpdated += RawLine_SourceUpdated;
        }
Example #5
0
        static DummyProfileEditorViewModel()
        {
            MoveListViewModels = new List <RawEntity2D>();

            var profileSolver = new RawProfile(false);

            var ini = new RawInitPoint2D(profileSolver);

            ini.X.SetValue(true, 0);
            ini.Y.SetValue(true, 0);

            var line1 = new RawLine2D(profileSolver);

            line1.DeltaY.SetValue(true, 10);

            var line2 = new RawLine2D(profileSolver);

            line2.DeltaX.SetValue(true, -10);

            MoveListViewModels.Add(ini);
            MoveListViewModels.Add(line1);
            MoveListViewModels.Add(line2);

            SelectedMove = MoveListViewModels.LastOrDefault();

            // se cambio SelectedMove aggiorno currentMove
            CurrentMovement = new RawLineViewModel(line2, ProfileEditorViewModel.AxisSystem.Xy);


            //foreach (var rawEntity2D in MoveListViewModels)
            //    profileSolver.Add(rawEntity2D);

            //var profileSolved = profileSolver.GetProfileResult();

            //var listEntity = new List<IEntity2D>();

            //foreach (var entity2D in profileSolved.Source)
            //    listEntity.Add(entity2D);

            //Preview = new ObservableCollection<IEntity2D>(listEntity);
        }
Example #6
0
        public Tornitura(TipoTornitura tipoTornitura)
            : base()
        {
            _tipoTornitura = tipoTornitura;

            Profile = new RawProfile(true);

            /*
             * per evitare danni inserisco punto iniziale qui,
             * anche se e meglio che venga creato dentro ctorù             */

            var ini = new RawInitPoint2D(Profile);

            Profile.Add(ini);
            ini.X.SetValue(true, 0);


            // AddDummyProfile(_tipoTornitura);

            Sgrossatura = new Operazione(this, LavorazioniEnumOperazioni.TornituraSgrossatura);

            Finitura = new Operazione(this, LavorazioniEnumOperazioni.TornituraFinitura);
        }
Example #7
0
        public Profile2D GetClosedProfile()
        {
            var raggio = Circoscritto ? Radius : GeometryHelper.GetRaggioCircoscritto(Radius, SideNumber);

            var pntList = GeometryHelper.CalculatePoygonInscribed(SideNumber, new Point2D(CentroX, CentroY), raggio);

            var p = new RawProfile(false);


            var iniPoint2D = new Point2D();

            for (int i = 0; i < pntList.Count; i++)
            {
                var point = pntList[i];

                // Initial point
                if (i == 0)
                {
                    iniPoint2D = point;

                    var ini = new RawInitPoint2D(p);
                    ini.X.SetValue(true, iniPoint2D.X + CentroX);
                    ini.Y.SetValue(true, iniPoint2D.Y + CentroY);
                    p.Add(ini);
                    continue;
                }

                var p1 = new RawLine2D(p);
                p1.X.SetValue(true, point.X + CentroX);
                p1.Y.SetValue(true, point.Y + CentroY);
                p.Add(p1);

                if (Chamfer > 0 && ChamferAbilited)
                {
                    p1.Chamfer.SetValue(true, Chamfer);
                }
                else if (Chamfer > 0 && !ChamferAbilited)
                {
                    p1.EndRadius.SetValue(true, Chamfer);
                }
            }

            var end = new RawLine2D(p);

            end.X.SetValue(true, iniPoint2D.X + CentroX);
            end.Y.SetValue(true, iniPoint2D.Y + CentroY);
            p.Add(end);

            if (Chamfer > 0 && ChamferAbilited)
            {
                end.Chamfer.SetValue(true, Chamfer);
            }
            else if (Chamfer > 0 && !ChamferAbilited)
            {
                end.EndRadius.SetValue(true, Chamfer);
            }

            var rslt = p.GetProfileResult(true);

            rslt.SetPlotStyle();

            return(rslt);
        }
Example #8
0
        /// <summary>
        /// Crea profilo per gola a V Esterna
        /// Comprensivo di smussi.
        /// </summary>
        /// <returns></returns>
        protected override Profile2D CalculateProfile()
        {
            var rawProfile = new RawProfile(false);
            var ini        = new RawInitPoint2D(rawProfile);

            ini.X.SetValue(true, CenterZ + LunghezzaEst / 2 + ExternChamferValue);
            ini.Y.SetValue(true, DiametroExt);
            rawProfile.Add(ini);

            var p1 = new RawLine2D(rawProfile);

            p1.X.SetValue(true, CenterZ + LunghezzaEst / 2);
            rawProfile.Add(p1);

            if (ExternChamferValue > 0 && ChamferExternAbilited)
            {
                p1.Chamfer.SetValue(true, ExternChamferValue);
            }
            else if (ExternChamferValue > 0 && !ChamferExternAbilited)
            {
                p1.EndRadius.SetValue(true, ExternChamferValue);
            }

            var p2 = new RawLine2D(rawProfile);

            p2.X.SetValue(true, CenterZ + LunghezzaInt / 2);
            p2.Y.SetValue(true, DiametroMin);
            rawProfile.Add(p2);

            if (InternChamferValue > 0 && ChamferInternAbilited)
            {
                p2.Chamfer.SetValue(true, ExternChamferValue);
            }
            else if (InternChamferValue > 0 && !ChamferInternAbilited)
            {
                p2.EndRadius.SetValue(true, ExternChamferValue);
            }

            // P4
            var p4 = new RawLine2D(rawProfile);

            p4.X.SetValue(true, CenterZ - LunghezzaInt / 2);
            rawProfile.Add(p2);

            if (InternChamferValue > 0 && ChamferInternAbilited)
            {
                p4.Chamfer.SetValue(true, ExternChamferValue);
            }
            else if (InternChamferValue > 0 && !ChamferInternAbilited)
            {
                p4.EndRadius.SetValue(true, ExternChamferValue);
            }

            // P5
            var p5 = new RawLine2D(rawProfile);

            p5.X.SetValue(true, CenterZ - LunghezzaEst / 2);
            rawProfile.Add(p5);

            if (ExternChamferValue > 0 && ChamferExternAbilited)
            {
                p5.Chamfer.SetValue(true, ExternChamferValue);
            }
            else if (ExternChamferValue > 0 && !ChamferExternAbilited)
            {
                p5.EndRadius.SetValue(true, ExternChamferValue);
            }

            // P6 - Last Point
            var p6 = new RawLine2D(rawProfile);

            p6.X.SetValue(true, CenterZ - LunghezzaEst / 2 - ExternChamferValue);
            rawProfile.Add(p6);

            var rslt = rawProfile.GetProfileResult(true);

            rslt.SetPlotStyle();

            return(rslt);
        }
        /*
         * Magari aggiungere inclinazione
         */

        public Profile2D GetClosedProfile()
        {
            /*
             * Come coordinate 0 prendo centro raggio.
             *
             * Allora primo sono sulla faccia esterna del pezzo
             *
             * poi scendo ( faccio smusso raccordo se esiste )
             *
             * vado a fare raccordo
             *
             * esco sulla faccia del pezzo
             *
             * poi aggirando tutto il profilo chiudo
             *
             * in modo da creare profilo esterno da trimmare.
             */
            var rawProfile = new RawProfile(false);

            if (Radius <= 0 || LunghezzaCentroLato <= 0)
            {
                return(new Profile2D());
            }

            /* Punto iniziale*/
            var initPoint2D = new RawInitPoint2D(rawProfile);

            initPoint2D.X.SetValue(true, CentroX + LunghezzaCentroLato);
            initPoint2D.Y.SetValue(true, CentroY + Radius + ChamferValue * 1.2 + 1);
            initPoint2D.PlotStyle = EnumPlotStyle.Element;


            /*Punto 1*/
            var line1 = new RawLine2D(rawProfile);

            line1.Y.SetValue(true, CentroY + Radius);
            line1.PlotStyle = EnumPlotStyle.Element;
            if (ChamferValue > 0)
            {
                line1.Chamfer.SetValue(true, ChamferValue);
            }

            /*Inizio Arco*/
            var line2 = new RawLine2D(rawProfile);

            line2.PlotStyle = EnumPlotStyle.Element;
            line2.X.SetValue(true, CentroX);

            /*Arco*/
            var arc = new RawArc2D(rawProfile);

            arc.PlotStyle = EnumPlotStyle.Element;

            arc.Radius.SetValue(true, Radius);
            arc.IsClockwise = false;
            arc.Y.SetValue(true, CentroY - Radius);
            arc.CenterX.SetValue(true, CentroX);
            arc.CenterY.SetValue(true, CentroY);

            /*Faccia pezzo*/
            var line3 = new RawLine2D(rawProfile);

            line3.PlotStyle = EnumPlotStyle.Element;
            line3.X.SetValue(true, CentroX + LunghezzaCentroLato);
            if (ChamferValue > 0)
            {
                line3.Chamfer.SetValue(true, ChamferValue);
            }

            /*Scendo pezzo*/
            var line4 = new RawLine2D(rawProfile);

            line4.PlotStyle = EnumPlotStyle.Element;
            line4.Y.SetValue(true, CentroY - Radius - ChamferValue * 1.2 - 1);

            /* Aggiro in 3 linee*/
            var line5 = new RawLine2D(rawProfile);

            line5.PlotStyle = EnumPlotStyle.Invisible;
            line5.X.SetValue(true, CentroX - Radius * 2);

            var line6 = new RawLine2D(rawProfile);

            line6.PlotStyle = EnumPlotStyle.Invisible;
            line6.Y.SetValue(true, initPoint2D.Y.Value);

            var line7 = new RawLine2D(rawProfile);

            line7.PlotStyle = EnumPlotStyle.Invisible;
            line7.X.SetValue(true, initPoint2D.X.Value);

            rawProfile.Add(initPoint2D);
            rawProfile.Add(line1);
            rawProfile.Add(line2);
            rawProfile.Add(arc);
            rawProfile.Add(line3);
            rawProfile.Add(line4);
            rawProfile.Add(line5);
            rawProfile.Add(line6);
            rawProfile.Add(line7);

            var profile = rawProfile.GetProfileResult(true);

            return(profile);
        }