Beispiel #1
0
        //--------------------------------------------------------------------------------------------------

        public static void UpdateSolidOrientation(TopoDS_Shape solid)
        {
            var classifier = new BRepClass3d_SolidClassifier(solid);

            classifier.PerformInfinitePoint(Precision.Confusion());
            if (classifier.State() == TopAbs_State.TopAbs_IN)
            {
                solid.Reverse();
            }
        }
Beispiel #2
0
        //--------------------------------------------------------------------------------------------------

        public static TopoDS_Solid MakeSolid(TopoDS_Shell shell, bool correctOrientation)
        {
            var builder = new BRep_Builder();
            var solid   = new TopoDS_Solid();

            builder.MakeSolid(solid);
            builder.Add(solid, shell);

            if (correctOrientation)
            {
                var classifier = new BRepClass3d_SolidClassifier(solid);
                classifier.PerformInfinitePoint(Precision.Confusion());
                if (classifier.State() == TopAbs_State.TopAbs_IN)
                {
                    solid = new TopoDS_Solid();
                    builder.MakeSolid(solid);
                    builder.Add(solid, shell.Reversed());
                }
            }

            return(solid);
        }