Exemplo n.º 1
0
        public Solid(TopoShape solid)
        {
            BoundingBox = solid.GetBBox();

            var faces = GlobalInstance.TopoExplor.ExplorFaces(solid);
            TopoShapeProperty prop           = new TopoShapeProperty();
            List <FaceInfo>   dictFaceByArea = new List <FaceInfo>();

            for (int ii = 0; ii < faces.Size(); ++ii)
            {
                var face = faces.GetAt(ii);
                prop.SetShape(face);
                double area = prop.SurfaceArea();

                var faceInfo = new FaceInfo(face, ii, area);
                dictFaceByArea.Add(faceInfo);

                Faces.Add(ii, faceInfo);
            }
            dictFaceByArea.Sort((a, b) =>
            {
                return((int)((b.Area - a.Area) * 1000));
            });

            var baseFace = dictFaceByArea[0];

            foreach (var item in baseFace.Edges)
            {
                EdgeGroup eg = new EdgeGroup(item.Value);
                EdgeGroups.Add(eg);
            }

            for (int ii = 2; ii < dictFaceByArea.Count; ++ii)
            {
                var faceInfo = dictFaceByArea[ii];
                if (AddLongFace(faceInfo))
                {
                    continue;
                }

                AddSideFace(faceInfo);
            }
        }
Exemplo n.º 2
0
        public bool Add(FaceInfo face)
        {
            foreach (var item in face.Edges)
            {
                var edge = item.Value;
                if (Math.Abs(edge.Length - EdgeLength) > 0.001)
                {
                    continue;
                }

                if (CompareWithKey(edge.Direction))
                {
                    LongEdges.Add(new LongFaceEdge(face.Index, edge.Index));
                    return(true);
                }
            }

            return(false);
        }