Exemple #1
0
        //判断特征类型
        public static NewSelfDefFeatureType GetFeatureType(MyNewDefineFeature Feature1)
        {
            NewSelfDefFeatureType FeatureType = NewSelfDefFeatureType.OTHER_TYPE;

            HashSet <Tag>     Edge_Feature;
            HashSet <Point3d> Vertex_Feature;

            MyNewEdge.GetEdgeOfFeature(Feature1, out Edge_Feature);
            MyVertex.GetVertexOfFeature(Feature1, out Vertex_Feature);
            Feature1.EdgeNumber   = Edge_Feature.Count;                  //特征中边的数目
            Feature1.VertexNumber = Vertex_Feature.Count;                //特征中顶点的数目;

            Feature1.FeatureFaceAngleGraphic = new AngleGraph(Feature1); //构建特征中面之间的夹角图
            //先识别出每个孤立特征的特征类型,然后在进行组合
            if (IsThroughHole(Feature1))                                 //通孔
            {
                FeatureType = NewSelfDefFeatureType.ThroughHole;
                for (int i = 0; i < Feature1.FeatureAdjacentFaceList.Count; i++)
                {
                    if (Feature1.FeatureAdjacentFaceList[i].FaceType == MyNewFaceType.Cylindrical)
                    {
                        FeatureType = NewSelfDefFeatureType.HORIZONTAL_HOLE;//横孔
                    }
                }
            }
            else if (IsRECT_THROUGH_SOLT(Feature1))//矩形通腔
            {
                FeatureType = NewSelfDefFeatureType.RECT_THROUGH_SOLT;
            }
            else if (IsCounterboreHole(Feature1))//盲孔
            {
                FeatureType = NewSelfDefFeatureType.BlindHole;
            }
            else if (IsConicalHole(Feature1))//锥孔
            {
                FeatureType = NewSelfDefFeatureType.Conical_HOLE;
            }
            else if (IsIsolatedSmoothSurface(Feature1))
            {
                FeatureType = NewSelfDefFeatureType.ISOLATED_SMOOTH_SURFACE; //孤立的光顺面;
            }
            else if (IsRectCavity(Feature1))                                 //判断是否是矩形腔
            {
                FeatureType = NewSelfDefFeatureType.RECT_CAVITY;             //矩形腔
            }
            else if (IsOutterCylinderSurface(Feature1))
            {
                FeatureType = NewSelfDefFeatureType.Outter_Cylinder_Surface;//凸台特征的外圆柱面
            }
            return(FeatureType);
        }
Exemple #2
0
        //构建Face的矩阵邻接图属性邻接图
        public FeatureGraphic()
        {
            FaceNodeList         = new List <GripchFaceNode>();
            DeCompseBaseFaceList = new List <Tag>();
            Face[] BodyFace = MyFace.GetFaceOfBody();
            NumOfFace = BodyFace.Length;
            //构建AAG图中的面链表
            for (int i = 0; i < BodyFace.Length; i++)
            {
                GripchFaceNode faceNode = new GripchFaceNode();
                faceNode.AreaOfFace = 0;//的面的表面积
                if (MyFace.IsConcaveFace(BodyFace[i].Tag) == 2)
                {
                    faceNode.FaceConcaConve = FaceConcavity.Concavity;//面的凸凹性
                }
                else if (MyFace.IsConcaveFace(BodyFace[i].Tag) == 1)
                {
                    faceNode.FaceConcaConve = FaceConcavity.Convexity;
                }
                else
                {
                    faceNode.FaceConcaConve = FaceConcavity.Tangent;//光顺面
                }
                int loopNum = 0, InnerloopNum = 0;
                GetLoopsNumber(BodyFace[i].Tag, ref loopNum, ref InnerloopNum);
                faceNode.FaceInnerLoopNumber = InnerloopNum; //面中内环的数目
                faceNode.FaceLoopNumber      = loopNum;      //面中环的数目
                faceNode.FaceTag             = BodyFace[i].Tag;
                faceNode.NodeFaceType        = MyNewFace.getFaceType(BodyFace[i]);
                faceNode.IsDeCompseBaseFace  = faceNode.IsBaseFace();
                if (faceNode.IsDeCompseBaseFace)
                {
                    DeCompseBaseFaceList.Add(BodyFace[i].Tag);
                }
                faceNode.IsConCavityFace    = faceNode.IsConCavityFacebyEdge();
                faceNode.FaceInnerLoopEdges = faceNode.GetFaceInnerListEdges();


                //faceNode.IsConCavityFace = IsConCavityFacebyEdge(faceNode.FaceTag);

                int      type  = 0;                                //面的类型
                double[] point = { 0.0, 0.0, 0.0 };                //圆柱面、圆锥面轴线上的一点
                double[] dir   = { 0.0, 0.0, 0.0 };                //轴线方向
                double[] box   = { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 }; //面的包容盒
                double   radius;
                double   rad_data;
                int      norm_dir = 0;
                Program.theUfmodel.AskFaceData(BodyFace[i].Tag, out type, point, dir, box, out radius, out rad_data, out norm_dir);
                if (faceNode.NodeFaceType == MyNewFaceType.Cylindrical || faceNode.NodeFaceType == MyNewFaceType.Conical)
                {
                    //数组还可这样赋值?
                    faceNode.Face_Axis[0] = Math.Round(dir[0], 2);
                    faceNode.Face_Axis[1] = Math.Round(dir[1], 2);
                    faceNode.Face_Axis[2] = Math.Round(dir[2], 2);


                    faceNode.Face_Axis_Point[0] = Math.Round(point[0], 2);
                    faceNode.Face_Axis_Point[1] = Math.Round(point[1], 2);
                    faceNode.Face_Axis_Point[2] = Math.Round(point[2], 2);
                }
                FaceNodeList.Add(faceNode);
            }
            //构建二维AAG图中的属性邻接图主要包含边的信息
            adjmatrix = new GripchEdgeNode[NumOfFace, NumOfFace];
            Tag[] shared_edges;
            for (int i = 0; i < BodyFace.Length; ++i)
            {
                for (int j = 0; j < BodyFace.Length; ++j)
                {
                    if (i == j)
                    {
                        adjmatrix[i, j] = null;
                        continue;
                    }
                    //判断两个面是否相邻
                    Program.theUfmodel.AskSharedEdges(BodyFace[i].Tag, BodyFace[j].Tag, out shared_edges);
                    if (shared_edges.Length == 0)//不相邻的情况取null
                    {
                        adjmatrix[i, j] = adjmatrix[j, i] = null;
                    }
                    else
                    {
                        GripchEdgeNode EdgeNode = new GripchEdgeNode();
                        EdgeNode.EdgeConcaConve = MyNewEdge.GetEdgeConca(shared_edges[0]);


                        EdgeNode.EdgeTag      = shared_edges[0];
                        EdgeNode.NodeEdgeType = MyNewEdge.GetEdgeType(shared_edges[0]);
                        EdgeNode.LooType      = true;//暂定true;
                        adjmatrix[i, j]       = EdgeNode;
                    }
                }
            }
            InnerLoopEdgeNumber = GetInnerLoopEdgesNumber();
            InnerLoopEdgeList   = new List <Tag>();
            Tag InneerEdge;

            /*GetInnerLoopEdge(InneerEdgeArray,InnerLoopEdgeNumber);*/
            for (int i = 0; i < InnerLoopEdgeNumber; ++i)
            {
                InneerEdge = GetInnerIndexEdge(i);
                InnerLoopEdgeList.Add(InneerEdge);
            }

            //初始化用来存储,AAG图中分解的特征
            SubFeaturesList = new List <MyNewDefineFeature>();
        }
Exemple #3
0
        //内环边删除后,根据给定的面List来构建属性邻接图
        public FeatureGraphic(List <Tag> FaceList)
        {
            FaceNodeList         = new List <GripchFaceNode>();
            DeCompseBaseFaceList = new List <Tag>();

            NumOfFace = FaceList.Count;
            //构建AAG图中的面链表
            for (int i = 0; i < NumOfFace; i++)
            {
                GripchFaceNode faceNode = new GripchFaceNode();
                faceNode.AreaOfFace = 0;//的面的表面积
                if (MyFace.IsConcaveFace(FaceList[i]) == 2)
                {
                    faceNode.FaceConcaConve = FaceConcavity.Concavity;//面的凸凹性
                }
                else if (MyFace.IsConcaveFace(FaceList[i]) == 1)
                {
                    faceNode.FaceConcaConve = FaceConcavity.Convexity;
                }
                else
                {
                    faceNode.FaceConcaConve = FaceConcavity.Tangent;//光顺面
                }
                int loopNum = 0, InnerloopNum = 0;
                GetLoopsNumber(FaceList[i], ref loopNum, ref InnerloopNum);
                faceNode.FaceInnerLoopNumber = 0;       //面中内环的数目
                faceNode.FaceLoopNumber      = loopNum; //面中环的数目
                faceNode.FaceTag             = FaceList[i];
                faceNode.NodeFaceType        = MyNewFace.getFaceType(FaceList[i]);
                faceNode.IsDeCompseBaseFace  = faceNode.IsBaseFace();
                if (faceNode.IsDeCompseBaseFace)
                {
                    DeCompseBaseFaceList.Add(FaceList[i]);
                }
                //面凸凹性的判断,需要根据凹边是否存在
                faceNode.IsConCavityFace = faceNode.IsConCavityFacebyEdge();
                //faceNode.FaceInnerLoopEdges = faceNode.GetFaceInnerListEdges();//得到面的内环边

                int      type  = 0;                                //面的类型
                double[] point = { 0.0, 0.0, 0.0 };                //圆柱面、圆锥面轴线上的一点
                double[] dir   = { 0.0, 0.0, 0.0 };                //轴线方向
                double[] box   = { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 }; //面的包容盒
                double   radius;
                double   rad_data;
                int      norm_dir = 0;
                Program.theUfmodel.AskFaceData(FaceList[i], out type, point, dir, box, out radius, out rad_data, out norm_dir);
                if (faceNode.NodeFaceType == MyNewFaceType.Cylindrical || faceNode.NodeFaceType == MyNewFaceType.Cylindrical)
                {
                    //数组还可这样赋值?
                    faceNode.Face_Axis       = dir;
                    faceNode.Face_Axis_Point = point;
                }
                FaceNodeList.Add(faceNode);
            }
            //构建二维AAG图中的属性邻接图主要包含边的信息
            adjmatrix = new GripchEdgeNode[NumOfFace, NumOfFace];
            Tag[] shared_edges;
            for (int i = 0; i < FaceList.Count; ++i)
            {
                for (int j = 0; j < FaceList.Count; ++j)
                {
                    if (i == j)
                    {
                        adjmatrix[i, j] = null;
                        continue;
                    }
                    //判断两个面是否相邻
                    Program.theUfmodel.AskSharedEdges(FaceList[i], FaceList[j], out shared_edges);
                    if (shared_edges.Length == 0)//不相邻的情况取null
                    {
                        adjmatrix[i, j] = adjmatrix[j, i] = null;
                    }
                    else
                    {
                        GripchEdgeNode EdgeNode = new GripchEdgeNode();
                        EdgeNode.EdgeConcaConve = MyNewEdge.GetEdgeConca(shared_edges[0]);


                        EdgeNode.EdgeTag      = shared_edges[0];
                        EdgeNode.NodeEdgeType = MyNewEdge.GetEdgeType(shared_edges[0]);
                        EdgeNode.LooType      = true;//暂定true;
                        adjmatrix[i, j]       = EdgeNode;
                    }
                }
            }
            //初始化用来存储,AAG图中分解的特征
            SubFeaturesList = new List <MyNewDefineFeature>();
        }