Beispiel #1
0
        /// <summary>
        /// create a hollowed cone beheaded
        /// </summary>
        /// <param name="myRadius">radius of the base</param>
        /// <param name="myHeight">height of the cone</param>
        /// <param name="myHeadRadius">radius of the top</param>
        /// <param name="myThickness">thickness</param>
        public HollowedConeBeheaded(double baseDiameter, double myHeight, double headDiameter, double myThickness)
        {
            // external part
            BRepPrimAPI_MakeCone aMakeCone = new BRepPrimAPI_MakeCone(new gp_Ax2(new gp_Pnt(0, 0, 0), new gp_Dir(0, 0, 1)), baseDiameter / 2, headDiameter / 2, myHeight);
            TopoDS_Shape         myBody    = aMakeCone.Shape();
            TopoDS_Solid         mySolid   = aMakeCone.Solid();

            // internal part
            BRepPrimAPI_MakeCone aMakeHollowedPart = new BRepPrimAPI_MakeCone(new gp_Ax2(new gp_Pnt(0, 0, 0), new gp_Dir(0, 0, 1)), baseDiameter / 2 - myThickness, headDiameter / 2 - myThickness, myHeight);
            TopoDS_Shape         hollowedPart      = aMakeHollowedPart.Shape();

            // cut
            BOPAlgo_BOP test = new BOPAlgo_BOP();

            test.AddArgument(mySolid);
            TopTools_ListOfShape LS = new TopTools_ListOfShape();

            LS.Append(hollowedPart);
            test.SetTools(LS);
            test.SetRunParallel(true);
            test.SetOperation(BOPAlgo_Operation.BOPAlgo_CUT);
            test.Perform();
            myBody = test.Shape();

            // triangulation
            myFaces = Triangulation(myBody, 0.7f);
        }
Beispiel #2
0
        /// <summary>
        /// create a hollowed cone beheaded
        /// </summary>
        /// <param name="largeEndDiameter">diameter of the base</param>
        /// <param name="totalHeight">height of the cone</param>
        /// <param name="smallEndDiameter">radius of the top</param>
        /// <param name="wallThickness">thickness</param>
        public Cone(double wallThickness, double largeEndDiameter, double smallEndDiameter, double totalHeight, double useless1, double useless2, double useless3, double useless4, double useless5)
        {
            // external part
            BRepPrimAPI_MakeCone aMakeCone = new BRepPrimAPI_MakeCone(new gp_Ax2(new gp_Pnt(0, 0, 0), new gp_Dir(0, 0, 1)), largeEndDiameter / 2, smallEndDiameter / 2, totalHeight);
            TopoDS_Shape         myBody    = aMakeCone.Shape();
            TopoDS_Solid         mySolid   = aMakeCone.Solid();

            // internal part
            BRepPrimAPI_MakeCone aMakeHollowedPart = new BRepPrimAPI_MakeCone(new gp_Ax2(new gp_Pnt(0, 0, 0), new gp_Dir(0, 0, 1)), largeEndDiameter / 2 - wallThickness, smallEndDiameter / 2 - wallThickness, totalHeight);
            TopoDS_Shape         hollowedPart      = aMakeHollowedPart.Shape();

            // cut
            BOPAlgo_BOP test = new BOPAlgo_BOP();

            test.AddArgument(mySolid);
            TopTools_ListOfShape LS = new TopTools_ListOfShape();

            LS.Append(hollowedPart);
            test.SetTools(LS);
            test.SetRunParallel(true);
            test.SetOperation(BOPAlgo_Operation.BOPAlgo_CUT);
            test.Perform();
            myBody = test.Shape();

            // triangulation
            myFaces = Triangulation(myBody, 0.7f);
        }
Beispiel #3
0
        public override void Build()
        {
            // convert values from UnitsNet
            double wallThick    = wallThickness.Meters;
            double largeEndDiam = largeEndDiameter.Meters;
            double smallEndDiam = smallEndDiameter.Meters;
            double totalH       = totalHeight.Meters;
            double use1         = useless1.Degrees;
            double use2         = useless2.Meters;
            double use3         = useless3.Meters;
            double use4         = useless4.Meters;
            double use5         = useless5.Meters;



            // external part
            BRepPrimAPI_MakeCone aMakeCone = new BRepPrimAPI_MakeCone(new gp_Ax2(new gp_Pnt(0, 0, 0), new gp_Dir(0, 0, 1)), largeEndDiam / 2, smallEndDiam / 2, totalH);
            TopoDS_Shape         myBody    = aMakeCone.Shape();
            TopoDS_Solid         mySolid   = aMakeCone.Solid();

            // internal part
            BRepPrimAPI_MakeCone aMakeHollowedPart = new BRepPrimAPI_MakeCone(new gp_Ax2(new gp_Pnt(0, 0, 0), new gp_Dir(0, 0, 1)), largeEndDiam / 2 - wallThick, smallEndDiam / 2 - wallThick, totalH);
            TopoDS_Shape         hollowedPart      = aMakeHollowedPart.Shape();

            // cut
            BOPAlgo_BOP test = new BOPAlgo_BOP();

            test.AddArgument(mySolid);
            TopTools_ListOfShape LS = new TopTools_ListOfShape();

            LS.Append(hollowedPart);
            test.SetTools(LS);
            test.SetRunParallel(true);
            test.SetOperation(BOPAlgo_Operation.BOPAlgo_CUT);
            test.Perform();
            myBody = test.Shape();

            // triangulation
            SetMyFaces(Triangulation(myBody, 0.7f));
        }
Beispiel #4
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);
        }
Beispiel #5
0
 public void LoadSolid(TopoDS_Solid S)
 {
     throw new NotImplementedException();
 }
Beispiel #6
0
 public bool IsInvertedSolid(TopoDS_Solid theSolid)
 {
     throw new NotImplementedException();
 }
Beispiel #7
0
 public void Init(TopoDS_Solid solid)
 {
     throw new NotImplementedException();
 }
Beispiel #8
0
 public void Update(TopoDS_Solid S)
 {
     throw new NotImplementedException();
 }
 public BRepClass3d_SolidClassifier SolidClassifier(TopoDS_Solid aSolid)
 {
     throw new NotImplementedException();
 }
 public BRepLib_MakeSolid(TopoDS_Solid So, TopoDS_Shell S)
     : base()
 {
     throw new NotImplementedException();
 }
Beispiel #11
0
 public BRepBuilderAPI_MakeSolid(TopoDS_Solid So)
     : base()
 {
     throw new NotImplementedException();
 }
Beispiel #12
0
 public TopoDS_Shell OuterShell(TopoDS_Solid S)
 {
     throw new NotImplementedException();
 }
Beispiel #13
0
 public void MakeSolids(TopoDS_Solid So, TopTools_ListOfShape LSo)
 {
     throw new NotImplementedException();
 }
        public override void Build()
        {
            // convert values from UnitsNet
            double myRad    = myRadius.Meters;
            double myH      = myHeight.Meters;
            double myThick  = myThickness.Meters;
            double myRad2   = myRadius2.Meters;
            double myH2     = myHeight2.Meters;
            double myThick2 = myThickness2.Meters;
            double pierceH  = pierceHeight.Meters;


            //  _______first cylinder (the big one) _______
            BRepPrimAPI_MakeCylinder aMakeCylinder = new BRepPrimAPI_MakeCylinder(new gp_Ax2(new gp_Pnt(0, 0, 0), new gp_Dir(0, 0, 1)), myRad, myH);
            TopoDS_Shape             myBody        = aMakeCylinder.Shape();
            TopoDS_Solid             mySolid       = aMakeCylinder.Solid();


            // inner cylinder of the bigger cylinder to be hollowed
            BRepPrimAPI_MakeCylinder aMakeHollowedPart = new BRepPrimAPI_MakeCylinder(new gp_Ax2(new gp_Pnt(0, 0, 0), new gp_Dir(0, 0, 1)), myRad - myThick, myH);
            TopoDS_Shape             hollowedPart      = aMakeHollowedPart.Shape();

            // hollowing the bigger cylinder
            BOPAlgo_BOP test = new BOPAlgo_BOP();

            test.AddArgument(mySolid);
            TopTools_ListOfShape LS = new TopTools_ListOfShape();

            LS.Append(hollowedPart);
            test.SetTools(LS);
            test.SetRunParallel(true);
            test.SetOperation(BOPAlgo_Operation.BOPAlgo_CUT);
            test.Perform();
            myBody = test.Shape();


            // _______second cylinder (the smaller one) _______
            BRepPrimAPI_MakeCylinder aMakeCylinder2 = new BRepPrimAPI_MakeCylinder(new gp_Ax2(new gp_Pnt(0, -myThick + Math.Sqrt(myRad * myRad - myRad2 * myRad2), pierceH), new gp_Dir(0, 1, 0)), myRad2, myH2);
            TopoDS_Shape             myBody2        = aMakeCylinder2.Shape();
            TopoDS_Solid             mySolid2       = aMakeCylinder2.Solid();


            // inner cylinder of the smaller cylinder to be hollowed
            BRepPrimAPI_MakeCylinder aMakeHollowedPart2 = new BRepPrimAPI_MakeCylinder(new gp_Ax2(new gp_Pnt(0, -myThick + Math.Sqrt(myRad * myRad - myRad2 * myRad2), pierceH), new gp_Dir(0, 1, 0)), myRad2 - myThick2, myH2);
            TopoDS_Shape             hollowedPart2      = aMakeHollowedPart2.Shape();


            // smaller cylinder hollowed
            BOPAlgo_BOP test2 = new BOPAlgo_BOP();

            test2.AddArgument(mySolid2);
            TopTools_ListOfShape LS2 = new TopTools_ListOfShape();

            LS2.Append(hollowedPart2);
            test2.SetTools(LS2);
            test2.SetRunParallel(true);
            test2.SetOperation(BOPAlgo_Operation.BOPAlgo_CUT);
            test2.Perform();
            TopoDS_Shape hollowedSmall = test2.Shape();

            // piercing
            BOPAlgo_BOP piercer = new BOPAlgo_BOP();

            piercer.AddArgument(myBody);
            TopTools_ListOfShape LSP = new TopTools_ListOfShape();

            LSP.Append(hollowedPart2);
            piercer.SetTools(LSP);
            piercer.SetRunParallel(true);
            piercer.SetOperation(BOPAlgo_Operation.BOPAlgo_CUT);
            piercer.Perform();
            myBody = piercer.Shape();


            // adding the tube
            BOPAlgo_BOP adder = new BOPAlgo_BOP();

            adder.AddArgument(myBody);
            TopTools_ListOfShape LSA = new TopTools_ListOfShape();

            LSA.Append(hollowedSmall);
            adder.SetTools(LSA);
            adder.SetRunParallel(true);
            adder.SetOperation(BOPAlgo_Operation.BOPAlgo_FUSE);
            adder.Perform();
            myBody = adder.Shape();//*/



            // _______triangulation_______
            SetMyFaces(Triangulation(myBody, 0.007f));
        }
Beispiel #15
0
 public TopAbs_State Classify(TopoDS_Solid S, gp_Pnt P, double Tol)
 {
     throw new NotImplementedException();
 }
Beispiel #16
0
 public BRepCheck_Solid(TopoDS_Solid theS)
     : base()
 {
     throw new NotImplementedException();
 }
Beispiel #17
0
 public TopAbs_State ComputeState(TopoDS_Edge theEdge, TopoDS_Solid theSolid, double theTol,
                                  IntTools_Context theContext)
 {
     throw new NotImplementedException();
 }
Beispiel #18
0
        /// <summary>
        /// Make a Solid covering the whole 3D space.
        /// </summary>
        /// <param name="S"></param>
        public void MakeSolid(TopoDS_Solid S)
        {
            var ts = new TopoDS_TSolid();

            MakeShape(S, ts);
        }
Beispiel #19
0
 public TopAbs_State ComputeState(TopoDS_Face theFace, TopoDS_Solid theSolid, double theTol,
                                  TopTools_IndexedMapOfShape theBounds, IntTools_Context theContext)
 {
     throw new NotImplementedException();
 }
 public bool RegularizeShells(TopoDS_Solid aSolid, TopTools_DataMapOfShapeListOfShape OldSheNewShe,
                              TopTools_DataMapOfShapeListOfShape FSplits)
 {
     throw new NotImplementedException();
 }
Beispiel #21
0
 public TopAbs_State ComputeStateByOnePoint(TopoDS_Shape theShape, TopoDS_Solid theSolid, double theTol,
                                            IntTools_Context theContext)
 {
     throw new NotImplementedException();
 }
Beispiel #22
0
 public bool OrientClosedSolid(TopoDS_Solid solid)
 {
     throw new NotImplementedException();
 }
Beispiel #23
0
 public bool IsInternalFace(TopoDS_Face theFace, TopoDS_Solid theSolid,
                            TopTools_IndexedDataMapOfShapeListOfShape theMEF, double theTol, IntTools_Context theContext)
 {
     throw new NotImplementedException();
 }
Beispiel #24
0
        /// <summary>
        /// create a hollowed cylinder that is pierced with another cylinder
        /// </summary>
        /// <param name="myRadius">radius of the big cylinder</param>
        /// <param name="myHeight">height of the big cylinder</param>
        /// <param name="myThickness">thickness of the big cylinder</param>
        /// <param name="myRadius2">radius of the small cylinder</param>
        /// <param name="myHeight2">height of the small cylinder</param>
        /// <param name="myThickness2">thickness of the small cylinder</param>
        /// <param name="pierceHeight">height on which we pierce</param>
        public HollowedCylinderPiercedWithHollowedCylinder(double myRadius, double myHeight, double myThickness, double myRadius2, double myHeight2, double myThickness2, double pierceHeight)
        {
            //  _______first cylinder (the big one) _______
            BRepPrimAPI_MakeCylinder aMakeCylinder = new BRepPrimAPI_MakeCylinder(new gp_Ax2(new gp_Pnt(0, 0, 0), new gp_Dir(0, 0, 1)), myRadius, myHeight);
            TopoDS_Shape             myBody        = aMakeCylinder.Shape();
            TopoDS_Solid             mySolid       = aMakeCylinder.Solid();


            // inner cylinder of the bigger cylinder to be hollowed
            BRepPrimAPI_MakeCylinder aMakeHollowedPart = new BRepPrimAPI_MakeCylinder(new gp_Ax2(new gp_Pnt(0, 0, 0), new gp_Dir(0, 0, 1)), myRadius - myThickness, myHeight);
            TopoDS_Shape             hollowedPart      = aMakeHollowedPart.Shape();

            // hollowing the bigger cylinder
            BOPAlgo_BOP test = new BOPAlgo_BOP();

            test.AddArgument(mySolid);
            TopTools_ListOfShape LS = new TopTools_ListOfShape();

            LS.Append(hollowedPart);
            test.SetTools(LS);
            test.SetRunParallel(true);
            test.SetOperation(BOPAlgo_Operation.BOPAlgo_CUT);
            test.Perform();
            myBody = test.Shape();


            // _______second cylinder (the smaller one) _______
            BRepPrimAPI_MakeCylinder aMakeCylinder2 = new BRepPrimAPI_MakeCylinder(new gp_Ax2(new gp_Pnt(0, -myThickness + Math.Sqrt(myRadius * myRadius - myRadius2 * myRadius2), pierceHeight), new gp_Dir(0, 1, 0)), myRadius2, myHeight2);
            TopoDS_Shape             myBody2        = aMakeCylinder2.Shape();
            TopoDS_Solid             mySolid2       = aMakeCylinder2.Solid();


            // inner cylinder of the smaller cylinder to be hollowed
            BRepPrimAPI_MakeCylinder aMakeHollowedPart2 = new BRepPrimAPI_MakeCylinder(new gp_Ax2(new gp_Pnt(0, -myThickness + Math.Sqrt(myRadius * myRadius - myRadius2 * myRadius2), pierceHeight), new gp_Dir(0, 1, 0)), myRadius2 - myThickness2, myHeight2);
            TopoDS_Shape             hollowedPart2      = aMakeHollowedPart2.Shape();


            // smaller cylinder hollowed
            BOPAlgo_BOP test2 = new BOPAlgo_BOP();

            test2.AddArgument(mySolid2);
            TopTools_ListOfShape LS2 = new TopTools_ListOfShape();

            LS2.Append(hollowedPart2);
            test2.SetTools(LS2);
            test2.SetRunParallel(true);
            test2.SetOperation(BOPAlgo_Operation.BOPAlgo_CUT);
            test2.Perform();
            TopoDS_Shape hollowedSmall = test2.Shape();

            // piercing
            BOPAlgo_BOP piercer = new BOPAlgo_BOP();

            piercer.AddArgument(myBody);
            TopTools_ListOfShape LSP = new TopTools_ListOfShape();

            LSP.Append(hollowedPart2);
            piercer.SetTools(LSP);
            piercer.SetRunParallel(true);
            piercer.SetOperation(BOPAlgo_Operation.BOPAlgo_CUT);
            piercer.Perform();
            myBody = piercer.Shape();


            // adding the tube
            BOPAlgo_BOP adder = new BOPAlgo_BOP();

            adder.AddArgument(myBody);
            TopTools_ListOfShape LSA = new TopTools_ListOfShape();

            LSA.Append(hollowedSmall);
            adder.SetTools(LSA);
            adder.SetRunParallel(true);
            adder.SetOperation(BOPAlgo_Operation.BOPAlgo_FUSE);
            adder.Perform();
            myBody = adder.Shape();//*/



            // _______triangulation_______
            myFaces = Triangulation(myBody, 0.007f);
        }
Beispiel #25
0
 public ShapeFix_Solid(TopoDS_Solid solid)
     : base()
 {
     throw new NotImplementedException();
 }