Surface modeling. Part2

Sweep surfaces
Sweep surfaces are constructed using a spine and a profile that moves along it.
Here is a screenshots of a typical sweep surfaces:

The sweep surface is constructed using GeomFill_Pipe. Perhaps the name pipe stems from the fact that a particular case when the profile is closed produces a pipe-like surface.

GeomFill_Pipe Pipe;
GeomFill_Pipe aPipe (aPath, aProfile, GeomFill_IsFixed);
aPipe.Perform(aTol, Standard_False, GeomAbs_C1, BSplCLib::MaxDegree(), 1000);
const Handle(Geom_Surface)& aSurface = aPipe.Surface();

This code is an excerpt from the CAD Exchanger, the translation driver for ACIS sum_spl_sur, which is defined as a sum of two curves.

By default, the sweep surface is created as a B-Spline, either rational or polynomial – depending on the parameter in the Perform() method. If you want to generate elementary surface (torus, cylinder, sphere, etc) when curves configuration allows, then call GenerateParticularCase() with Standard_True.

The algorithm can also return an approximation error – use ErrorOnSurf() to get it.

Sweeping is constructed dragging a profile along the spine and modifying its orientation along the latter. This behavior is controlled by a parameter of the type GeomFill_Trihedron. The following images illustrate how resulting surface is different for the same spine and profile (semi-circles):




You can experiment in DRAW using the 'sweep' command and providing various options.

GeomFill_Pipe offers a few pre-defined construction techniques to construct a sweep surface:
- a pipe with constant section;
- a circular section pipe with constant radius;
- a circular section pipe with constant radius with two rails.

Pipes with constant section has been considered above. Here are two more examples of such pipes:

To be continued...


  1. Terrific! So happy your stepping into the modelling algorithms Roman...
    A few questions & a request though:

    1) Is there a reason to prefer the GeomFill_* classes over say BRepOffsetAPI_MakePipe

    2) A true gem to me seems the BRepOffsetAPI_MakePipeShell class, where many additional options as well a different start / end curve of the sweep can be specified. Would you be willing to elaborate on this class, so far it seemed to cover a lot of territory...

    thanks for this blog Roman, happy to see you back!

  2. Hi jelle,
    Thanks for a comment. As mentioned, in post 1 there are usually 2 APIs - one at geometrical level and the other at topological. So, GeomFill is the former while BRepOffsetAPI_MakePipe is the latter. Meanwhile, for ACIS importer, I have been using only GeomFill. Let me look into BRepOffsetAPI to see what it adds beyond usual convenience of dealing with TopoDS_* instead of Geom_*.

  3. Roman, I'm so happy to have found your site. What a great resource!

    These last couple posts really piqued my interest. On the subject of ruled surfaces, I'm interested in modelling with developable surfaces.

    In particular, it would be nice to start with a space curve, and then generate a developable surface by rulings along the Darboux vector (equal to the torsion times the unit tangent plus the curvature times the binormal). Is there a way to do this in OpenCascade? Or any other options for generating developables?

    I am also trying to sort out how to "unroll" the resulting developable -- any tips would be greatly appreciated.

    Again, I'm so grateful for this site -- OCC is an awesome library, though it's sheer size and complexity has been daunting. It's very nice to meet a human being behind the code.

    Kevin Atkinson
    kevin dot atkinson at gmail dot com

  4. Hi Kevin, welcome on board!
    I have not been diving into very deep details of sweeping algorithms in Open CASCADE, so can't say for sure up front. However, as I mentioned there is an option that controls the trihedron orientation when moving along the spine.
    Check the 'sweep' command in DRAWEXE:
    sweep : sweep result [options] path [Surf] curve [Tol [nbsegment]]
    sweep the the curve along the path, options are
    -FX : Tangent and Normal are fixed
    -FR : Tangent and Normal are given by Frenet trihedron
    -CF : Tangente is given by Frenet,
    the Normal is computed to minimize the torsion
    -DX : Tangent and Normal are given by Darboux trihedron
    'path' have to be a 2d curve,
    'Surf' have to be defined
    -CN dx dy dz : Normal is given by dx dy dz

    to see if this fits your expectations.
    Anyway, if not there is a way to have more fine-grain control though it is a bit challenging. GeomFill_Pipe internally uses GeomFill_Sweep that uses subclasses of _SectionLaw and _LocationLaw. In Part3 I showed how I created a variable radius tube. I guess this path can be followed to create arbitrary sweeps.

    Not sure if I got a 2nd part of the question - about "unrolling". As any developable surface is originally a part of plane [umin, umax; vmin,vmax] and a surface is just a transformation of that region. So for sweeps, u is along the section and v is along the spine/path.

    Regarding the size, a 3D modeling kernel has to be complex and big enough to be powerful ;-). OCC is relatively well-structured, so you should be able to figure out what you don't need at least ;-).
    Hope this helps!
    Good luck.