How to sweep an rigid body?

I want to generate the volume which is covered by a body swept along a given path. In subsequence, my target is to subtract this covered volume from another solid.

To trace the path, I tried:

TColgp_Array1OfPnt pos(1, pnr);
TColgp_Array1OfPnt auxPos(1, pnr);
TColStd_Array1OfReal t(1, pnr);
TopoDS_Shell body = BRepPrimAPI_MakeBox( gp::XOY(), 10.0, 15.0, 20.0 ); // shell, solid or if necessary 3D-wire are possible

GeomAPI_PointsToBSpline spine(pos, t, 1, 8, GeomAbs_C0, 1.0e-6);
GeomAPI_PointsToBSpline auxSpine(auxPos, t, 1, 8, GeomAbs_C0, 1.0e-6);

TopoDS_Wire spineWire = BRepBuilderAPI_MakeWire( BRepBuilderAPI_MakeEdge( spine.Curve() ));
TopoDS_Wire auxWire = BRepBuilderAPI_MakeWire( BRepBuilderAPI_MakeEdge( auxSpine.Curve() ));

const Standard_Boolean CurvilinearEquivalence = Standard_False;
BRepOffsetAPI_MakePipeShell makePipe( spineWire );
makePipe.SetMode (auxWire, CurvilinearEquivalence);
TopoDS_Shape trace = makePipe.Shape();

In the code above, the Add-operation fails with BRepFill_Section: bad shape type of section

I would be happy, if you could give me an hint, in which way I can trace the covered volume.

Naturally, I can transform the body at many position of the path and fuse the single positions (or subtract each position from the final target). But this discretization wouldn't be as smooth as aspired and furthermore it would require many boolean operations (see: Why Boolean Operations are so slooo...ooow [

Pawel's picture

Hi Volker,

I guess the function BRepOffsetAPI_MakePipeShell does not allow to sweep solids. The only possibility is to sweep a section(s). Probably that is why you get the 'bad shape type of section' message - at this point a wire/profile is expected.

Good luck!

Bearloga's picture

Hi Volker,
This task cannot be solved with pipe algorithm, as it accepts only wire/face as a section, not solid. To make body of motion of a solid, you need to develop your own algo.