Ejemplo n.º 1
0
        public override void ToMachining(double AssociatedDist, Entities.ToolFile toolFile)
        {
            List <Point3d> points = new List <Point3d>()
            {
                new Point3d(lowX / 2 + highX / 2, lowY / 2 + highY / 2, Depth),
                new Point3d(lowX, lowY / 2 + highY / 2, Depth),
                new Point3d(lowX, highY, Depth),
                new Point3d(highX, highY, Depth),
                new Point3d(highX, lowY, Depth),
                new Point3d(lowX, lowY, Depth),
                new Point3d(lowX, lowY + highY / 4 - lowY / 4, Depth),
            };
            List <double> bulges = new List <double>()
            {
                0, 0, 0, 0, 0, 0, 0
            };

            Machinings.Routing route = new Machinings.Routing();
            route.Bulges   = bulges;
            route.Points   = points;
            route.ToolComp = ToolComp.Left;
            route.Part     = this.Part;
            route.OnFace5  = this.OnFace5;
            route.ToolName = this.ToolName;

            Part.Routings.Add(route);

            //TODO:不知道刀的大小,如何生成Pocket的路径?
            //可能需要在分析时再来生成路径,晕死
            if (IsPocket)
            {
                PocketMachining(toolFile);
            }
        }
Ejemplo n.º 2
0
        private void PocketMachining(Entities.ToolFile toolFile)
        {
            List <Point3d> points = new List <Point3d>();
            List <double>  bulges = new List <double>();

            double diameter = toolFile.GetRouteToolByName(this.ToolName).Diameter;
            int    row      = (int)System.Math.Ceiling(System.Math.Abs(StartX - EndX) / diameter) - 1;

            double mod = System.Math.Abs(StartX - EndX) % diameter;

            for (int i = 0; i < row; i++)
            {
                if (i != row - 1)
                {
                    AddLineToPocket(points, bulges, diameter, i);
                }
                else
                {
                    if (mod == 0)//如果是整数行
                    {
                        AddLineToPocket(points, bulges, diameter, i);
                    }
                    else
                    {
                        if (i % 2 == 0)//整除2,表明为基数列
                        {
                            points.Add(new Point3d(lowX + diameter * (i - 1) + diameter * mod / diameter, lowY + diameter, Depth));
                            points.Add(new Point3d(lowX + diameter * (i - 1) + diameter * mod / diameter, highY - diameter, Depth));
                            bulges.Add(0);
                            bulges.Add(0);
                        }
                        else
                        {
                            points.Add(new Point3d(lowX + diameter * (i - 1) + diameter * mod / diameter, highY - diameter, Depth));
                            points.Add(new Point3d(lowX + diameter * (i - 1) + diameter * mod / diameter, lowY + diameter, Depth));
                            bulges.Add(0);
                            bulges.Add(0);
                        }
                    }
                }
            }

            Machinings.Routing route = new Machinings.Routing();
            route.Bulges   = bulges;
            route.Points   = points;
            route.ToolComp = ToolComp.Left;
            route.Part     = this.Part;
            route.OnFace5  = this.OnFace5;
            route.ToolName = this.ToolName;

            Part.Routings.Add(route);
        }
Ejemplo n.º 3
0
        public override void ToMachining(double associateDist, Entities.ToolFile toolFile)
        {
            FindAssociatedFaces(associateDist);

            PartFace pf = this.Part.GetPartFaceByNumber(FaceNumber);

            if (pf.AssociatedPartFaces.Count != 0)//数量不为0,说明有关联的板件
            {
                List <HDrilling> TempHDrills = new List <HDrilling>();

                foreach (double d in this.PointsPosition)
                {
                    HDrilling hdrill = new HDrilling(this.FaceNumber, this.EdgeBoreDiameter, this.EdgeBoreDepth, d, this.ZValue, Part);
                    TempHDrills.Add(hdrill);
                }

                foreach (StructXY xy in this.ListCamVBoreXY)
                {
                    VDrilling vdrill = new VDrilling(this.CamFaceNumber, xy.X, xy.Y, this.CamFaceBoreDiameter, this.CamFaceBoreDepth, Part);
                    Part.VDrillings.Add(vdrill);
                }

                foreach (PartFace f in pf.AssociatedPartFaces)
                {
                    if (!f.IsHorizontalFace)//如果关联的面是面5或面6
                    {
                        foreach (HDrilling hdrill in TempHDrills)
                        {
                            Point3d holeposition = hdrill.GetBorePosition();
                            holeposition = holeposition.TransformBy(Matrix3d.AlignCoordinateSystem(new Point3d(), Vector3d.XAxis, Vector3d.YAxis, Vector3d.ZAxis, hdrill.Part.MPPoint, hdrill.Part.MPXAxis, hdrill.Part.MPYAxis, hdrill.Part.MPZAxis));
                            holeposition = Math.MathHelper.GetRotatedAndMovedPoint(holeposition, Part.TXRotation, Part.TYRotation, Part.TZRotation, Part.CenterVector);
                            holeposition = holeposition.TransformBy(Matrix3d.AlignCoordinateSystem(f.Part.MovedMPPoint, f.Part.MovedMPXAxis, f.Part.MovedMPYAxis, f.Part.MovedMPZAxis, new Point3d(), Vector3d.XAxis, Vector3d.YAxis, Vector3d.ZAxis));
                            double dimx = holeposition.X;
                            double dimy = holeposition.Y;

                            VDrilling vdrill = new VDrilling(f.FaceNumber, dimx, dimy, this.FaceBoreDiameter, this.FaceBoreDepth, f.Part);
                            f.Part.VDrillings.Add(vdrill);
                        }
                    }
                    else//TODO:如果关联的面是水平面
                    {
                    }
                }

                if (this.EdgeBoreDiameter > 0 && this.EdgeBoreDepth > 0)
                {
                    Part.HDrillings.AddRange(TempHDrills);
                }
            }
        }
Ejemplo n.º 4
0
        public override void ToMachining(double AssociatedDist, Entities.ToolFile toolFile)
        {
            Point3d        pt1    = new Point3d(PosStartX, PosStartY, StartDepth);
            Point3d        pt2    = new Point3d(PosEndX, PosEndY, EndDepth);
            List <Point3d> points = new List <Point3d>()
            {
                pt1, pt2
            };
            List <double> bulges = new List <double>()
            {
                0, 0
            };

            Machinings.Routing route = new Machinings.Routing();
            route.Bulges   = bulges;
            route.Points   = points;
            route.ToolComp = this.ToolComp;
            route.Part     = this.Part;
            route.OnFace5  = (this.FaceNumber == 5) ? true : false;
            route.ToolName = this.ToolName;

            Part.Routings.Add(route);
        }
Ejemplo n.º 5
0
        public override void ToMachining(double AssociatedDist, Entities.ToolFile toolFile)
        {
            int    number = 1;
            double dist   = System.Math.Sqrt(
                System.Math.Abs(PosStartX - PosEndX) * System.Math.Abs(PosStartX - PosEndX) +
                System.Math.Abs(PosStartY - PosEndY) * System.Math.Abs(PosStartY - PosEndY)
                );

            if (HoleGap < 1)//避免太小的间距
            {
                HoleGap = 1;
            }

            number = (int)System.Math.Floor(dist / HoleGap) + 1;
            double xfactor = (PosStartX > PosEndX) ? -1 : 1;
            double yfactor = (PosStartY > PosEndY) ? -1 : 1;
            double cos     = (dist != 0) ? System.Math.Abs(PosStartX - PosEndX) / dist : 0;
            double sin     = (dist != 0) ? System.Math.Abs(PosStartY - PosEndY) / dist : 0;

            //如果是水平孔
            if (IsHorizontalDrill)
            {
                if (FaceNumber == 3)
                {
                    for (int i = 0; i < number; i++)
                    {
                        Machinings.HDrilling hdrill = new Machinings.HDrilling(
                            FaceNumber,
                            Diameter,
                            PosStartX,
                            PosStartY + dist / number * i * yfactor * sin,
                            PosStartZ,
                            Part);
                        Part.HDrillings.Add(hdrill);
                    }
                }
                else if (FaceNumber == 4)
                {
                    for (int i = 0; i < number; i++)
                    {
                        double depth = (Part.MachinePoint.IsRotated) ? Part.Width - PosStartX : Part.Length - PosStartX;
                        if (depth < 0)
                        {
                            throw new Exception("指令的深度不能为小于0的数值");
                        }

                        Machinings.HDrilling hdrill = new Machinings.HDrilling(
                            FaceNumber,
                            Diameter,
                            depth,
                            PosStartY + dist / number * i * yfactor * sin,
                            PosStartZ,
                            Part);
                        Part.HDrillings.Add(hdrill);
                    }
                }
                else if (FaceNumber == 1)
                {
                    for (int i = 0; i < number; i++)
                    {
                        Machinings.HDrilling hdrill = new Machinings.HDrilling(
                            FaceNumber,
                            Diameter,
                            PosStartY,
                            PosStartX + dist / number * i * xfactor * cos,
                            PosStartZ,
                            Part);
                        Part.HDrillings.Add(hdrill);
                    }
                }
                else if (FaceNumber == 2)
                {
                    for (int i = 0; i < number; i++)
                    {
                        double depth = (Part.MachinePoint.IsRotated) ? Part.Length - PosStartY : Part.Width - PosStartY;
                        Machinings.HDrilling hdrill = new Machinings.HDrilling(
                            FaceNumber,
                            Diameter,
                            depth,
                            PosStartX + dist / number * i * xfactor * cos,
                            PosStartZ,
                            Part);
                        Part.HDrillings.Add(hdrill);
                    }
                }
                else
                {
                    throw new Exception("未知的Facenumber:" + FaceNumber);
                }
            }
            else//如果是面孔
            {
                if (IsLineHoles)
                {
                    for (int i = 0; i < number; i++)
                    {
                        Machinings.VDrilling vdrill = new Machinings.VDrilling(
                            FaceNumber,
                            PosStartX + dist / number * i * xfactor * cos,
                            PosStartY + dist / number * i * yfactor * sin,
                            Diameter,
                            PosStartZ,
                            Part);

                        Part.VDrillings.Add(vdrill);
                    }
                }

                Part.VDrillings.Add(new Machinings.VDrilling(this.FaceNumber, PosStartX, PosStartY, Diameter, PosStartZ, Part));
            }
        }
Ejemplo n.º 6
0
        public override void ToMachining(double AssociatedDist, Entities.ToolFile toolFile)
        {
            //指令根据板件的1-4个边进行定位
            //需要根据面的方位来生成加工的位置
            //幸运的是,不需要经过太多的坐标转换

            List <Point3d> Points = new List <Point3d>();
            ToolComp       comp   = ToolComp.None;

            if (EdgeNumber == 1)
            {
                Point3d firstPt  = new Point3d(StartX, -LeadIn, Depth);
                Point3d secondPt = new Point3d(StartX, StartY, Depth);
                Point3d thirdPt  = new Point3d(EndX, EndY, Depth);
                Point3d forthPt  = new Point3d(EndX, -LeadIn, Depth);
                Points.Add(firstPt);
                Points.Add(secondPt);
                Points.Add(thirdPt);
                Points.Add(forthPt);

                comp = ToolComp.Left;

                Machinings.Routing route = new Machinings.Routing();
                route.ToolName = ToolName;
                route.Points   = Points;
                route.Part     = Part;
                route.ToolComp = comp;
                route.Bulges   = (new double[] { 0, 0, 0, 0 }).ToList();
                if (FaceNumber == 5)
                {
                    route.OnFace5 = true;
                }
                else
                {
                    route.OnFace5 = false;
                }

                Part.Routings.Add(route);
            }
            else if (EdgeNumber == 2)
            {
                //double pl = (Part.MachinePoint.IsRotated) ? Part.Width : Part.Length;
                double  pw       = (!Part.MachinePoint.IsRotated) ? Part.Width : Part.Length;
                Point3d firstPt  = new Point3d(StartX, pw + LeadIn, Depth);
                Point3d secondPt = new Point3d(StartX, pw - StartY, Depth);
                Point3d thirdPt  = new Point3d(EndX, pw - EndY, Depth);
                Point3d forthPt  = new Point3d(EndX, pw + LeadIn, Depth);
                Points.Add(firstPt);
                Points.Add(secondPt);
                Points.Add(thirdPt);
                Points.Add(forthPt);

                comp = ToolComp.Right;

                Machinings.Routing route = new Machinings.Routing();
                route.ToolName = ToolName;
                route.Points   = Points;
                route.Part     = Part;
                route.ToolComp = comp;
                route.Bulges   = (new double[] { 0, 0, 0, 0 }).ToList();
                if (FaceNumber == 5)
                {
                    route.OnFace5 = true;
                }
                else
                {
                    route.OnFace5 = false;
                }

                Part.Routings.Add(route);
            }
            else if (EdgeNumber == 3)
            {
                //double pl = (Part.MachinePoint.IsRotated) ? Part.Width : Part.Length;
                //double pw = (!Part.MachinePoint.IsRotated) ? Part.Width : Part.Length;
                Point3d firstPt  = new Point3d(-LeadIn, StartY, Depth);
                Point3d secondPt = new Point3d(StartX, StartY, Depth);
                Point3d thirdPt  = new Point3d(EndX, EndY, Depth);
                Point3d forthPt  = new Point3d(-LeadIn, EndY, Depth);
                Points.Add(firstPt);
                Points.Add(secondPt);
                Points.Add(thirdPt);
                Points.Add(forthPt);

                comp = ToolComp.Right;

                Machinings.Routing route = new Machinings.Routing();
                route.ToolName = ToolName;
                route.Points   = Points;
                route.Part     = Part;
                route.ToolComp = comp;
                route.Bulges   = (new double[] { 0, 0, 0, 0 }).ToList();
                if (FaceNumber == 5)
                {
                    route.OnFace5 = true;
                }
                else
                {
                    route.OnFace5 = false;
                }

                Part.Routings.Add(route);
            }
            else if (EdgeNumber == 4)
            {
                double pl = (Part.MachinePoint.IsRotated) ? Part.Width : Part.Length;
                //double pw = (!Part.MachinePoint.IsRotated) ? Part.Width : Part.Length;
                Point3d firstPt  = new Point3d(pl + LeadIn, StartY, Depth);
                Point3d secondPt = new Point3d(pl - StartX, StartY, Depth);
                Point3d thirdPt  = new Point3d(pl - EndX, EndY, Depth);
                Point3d forthPt  = new Point3d(pl + LeadIn, EndY, Depth);
                Points.Add(firstPt);
                Points.Add(secondPt);
                Points.Add(thirdPt);
                Points.Add(forthPt);

                comp = ToolComp.Left;

                Machinings.Routing route = new Machinings.Routing();
                route.ToolName = ToolName;
                route.Points   = Points;
                route.Part     = Part;
                route.ToolComp = comp;
                route.Bulges   = (new double[] { 0, 0, 0, 0 }).ToList();
                if (FaceNumber == 5)
                {
                    route.OnFace5 = true;
                }
                else
                {
                    route.OnFace5 = false;
                }

                Part.Routings.Add(route);
            }
        }
Ejemplo n.º 7
0
        public override void ToMachining(double AssociatedDist, Entities.ToolFile toolFile)
        {
            //先以当前点为坐标系,建立两点坐标
            double  xydist   = System.Math.Sqrt(DistX * DistX + DistY * DistY);
            double  cos      = DistX / xydist;
            double  sin      = DistY / xydist;
            Point3d firstPt  = new Point3d(DistX + LeadIn * cos, -LeadIn * sin, Depth);
            Point3d secondPt = new Point3d(-LeadIn * cos, DistY + LeadIn * sin, Depth);

            //把两点坐标,转换为世界坐标,再转为MP坐标系
            Point3d  pt      = Part.GetPartPointByNumber(EdgeNumber.ToString());
            Matrix3d matrix1 = Matrix3d.AlignCoordinateSystem(
                Point3d.Origin,
                Vector3d.XAxis,
                Vector3d.YAxis,
                Vector3d.ZAxis,
                pt,
                (Part.MachinePoint.IsRotated) ? this.GetPointYAxis(EdgeNumber) : this.GetPointXAxis(EdgeNumber),
                (Part.MachinePoint.IsRotated) ? this.GetPointXAxis(EdgeNumber) : this.GetPointYAxis(EdgeNumber),
                Vector3d.ZAxis);
            Matrix3d matrix2 = Matrix3d.AlignCoordinateSystem(
                Part.MPPoint,
                Part.MPXAxis,
                Part.MPYAxis,
                Part.MPZAxis,
                Point3d.Origin,
                Vector3d.XAxis,
                Vector3d.YAxis,
                Vector3d.ZAxis);

            firstPt  = firstPt.TransformBy(matrix1).TransformBy(matrix2);
            secondPt = secondPt.TransformBy(matrix1).TransformBy(matrix2);

            ToolComp comp = ToolComp.None;

            if (firstPt.X >= secondPt.X && firstPt.Y >= secondPt.Y)
            {
                comp = ToolComp.Left;
            }
            else if (firstPt.X >= secondPt.X && firstPt.Y < secondPt.Y)
            {
                comp = ToolComp.Right;
            }
            else if (firstPt.X < secondPt.X && firstPt.Y < secondPt.Y)
            {
                comp = ToolComp.Left;
            }
            else if (firstPt.X < secondPt.X && firstPt.Y >= secondPt.Y)
            {
                comp = ToolComp.Right;
            }

            List <Point3d> points = new List <Point3d>()
            {
                firstPt, secondPt
            };

            Machinings.Routing route = new Machinings.Routing();
            route.ToolName = ToolName;
            route.Points   = points;
            route.Part     = Part;
            route.ToolComp = comp;
            route.Bulges   = (new double[] { 0, 0 }).ToList();
            if (FaceNumber == 5)
            {
                route.OnFace5 = true;
            }
            else
            {
                route.OnFace5 = false;
            }

            Part.Routings.Add(route);
        }
Ejemplo n.º 8
0
        public override void ToMachining(double AssociatedDist, Entities.ToolFile toolFile)
        {
            //由于这个指令是指定了板件的1-8个点进行定位的,所以要把空间的绝对坐标换算回机加工原点的相对坐标
            //matrix1负责把所在点的坐标转换为板件中心的坐标
            //matrix2负责把板件中心的坐标,再转换为MP中心的坐标
            Point3d  pt      = Part.GetPartPointByNumber(EdgeNumber.ToString());
            Matrix3d matrix1 = Matrix3d.AlignCoordinateSystem(
                Point3d.Origin,
                Vector3d.XAxis,
                Vector3d.YAxis,
                Vector3d.ZAxis,
                pt,
                (Part.MachinePoint.IsRotated) ? this.GetPointYAxis(EdgeNumber) : this.GetPointXAxis(EdgeNumber),
                (Part.MachinePoint.IsRotated) ? this.GetPointXAxis(EdgeNumber) : this.GetPointYAxis(EdgeNumber),
                Vector3d.ZAxis);
            Matrix3d matrix2 = Matrix3d.AlignCoordinateSystem(
                Part.MPPoint,
                Part.MPXAxis,
                Part.MPYAxis,
                Part.MPZAxis,
                Point3d.Origin,
                Vector3d.XAxis,
                Vector3d.YAxis,
                Vector3d.ZAxis);

            //板件如果旋转,则生成的坐标点是不一样的
            List <Point3d> Points   = new List <Point3d>();
            Point3d        firstPt  = new Point3d(XDist, -LeadIn, Depth);
            Point3d        secondPt = new Point3d(XDist, YDist, Depth);
            Point3d        thirdPt  = new Point3d(-LeadIn, YDist, Depth);

            firstPt  = firstPt.TransformBy(matrix1).TransformBy(matrix2);
            secondPt = secondPt.TransformBy(matrix1).TransformBy(matrix2);
            thirdPt  = thirdPt.TransformBy(matrix1).TransformBy(matrix2);
            Points.Add(new Point3d(firstPt.X, firstPt.Y, Depth));
            Points.Add(new Point3d(secondPt.X, secondPt.Y, Depth));
            Points.Add(new Point3d(thirdPt.X, thirdPt.Y, Depth));

            //判断刀补的方向
            ToolComp comp = ToolComp.None;

            if (firstPt.X >= thirdPt.X && firstPt.Y >= thirdPt.Y)
            {
                comp = ToolComp.Left;
            }
            else if (firstPt.X >= thirdPt.X && firstPt.Y < thirdPt.Y)
            {
                comp = ToolComp.Right;
            }
            else if (firstPt.X < thirdPt.X && firstPt.Y < thirdPt.Y)
            {
                comp = ToolComp.Left;
            }
            else if (firstPt.X < thirdPt.X && firstPt.Y >= thirdPt.Y)
            {
                comp = ToolComp.Right;
            }

            Machinings.Routing route = new Machinings.Routing();
            route.ToolName = ToolName;
            route.Points   = Points;
            route.Part     = Part;
            route.ToolComp = comp;
            route.Bulges   = (new double[] { 0, 0, 0 }).ToList();
            if (FaceNumber == 5)
            {
                route.OnFace5 = true;
            }
            else
            {
                route.OnFace5 = false;
            }

            Part.Routings.Add(route);
        }
Ejemplo n.º 9
0
        public override void ToMachining(double AssociatedDist, Entities.ToolFile toolFile)
        {
            //由于这个指令是指定了板件的1-8个点进行定位的,所以要把空间的绝对坐标换算回机加工原点的相对坐标
            //matrix1负责把所在点的坐标转换为板件中心的坐标
            //matrix2负责把板件中心的坐标,再转换为MP中心的坐标
            Point3d  pt      = Part.GetPartPointByNumber(EdgeNumber.ToString());
            Matrix3d matrix1 = Matrix3d.AlignCoordinateSystem(
                Point3d.Origin,
                Vector3d.XAxis,
                Vector3d.YAxis,
                Vector3d.ZAxis,
                pt,
                (Part.MachinePoint.IsRotated) ? this.GetPointYAxis(EdgeNumber) : this.GetPointXAxis(EdgeNumber),
                (Part.MachinePoint.IsRotated) ? this.GetPointXAxis(EdgeNumber) : this.GetPointYAxis(EdgeNumber),
                Vector3d.ZAxis);
            Matrix3d matrix2 = Matrix3d.AlignCoordinateSystem(
                Part.MPPoint,
                Part.MPXAxis,
                Part.MPYAxis,
                Part.MPZAxis,
                Point3d.Origin,
                Vector3d.XAxis,
                Vector3d.YAxis,
                Vector3d.ZAxis);

            if (LeadIn > 0)
            {
                double  rRadius  = LeadIn;
                Point3d firstPt  = new Point3d(Radius + rRadius, -rRadius, Depth);
                Point3d secondPt = new Point3d(Radius, 0, Depth);
                Point3d thirdPt  = new Point3d(0, Radius, Depth);
                Point3d forthPt  = new Point3d(-rRadius, Radius + rRadius, Depth);

                firstPt  = firstPt.TransformBy(matrix1).TransformBy(matrix2);
                secondPt = secondPt.TransformBy(matrix1).TransformBy(matrix2);
                thirdPt  = thirdPt.TransformBy(matrix1).TransformBy(matrix2);
                forthPt  = forthPt.TransformBy(matrix1).TransformBy(matrix2);

                double   firstBulge = -0.414214;
                ToolComp comp       = ToolComp.None;

                if (firstPt.X >= thirdPt.X && firstPt.Y >= thirdPt.Y)
                {
                    comp        = ToolComp.Left;
                    firstBulge *= -1;
                }
                else if (firstPt.X >= thirdPt.X && firstPt.Y < thirdPt.Y)
                {
                    comp = ToolComp.Right;
                }
                else if (firstPt.X < thirdPt.X && firstPt.Y < thirdPt.Y)
                {
                    comp        = ToolComp.Left;
                    firstBulge *= -1;
                }
                else if (firstPt.X < thirdPt.X && firstPt.Y >= thirdPt.Y)
                {
                    comp = ToolComp.Right;
                }

                Machinings.Routing route = new Machinings.Routing();
                route.ToolName = ToolName;
                route.Points   = new List <Point3d>()
                {
                    firstPt, secondPt, thirdPt, forthPt
                };
                route.Part     = Part;
                route.ToolComp = comp;
                route.Bulges   = (new double[] { firstBulge, -firstBulge, firstBulge, 0 }).ToList();
                if (FaceNumber == 5)
                {
                    route.OnFace5 = true;
                }
                else
                {
                    route.OnFace5 = false;
                }

                Part.Routings.Add(route);
            }
        }
Ejemplo n.º 10
0
        //重写ToMachining方法,将Token转换为Machining
        public override void ToMachining(double AssociatedDist, Entities.ToolFile toolFile)
        {
            //step1 查找关联的板件
            //step2 建立一个临时的水平孔列表,把孔位坐标转换为水平机加工
            //setp3 把关联的垂直钻添加到关联的板件
            FindAssociatedFaces(AssociatedDist);

            PartFace pf = this.Part.GetPartFaceByNumber(FaceNumber);

            if (pf.AssociatedPartFaces.Count != 0)//数量不为0,说明有关联的板件
            {
                List <HDrilling> TempHDrills = new List <HDrilling>();

                if (this.EdgeBoreDepth > 0 && this.EdgeBoreDiameter > 0)
                {
                    foreach (double d in this.PointsPosition)//遍历所欲的孔位坐标
                    {
                        HDrilling hdrill = new HDrilling(this.FaceNumber, this.EdgeBoreDiameter, this.EdgeBoreDepth, d, this.ZValue, Part);
                        TempHDrills.Add(hdrill);
                    }
                }

                if (this.FaceBoreDepth > 0 && this.FaceBoreDiameter > 0)
                {
                    foreach (PartFace f in pf.AssociatedPartFaces)
                    {
                        if (!f.IsHorizontalFace)//如果关联的面是面5或面6
                        {
                            foreach (var hdrill in TempHDrills)
                            {
                                Point3d holeposition = hdrill.GetBorePosition();
                                holeposition = holeposition.TransformBy(Matrix3d.AlignCoordinateSystem(new Point3d(),
                                                                                                       Vector3d.XAxis,
                                                                                                       Vector3d.YAxis,
                                                                                                       Vector3d.ZAxis,
                                                                                                       hdrill.Part.MPPoint,
                                                                                                       hdrill.Part.MPXAxis,
                                                                                                       hdrill.Part.MPYAxis,
                                                                                                       hdrill.Part.MPZAxis));
                                holeposition = Math.MathHelper.GetRotatedAndMovedPoint(holeposition, Part.TXRotation, Part.YRotation, Part.ZRotation, Part.CenterVector);
                                holeposition = holeposition.TransformBy(Matrix3d.AlignCoordinateSystem(f.Part.MovedMPPoint,
                                                                                                       f.Part.MovedMPXAxis,
                                                                                                       f.Part.MovedMPYAxis,
                                                                                                       f.Part.MovedMPZAxis,
                                                                                                       new Point3d(),
                                                                                                       Vector3d.XAxis,
                                                                                                       Vector3d.YAxis,
                                                                                                       Vector3d.ZAxis));
                                double dimx = holeposition.X;
                                double dimy = holeposition.Y;

                                VDrilling vdrill = new VDrilling(f.FaceNumber, dimx, dimy, this.FaceBoreDiameter, this.FaceBoreDepth, f.Part);
                                f.Part.VDrillings.Add(vdrill);
                            }
                        }
                        else//TODO:如果关联的面是水平面
                        {
                        }
                    }
                }

                this.Part.HDrillings.AddRange(TempHDrills);
            }
        }