/// <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()); }
public void SetTransitionMode(BRepBuilderAPI_TransitionMode Mode) { throw new NotImplementedException(); }
public void SetOptions(BRepBuilderAPI_TransitionMode Style) { throw new NotImplementedException(); }
public void SetOptions(BRepBuilderAPI_TransitionMode Style, double AngleMin, double AngleMax) { throw new NotImplementedException(); }