コード例 #1
0
        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);
        }
コード例 #2
0
        public Profile2D GetTrimmingProfile()
        {
            var lunghezzaPolygono = LunghezzaCentroLato + Radius;

            var altezzaPoly = Radius * 2;

            var centerPoint = SquareShapeHelper.GetCenterPoint(SquareShapeHelper.SquareShapeStartPoint.UpLeft,
                                                               CentroX - Radius, CentroY + Radius, lunghezzaPolygono, altezzaPoly);

            var profile = SquareShapeHelper.GetSquareProfile(centerPoint.X, centerPoint.Y, lunghezzaPolygono, altezzaPoly);

            profile.SetPlotStyle();


            return(profile);
        }
コード例 #3
0
        public List <Point2D> GetPointList()
        {
            var rslt = new List <Point2D>();

            var center = SquareShapeHelper.GetCenterPoint(StartPoint, RefPointX, RefPointY, Width, Height);

            var upRight = new Point2D(center.X - Width / 2, center.Y + Height / 2);

            if (DrillCountX > 0 && DrillCountY > 0)
            {
                var stepCountX = (DrillCountX - 1);
                var stepCountY = (DrillCountY - 1);

                if (stepCountX == 0)
                {
                    stepCountX = 1;
                }

                if (stepCountY == 0)
                {
                    stepCountY = 1;
                }

                var stepX = Width / stepCountX;

                var stepY = Height / stepCountY;

                for (int i = 0; i < DrillCountX; i++)
                {
                    for (int j = 0; j < DrillCountY; j++)
                    {
                        var p = new Point2D(upRight);

                        p.X += i * stepX;
                        p.Y += -(j * stepY);

                        rslt.Add(p);
                    }
                }
            }

            return(rslt);
        }
コード例 #4
0
 private Point2D GetCenterPoint()
 {
     return(SquareShapeHelper.GetCenterPoint(StartPoint, PuntoStartX, PuntoStartY, Larghezza, Altezza));
 }