Ejemplo n.º 1
0
        public static gpPln ExtractPlaneFromFaceShape(TopoDSShape targetFace)
        {
            var face = TopoDS.Face(targetFace);
            var surf = BRepTool.Surface(face);
            var pl   = new GeomPlane(new gpAx3());

            pl = surf.Convert <GeomPlane>();
            //surf.DownCast(ref pl);
            var faceElementAdaptor = new BRepAdaptorSurface(face, true);

            //TO DO: Investigate why this is not working
            Ensure.AreEqual(faceElementAdaptor.GetType, GeomAbsSurfaceType.GeomAbs_Plane);
            return(pl.Pln);
        }
Ejemplo n.º 2
0
        private static void BuildFaceList(TopoDSShape solidShape, SolverGeometricObject solverObject)
        {
            var listOfFaces = GeomUtils.ExtractFaces(solidShape);

            if (listOfFaces.Count <= 0)
            {
                return;
            }
            foreach (var face in listOfFaces)
            {
                var surf = BRepTool.Surface(face);
                solverObject.Surfaces.Add(new SolverSurface(surf, GeometryType.Face));

                // Check if surface is planar
                var aFaceElementAdaptor = new BRepAdaptorSurface(face, true);
                var surfaceType         = aFaceElementAdaptor.GetType;
                if (surfaceType != GeomAbsSurfaceType.GeomAbs_Plane)
                {
                    continue;
                }
                GeomPlane pl = surf.Convert <GeomPlane>();
                solverObject.Planes.Add(new SolverPlane(pl.Pln, GeometryType.Plane, solverObject.Parent));
            }
        }