Example #1
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));//*/
        }
Example #2
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);
        }
Example #3
0
        /// <summary>
        /// build the shape of the elbow (internal or external) by building the sliding face and building the wire with the given spline
        /// </summary>
        /// <param name="connectionSpline"> the spline to slide on</param>
        /// <param name="bendingAngle">the angle of our future elbow</param>
        /// <param name="bendingRadius"> the radius of the elbow</param>
        /// <param name="n">modifies the number of triangles</param>
        /// <param name="shift">makes the shape begin before 0*pi/180 and end after bendingAngle, we use it to hollow correctly the shape (put 0 for the external part, and something like pi/16 for the internal part)</param>
        /// <returns>the shape of the elbow (external or internal part)</returns>
        public TopoDS_Shape Build(Geom_BSplineCurve connectionSpline, double bendingAngle, double bendingRadius, double n, double shift)
        {
            bool firstIteration = true;                                        // check if it is the first iteration
            BRepBuilderAPI_MakeWire aMakeWire = new BRepBuilderAPI_MakeWire(); // initialize our wire
            gp_Pnt lastPnt = new gp_Pnt();                                     // initialize our last point

            double angle      = bendingAngle * Math.PI / 180;                  // our angle in radian
            double lp         = connectionSpline.LastParameter();              // often 1
            double fp         = connectionSpline.FirstParameter();             // often 0
            double percentage = (angle + 2 * shift) / (2 * Math.PI);           // percentage of the spline to get ( because our spline goes from 0 to 2pi, but we dont want all)
            double pas        = (lp * percentage - fp) / n;                    // the step for the iteration on the spline

            for (double i = fp; i < lp * percentage; i = i + pas)              // fp already includes the small shift if it got any
            {
                if (firstIteration)
                { // we get our first point
                    lastPnt        = connectionSpline.Value(i);
                    firstIteration = false;
                }
                else
                { // and now we add a new edge(last point, current point) on our wire
                    aMakeWire.Add(new BRepBuilderAPI_MakeEdge(lastPnt, connectionSpline.Value(i)).Edge());
                    lastPnt = connectionSpline.Value(i);
                }
            }

            // create the pipe with the spline and the section
            TopoDS_Wire W = MakeWire(bendingRadius);                                                 // the face to be slided
            BRepOffsetAPI_MakePipeShell   piper = new BRepOffsetAPI_MakePipeShell(aMakeWire.Wire()); // initialize with the wire to slide on
            BRepBuilderAPI_TransitionMode Mode  = new BRepBuilderAPI_TransitionMode();

            Mode = BRepBuilderAPI_TransitionMode.BRepBuilderAPI_RoundCorner;
            piper.SetTransitionMode(Mode); // to have a curved shape
            piper.Add(W, true, true);      // first= true to get a pipe and not something else really weird
            piper.Build();                 // create the shape
            piper.MakeSolid();             //*/
            return(piper.Shape());
        }
Example #4
0
 public Geom_BSplineCurve SplitBSplineCurve(Geom_BSplineCurve C, double FromU1, double ToU2,
                                            double ParametricTolerance)
 {
     throw new NotImplementedException();
 }
Example #5
0
 public Geom_BSplineCurve SplitBSplineCurve(Geom_BSplineCurve C, int FromK1, int ToK2, bool SameOrientation)
 {
     throw new NotImplementedException();
 }
Example #6
0
 public Geom_BSplineCurve SplitBSplineCurve(Geom_BSplineCurve C, int FromK1, int ToK2)
 {
     throw new NotImplementedException();
 }
Example #7
0
 public void C0BSplineToC1BSplineCurve(Geom_BSplineCurve BS, double tolerance)
 {
     throw new NotImplementedException();
 }
Example #8
0
 public void C0BSplineToArrayOfC1BSplineCurve(Geom_BSplineCurve BS, TColGeom_HArray1OfBSplineCurve tabBS,
                                              double AngularTolerance, double tolerance)
 {
     throw new NotImplementedException();
 }
Example #9
0
 public TColGeom_Array1OfBSplineCurve(Geom_BSplineCurve theBegin, int theLower, int theUpper)
     : base()
 {
     throw new NotImplementedException();
 }
 public void Init(Geom_BSplineCurve C1, Geom_BSplineCurve C2, GeomFill_FillingStyle Type)
 {
     throw new NotImplementedException();
 }
Example #11
0
 public Geom2d_BSplineCurve Solution(Geom_BSplineCurve BS, double TolPoles)
 {
     throw new NotImplementedException();
 }
Example #12
0
 public void Solutionbis(Geom_BSplineCurve BS, ref double Knotmin, ref double Knotmax)
 {
     throw new NotImplementedException();
 }
Example #13
0
 public void Add(Geom_BSplineCurve FirstCurve, Geom_BSplineCurve SecondCurve, bool After, bool WithRatio,
                 int MinM)
 {
     throw new NotImplementedException();
 }
 public GeomConvert_BSplineCurveToBezierCurve(Geom_BSplineCurve Bas_isCurve)
     : base()
 {
     throw new NotImplementedException();
 }
Example #15
0
 public void Init(Geom_BSplineCurve theValue)
 {
     throw new NotImplementedException();
 }
Example #16
0
 public TColGeom_HArray1OfBSplineCurve(int theLower, int theUpper, Geom_BSplineCurve theValue)
     : base()
 {
     throw new NotImplementedException();
 }
Example #17
0
 public void SetValue(int theIndex, Geom_BSplineCurve theItem)
 {
     throw new NotImplementedException();
 }
 public void FixTangentOnCurve(Geom_BSplineCurve theCurve, bool FirstFlag, bool LastFlag)
 {
     throw new NotImplementedException();
 }
 public GeomLib_CheckBSplineCurve(Geom_BSplineCurve Curve, double Tolerance, double AngularTolerance)
     : base()
 {
     throw new NotImplementedException();
 }
 public GeomConvert_BSplineCurveToBezierCurve(Geom_BSplineCurve Bas_isCurve, double U1, double U2,
                                              double ParametricTolerance)
     : base()
 {
     throw new NotImplementedException();
 }
Example #21
0
 public void ApproxBSplineCurve(Geom_BSplineCurve bspline, TColGeom_SequenceOfCurve seq)
 {
     throw new NotImplementedException();
 }
Example #22
0
 public Geom2d_BSplineCurve Solution(Geom_BSplineCurve BS)
 {
     throw new NotImplementedException();
 }
Example #23
0
 public bool C0BSplineToSequenceOfC1BSplineCurve(Geom_BSplineCurve BS, TColGeom_HSequenceOfBoundedCurve seqBS)
 {
     throw new NotImplementedException();
 }
Example #24
0
 public GeomConvert_BSplineCurveKnotSplitting(Geom_BSplineCurve Bas_isCurve, int ContinuityRange)
     : base()
 {
     throw new NotImplementedException();
 }
 public GeomFill_BSplineCurves(Geom_BSplineCurve C1, Geom_BSplineCurve C2, GeomFill_FillingStyle Type)
     : base()
 {
     throw new NotImplementedException();
 }