Exemple #1
0
        /// <summary>
        /// generate a hollowed cylinder
        /// </summary>
        /// <param name="myDiameter">diameter</param>
        /// <param name="myLength">length</param>
        /// <param name="myThickness">thickness</param>
        public HollowedCylinder(double myDiameter, double myLength, double myThickness)
        {
            // external part
            BRepPrimAPI_MakeCylinder aMakeCylinder = new BRepPrimAPI_MakeCylinder(new gp_Ax2(new gp_Pnt(0, 0, 0), new gp_Dir(0, 0, 1)), myDiameter / 2, myLength);
            TopoDS_Shape             myBody        = aMakeCylinder.Shape();

            // internal part
            BRepPrimAPI_MakeCylinder aMakeHollowedPart = new BRepPrimAPI_MakeCylinder(new gp_Ax2(new gp_Pnt(0, 0, 0), new gp_Dir(0, 0, 1)), myDiameter / 2 - myThickness, myLength);
            TopoDS_Shape             hollowedPart      = aMakeHollowedPart.Shape();

            // cut
            BOPAlgo_BOP test = new BOPAlgo_BOP();

            test.AddArgument(myBody);
            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);
        }
Exemple #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);
        }
Exemple #3
0
        public override void Build()
        {
            // convert values from UnitsNet
            double diam = diameter.Meters;
            double wt   = wallthickness.Meters;
            double len  = length.Meters;

            // external part
            BRepPrimAPI_MakeCylinder aMakeCylinder = new BRepPrimAPI_MakeCylinder(new gp_Ax2(new gp_Pnt(0, 0, 0), new gp_Dir(0, 0, 1)), diam / 2, len);
            TopoDS_Shape             myBody        = aMakeCylinder.Shape();

            // internal part
            BRepPrimAPI_MakeCylinder aMakeHollowedPart = new BRepPrimAPI_MakeCylinder(new gp_Ax2(new gp_Pnt(0, 0, 0), new gp_Dir(0, 0, 1)), diam / 2 - wt, len);
            TopoDS_Shape             hollowedPart      = aMakeHollowedPart.Shape();

            // cut
            BOPAlgo_BOP test = new BOPAlgo_BOP();

            test.AddArgument(myBody);
            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));
        }
Exemple #4
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);
        }
Exemple #5
0
        public override void Build()
        {
            // convert values from UnitsNet
            double wallThick  = wallThickness.Meters;
            double bendingRad = bendingRadius.Meters;
            double bendingA   = bendingAngle.Degrees;
            double Len1       = firstEndAdditionalHeight.Meters;
            //double Len2 = L2.Meters; // not implemented yet


            // to calculate n
            double min        = 20;
            double max        = 50;
            double angleLimit = 15;
            double coef       = (bendingA - angleLimit) * (max - min) / (180 - angleLimit) > 0 ? (bendingA - angleLimit) * (max - min) / (180 - angleLimit) : 0;
            double n          = (int)(min + coef);

            // generate the POINTS for the spline
            double             smallShift = Math.PI / 16;
            TColgp_Array1OfPnt array1     = GenerateSpline(Len1, bendingRad, wallThick, 0);
            TColgp_Array1OfPnt array2     = GenerateSpline(Len1, bendingRad, wallThick, smallShift);

            // create the SPLINE with the points
            GeomAPI_PointsToBSpline aSpline1          = new GeomAPI_PointsToBSpline(array1);
            GeomAPI_PointsToBSpline aSpline2          = new GeomAPI_PointsToBSpline(array2);
            Geom_BSplineCurve       connectionSpline1 = aSpline1.Curve();
            Geom_BSplineCurve       connectionSpline2 = aSpline2.Curve();


            // create EXTERNAL shape with spline
            TopoDS_Shape myBody3 = Build(connectionSpline1, bendingA, bendingRad, n, 0);

            // create INTERNAL shape with spline
            TopoDS_Shape myBody32 = Build(connectionSpline2, bendingA, bendingRad - wallThick, n, smallShift);



            // ______________ hollowing ______________
            BOPAlgo_BOP cutter = new BOPAlgo_BOP();

            cutter.AddArgument(myBody3);
            TopTools_ListOfShape LSC = new TopTools_ListOfShape();

            LSC.Append(myBody32);
            cutter.SetTools(LSC);
            cutter.SetRunParallel(true);
            cutter.SetOperation(BOPAlgo_Operation.BOPAlgo_CUT);
            cutter.Perform();
            myBody3 = cutter.Shape();



            // ______________ triangulation ______________
            SetMyFaces(Triangulation(myBody3, 0.7f));//*/
        }
Exemple #6
0
        /// <summary>
        /// put in MyFaces all the faces that we compute. Note that L1 doesn't exist in BaseElement but i don't figure out on how we can modelize it without L1, there also could be a L2
        /// </summary>
        /// <param name="L1">length between the origin and the most right part of the tube ( same for the top)</param>
        /// <param name="bendingRadius">radius of the pipe</param>
        /// <param name="wallThickness">thickness of the pipe</param>
        /// <param name="bendingAngle"> angle from 0*pi/180 to bendingAngle*pi/180</param>
        /// <param name="n">parameter that modifies the number of triangles</param>
        //public Elbow(double L1, double wallThickness, double bendingRadius, double bendingAngle)
        public Elbow(double wallThickness, double bendingRadius, double bendingAngle, double L1)
        {
            // to calculate n
            double min        = 20;
            double max        = 50;
            double angleLimit = 15;
            double coef       = (bendingAngle - angleLimit) * (max - min) / (180 - angleLimit) > 0 ? (bendingAngle - angleLimit) * (max - min) / (180 - angleLimit) : 0;
            double n          = (int)(min + coef);

            // generate the POINTS for the spline
            double             smallShift = Math.PI / 16;
            TColgp_Array1OfPnt array1     = GenerateSpline(L1, bendingRadius, wallThickness, 0);
            TColgp_Array1OfPnt array2     = GenerateSpline(L1, bendingRadius, wallThickness, smallShift);

            // create the SPLINE with the points
            GeomAPI_PointsToBSpline aSpline1          = new GeomAPI_PointsToBSpline(array1);
            GeomAPI_PointsToBSpline aSpline2          = new GeomAPI_PointsToBSpline(array2);
            Geom_BSplineCurve       connectionSpline1 = aSpline1.Curve();
            Geom_BSplineCurve       connectionSpline2 = aSpline2.Curve();

            // create EXTERNAL shape with spline
            TopoDS_Shape myBody3 = Build(connectionSpline1, bendingAngle, bendingRadius, n, 0);

            // create INTERNAL shape with spline
            TopoDS_Shape myBody32 = Build(connectionSpline2, bendingAngle, bendingRadius - wallThickness, n, smallShift);//*/



            // ______________ hollowing ______________
            BOPAlgo_BOP cutter = new BOPAlgo_BOP();

            cutter.AddArgument(myBody3);
            TopTools_ListOfShape LSC = new TopTools_ListOfShape();

            LSC.Append(myBody32);
            cutter.SetTools(LSC);
            cutter.SetRunParallel(true);
            cutter.SetOperation(BOPAlgo_Operation.BOPAlgo_CUT);
            cutter.Perform();
            myBody3 = cutter.Shape();//*/



            // ______________ triangulation ______________
            myFaces = Triangulation(myBody3, 0.7f);
        }
Exemple #7
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));
        }
Exemple #8
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);
        }
Exemple #9
0
        /// <summary>
        /// create a screw
        /// </summary>
        /// <param name="widthBase">length of the base</param>
        /// <param name="diameter">diameter of the screwed part</param>
        /// <param name="lengthVis">length of the screwed part</param>
        /// <param name="pas">distance travelled by the helicoidal part after 2*pi</param>
        /// <param name="heightBase">height of the base</param>
        /// <param name="profondeurSillon">depth of the screw</param>
        /// <param name="longueurSillon">length of the helicoidal part</param>
        public Vis(double widthBase, double diameter, double lengthVis, double pas, double heightBase, double profondeurSillon, double longueurSillon)
        {                                                     // it was hard to parameterize it "correctly", consider taking a screenshot before having fun in modifying it
            double param6  = 2;                               // pas / (2 * Math.PI); // pas trop grand please
            double param10 = pas / (Math.PI / 3);             // c'est pour definir le pas
            double param9  = 0;                               // -param10/2; // position de la vis ?
            double param1  = lengthVis - longueurSillon / 2;  // position du centre de la partie helicoidale par rapport au bout pointu de la vis

            double aMinor = 0.05;                             // epaisseur de la rainure
            double aMajor = (longueurSillon / pas) * Math.PI; // un pi par tour donc 2*pi = 2 tours

            // Base

            /*Cylinder myBase = new Cylinder(widthBase / 2, heightBase);
             * myBase.Translate(new Pnt(0, 0, -heightBase));//*/
            BRepPrimAPI_MakeCylinder aMakeCylinder = new BRepPrimAPI_MakeCylinder(new gp_Ax2(new gp_Pnt(0, 0, -heightBase), new gp_Dir(0, 0, 1)), widthBase / 2, heightBase);
            TopoDS_Shape             myBase        = aMakeCylinder.Shape();

            // helicoidal part
            //Cylinder neck = new Cylinder(diameter / 2, lengthVis);
            BRepPrimAPI_MakeCylinder aMakeCylinder2 = new BRepPrimAPI_MakeCylinder(new gp_Ax2(new gp_Pnt(0, 0, 0), new gp_Dir(0, 0, 1)), diameter / 2, lengthVis);
            TopoDS_Shape             neck           = aMakeCylinder2.Shape();

            //threading: define 2d curves
            double   depart = param1;
            gp_Pnt2d aPnt   = new gp_Pnt2d(2 * Math.PI, param9);
            gp_Dir2d aDir   = new gp_Dir2d(2 * Math.PI, param10);
            gp_Ax2d  anAx2d = new gp_Ax2d(aPnt, aDir);

            //double aMinor = longueurSillon/5; // epaisseur de la rainure
            Geom2d.Geom2d_Ellipse      anEllipse1 = new Geom2d.Geom2d_Ellipse(anAx2d, aMajor, aMinor);
            Geom2d.Geom2d_Ellipse      anEllipse2 = new Geom2d.Geom2d_Ellipse(anAx2d, aMajor, aMinor / param6);
            Geom2d.Geom2d_TrimmedCurve anArc1     = new Geom2d.Geom2d_TrimmedCurve(anEllipse1, 0, Math.PI);
            Geom2d.Geom2d_TrimmedCurve anArc2     = new Geom2d.Geom2d_TrimmedCurve(anEllipse2, 0, Math.PI);
            gp_Pnt2d          anEllipsePnt1       = anEllipse1.Value(0);
            gp_Pnt2d          anEllipsePnt2       = anEllipse1.Value(Math.PI);
            GCE2d_MakeSegment aMakeSegment        = new GCE2d_MakeSegment(anEllipsePnt1, anEllipsePnt2);

            Geom2d.Geom2d_TrimmedCurve aSegment = aMakeSegment.Value();
            //threading: build edges and wires
            Geom_CylindricalSurface aCyl1 = new Geom_CylindricalSurface(new gp_Ax3(new gp_Ax2(new gp_Pnt(0, 0, depart), new gp_Dir(0, 0, 1))), (diameter / 2) * 0.99);
            Geom_CylindricalSurface aCyl2 = new Geom_CylindricalSurface(new gp_Ax3(new gp_Ax2(new gp_Pnt(0, 0, depart), new gp_Dir(0, 0, 1))), (diameter / 2) * (0.99 + profondeurSillon));
            //
            BRepBuilderAPI_MakeEdge aMakeEdge = new BRepBuilderAPI_MakeEdge(anArc1, aCyl1);

            aMakeEdge.Build();
            TopoDS_Edge anEdge1OnSurf1 = aMakeEdge.Edge();

            //
            aMakeEdge = new BRepBuilderAPI_MakeEdge(aSegment, aCyl1);
            aMakeEdge.Build();
            TopoDS_Edge anEdge2OnSurf1 = aMakeEdge.Edge();

            //
            aMakeEdge = new BRepBuilderAPI_MakeEdge(anArc2, aCyl2);
            aMakeEdge.Build();
            TopoDS_Edge anEdge1OnSurf2 = aMakeEdge.Edge();

            //
            aMakeEdge = new BRepBuilderAPI_MakeEdge(aSegment, aCyl2);
            aMakeEdge.Build();
            TopoDS_Edge anEdge2OnSurf2 = aMakeEdge.Edge();
            //
            BRepBuilderAPI_MakeWire aMakeWire = new BRepBuilderAPI_MakeWire(anEdge1OnSurf1, anEdge2OnSurf1);

            aMakeWire.Build();
            TopoDS_Wire threadingWire1 = aMakeWire.Wire();

            aMakeWire = new BRepBuilderAPI_MakeWire(anEdge1OnSurf2, anEdge2OnSurf2);
            aMakeWire.Build();
            TopoDS_Wire threadingWire2 = aMakeWire.Wire();

            BRepLib.BRepLib.BuildCurves3d(threadingWire1);
            BRepLib.BRepLib.BuildCurves3d(threadingWire2);
            //create threading
            BRepOffsetAPI_ThruSections aTool = new BRepOffsetAPI_ThruSections(true);

            aTool.AddWire(threadingWire1);
            aTool.AddWire(threadingWire2);
            aTool.CheckCompatibility(false);
            TopoDS_Shape myThreading = aTool.Shape();


            // _______fuse_______
            BOPAlgo_BOP adder = new BOPAlgo_BOP();

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

            LSA.Append(neck);
            adder.SetTools(LSA);
            adder.SetRunParallel(true);
            adder.SetOperation(BOPAlgo_Operation.BOPAlgo_FUSE);
            adder.Perform();
            TopoDS_Shape myBody = adder.Shape();

            // _______fuse_______
            BOPAlgo_BOP adder2 = new BOPAlgo_BOP();

            adder2.AddArgument(myBody);
            TopTools_ListOfShape LSA2 = new TopTools_ListOfShape();

            LSA2.Append(myThreading);
            adder2.SetTools(LSA2);
            adder2.SetRunParallel(true);
            adder2.SetOperation(BOPAlgo_Operation.BOPAlgo_FUSE);
            adder2.Perform();
            myBody = adder2.Shape();

            // _______triangulation_______
            myFaces = Triangulation(myBody, 0.007f);
        }
        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));
        }