/// <summary>
        /// 获取最低面
        /// </summary>
        /// <returns></returns>
        private void PullFaceForWave(List <Body> bodys)
        {
            foreach (Body body in bodys)
            {
                FaceData maxFace = null;
                double   zMin    = 9999;

                foreach (Face face in body.GetFaces())
                {
                    FaceData data   = FaceUtils.AskFaceData(face);
                    Point3d  center = UMathUtils.GetMiddle(data.BoxMaxCorner, data.BoxMinCorner);
                    if (zMin > center.Z)
                    {
                        zMin    = center.Z;
                        maxFace = data;
                    }
                }
                if (maxFace != null)
                {
                    double z = maxFace.BoxMaxCorner.Z + this.datum.EleHeight;
                    if (z > 0)
                    {
                        try
                        {
                            SynchronousUtils.CreatePullFace(new Vector3d(0, 0, -1), z, maxFace.Face);
                        }
                        catch
                        {
                        }
                    }
                }
            }
        }
Пример #2
0
 /// <summary>
 /// 以向量排序
 /// </summary>
 /// <param name="dir"></param>
 private void CylinderFeaterSort(Vector3d dir)
 {
     this.CylFeater.Sort(delegate(CylinderFeater a, CylinderFeater b)
     {
         Point3d pt1 = UMathUtils.GetMiddle(a.StartPt, a.EndPt);
         Point3d pt2 = UMathUtils.GetMiddle(b.StartPt, b.EndPt);
         this.CylFeater[0].Cylinder.Matr.ApplyPos(ref pt1);
         this.CylFeater[0].Cylinder.Matr.ApplyPos(ref pt2);
         return(pt1.Z.CompareTo(pt2.Z));
     });
 }
Пример #3
0
        public int CompareTo(AnalyzeFaceSlopeAndRadius other)
        {
            CoordinateSystem wcs = workPart.WCS.CoordinateSystem;
            Matrix4          mat = new Matrix4();

            mat.Identity();
            mat.TransformToZAxis(wcs.Origin, this.Vec);
            Point3d centerPt1 = UMathUtils.GetMiddle(this.FaceData.BoxMinCorner, this.FaceData.BoxMaxCorner);
            Point3d centerPt2 = UMathUtils.GetMiddle(other.FaceData.BoxMinCorner, other.FaceData.BoxMaxCorner);

            mat.ApplyPos(ref centerPt1);
            mat.ApplyPos(ref centerPt2);
            return(centerPt2.Z.CompareTo(centerPt1.Z));
        }
        /// <summary>
        /// 以vec向量为Z向高低排序
        /// </summary>
        /// <param name="other"></param>
        /// <returns></returns>
        public int CompareTo(AnalysisFaceSlopeAndDia other)
        {
            Part             workPart = Session.GetSession().Parts.Work;
            CoordinateSystem wcs      = workPart.WCS.CoordinateSystem;
            Matrix4          mat      = new Matrix4();

            mat.Identity();
            mat.TransformToZAxis(wcs.Origin, this.vec);
            Point3d centerPt1 = UMathUtils.GetMiddle(this.Data.BoxMinCorner, this.Data.BoxMaxCorner);
            Point3d centerPt2 = UMathUtils.GetMiddle(other.Data.BoxMinCorner, other.Data.BoxMaxCorner);

            mat.ApplyPos(ref centerPt1);
            mat.ApplyPos(ref centerPt2);
            return(centerPt1.Z.CompareTo(centerPt2.Z));
        }
Пример #5
0
        /// <summary>
        /// 通过面数据获得最大外形点(相对Matr)
        /// </summary>
        /// <param name="centerPt"></param>
        /// <param name="disPt"></param>
        private void GetCenterAndDisForData(out Point3d centerPt, out Point3d disPt)
        {
            centerPt = new Point3d();
            disPt    = new Point3d();
            Point3d min = this.Data.BoxMinCorner;
            Point3d max = this.Data.BoxMaxCorner;

            this.Matr.ApplyPos(ref min);
            this.Matr.ApplyPos(ref max);

            centerPt = UMathUtils.GetMiddle(min, max);
            disPt.X  = this.Data.Radius;
            disPt.Y  = this.Data.Radius;
            disPt.Z  = UMathUtils.GetDis(min, max) / 2;
        }
Пример #6
0
        /// <summary>
        /// 根据AB板得到矩阵
        /// </summary>
        /// <returns></returns>
        private Matrix4 GetMatr()
        {
            CoordinateSystem wcs = workPart.WCS.CoordinateSystem;
            Matrix4          mat = new Matrix4();

            mat.Identity();
            mat.TransformToCsys(wcs, ref mat);
            Matrix4 inv = mat.GetInversMatrix();
            CartesianCoordinateSystem cs    = BoundingBoxUtils.CreateCoordinateSystem(mat, inv);
            MoldBaseModel             aMold = new MoldBaseModel(aBody, mat, cs);
            MoldBaseModel             bMold = new MoldBaseModel(bBody, mat, cs);
            Vector3d vec    = UMathUtils.GetVector(bMold.CenterPt, aMold.CenterPt);
            Point3d  center = UMathUtils.GetMiddle(bMold.CenterPt, aMold.CenterPt);

            inv.ApplyPos(ref center);
            mat.TransformToZAxis(center, vec);
            return(mat);
        }
Пример #7
0
        /// <summary>
        /// 获取最低面
        /// </summary>
        /// <returns></returns>
        private List <Face> GetMaxFaceForWave(Body[] bodys)
        {
            List <Face> temp = new List <Face>();

            foreach (Body body in bodys)
            {
                Face   maxFace = null;
                double zMin    = 9999;

                foreach (Face face in body.GetFaces())
                {
                    FaceData data   = FaceUtils.AskFaceData(face);
                    Point3d  center = UMathUtils.GetMiddle(data.BoxMaxCorner, data.BoxMinCorner);
                    if (zMin > center.Z)
                    {
                        zMin    = center.Z;
                        maxFace = face;
                    }
                }
                temp.Add(maxFace);
            }
            return(temp);
        }