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));//*/ }
/// <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); }