Need example of using BRepOffsetAPI_MakePipeShell

I wish to make a solid by sweeping along a
trajectory. The two ends of the solid must be
two different faces. The two faces will have the
same general shape (i.e. same number of vertexes
and edges) but will have different dimensions.
From the documentation, I think that
BRepOffsetAPI_MakePipeShell is the appropriate
class, but I am not sure which options are
necessary. Do I need to set the law, do I need
to modify the mode, etc. Does anyone have an
example of how to use this class for what I am
trying to do? My other option is to manually
sweep each edge of the face with GeomFill_Pipe
and build the solid manually. I think this is
probably more work than is necessary (if it would
even work properly).

Any help would be greatly appreciated.

Jerome's picture

Hi,
I have the same problem. I solve a part of this problem giving a law and a face. With the face and the evolution law, the MakePipeShell create the pipe with the last face parallel to the start face and this is a problem for me, I want the last face perpendicular to the path.
Here under some code I've made (Win2000 / MFC). I hope it will help you.

Regards
Jerome.

/// Generate a shell having base section wbase along curve along
/// k is the parameter value at the end of the curve
//--------------------------------------------------------------------------------
TopoDS_Shape MyPipe( const TopoDS_Wire &wbase, const TopoDS_Wire &along, const double k )
{
ASSERT( ! along.IsNull() && ! wbase.IsNull() );

/// Calculate the length of the path
//----------------------------------
GProp_GProps lp;
BRepGProp::LinearProperties( along, lp );
double length( lp.Mass() );

/// Prepare the shell
//-------------------BRepOffsetAPI_MakePipeShell ps( along );

/// Create a linear law
//---------------------
Handle( Law_Linear ) ll = new Law_Linear;
ll->Set( 0.0, 1.0, length, k );

/// Create the section center point
//---------------------------------
//BRepBuilderAPI_MakeVertex MV( gp::Origin() );

/// Get the first and last point of the path
//------------------------------------------
TopoDS_Vertex pfirst, plast;

TopExp::Vertices( along, pfirst, plast );

/// Update the law parameters
//---------------------------
ps.SetLaw( wbase, ll, pfirst, Standard_False, Standard_False );

ps.Build();

return( ps.Shape() );
};

Rob Bachrach's picture

Well, I have something working. I am using the
default evolution law (which seems to give a
linear sweep). I originally had the same problem
with the orientation of the face. It seems that
as long as the segments of the spine remain
tangent to each other, the profile remains normal
to the spine. In our case, we had the luxury of
being able to insert small radii (arc segments)
whenever non-tangent segments met. This allows
the sweep to work as desired.

Rob

Jerome's picture

Hi, I try it but I don't obtain good result. The spline is use is an open polygon (obtained with MakePolygon), I convert it to a spline with BRepBuilderAPI_NurbsConvert.
The last section of the pipe is no more perpendicular to the spline curve ??? (maybe I made a mistake).
Jerome.

Rob Bachrach's picture

Sorry, one thing I forgot to mention...
When I assign the profiles to the vertices, I am
transforming them (translating and rotating) to
be normal to the curve at the start and end
points of my sweep. This may be part of your
problem.

I don't think it matters, but I am not using a
nurbs curve. I actually insert circular arcs
into my spine to make the segments tangent.

Hope this helps.

DU's picture

Hi,
I think you should try to utilize the method „BRepOffsetAPI_ThruSections“, this is more convenient building class for your destination.

Regards.
Du

Rob Bachrach's picture

Thanks for the advice, but if I understand
ThruSections, there is no trajectory. So, if
I wanted my shape to follow an arc path, I would
need to break the arc into many linear segments
with sections created at each point. This seems
like it could introduce quite a bit of error to
the final geometry and increase the time required
to generate it.

Thanks anyway,
Rob

Jerome's picture

That's why MakePipe is really interesting !
I you find a way to have the ending section perpendicular to the path. Please ask me !
Regards.

Rob Bachrach's picture

I need that to happen too. If anyone figures it
out, please post the solution. I will do the same.

DU's picture

Hi,

I know your destination for using the “BRepOffsetAPI_MakePipeShell”. But normally, you have to know the relationship between the law and the end face of your sweeping solid. There is a problem, how you define the translate function to generate your final shape (face). But if you utilize the method “BRepOffsetAPI_ThruSections”, you can define the different interpolated points on the trajectory, at which you can generate different wire (or profile, it has to satisfy the same number of edges for the WIRE), and then smoothly generate a sweep solid or sweep shell for your application. Actually, at first I want to use the pipe method, for the general application, it is useful, but for your project, it is not enough, I think.

I have finished the work as same as your proposed.

Regards,

Du