Difference between BRepAlgo_ and BRepAlgoAPI_

What's the difference between (for example) BRepAlgo_Cut and BRepAlgoAPI_Cut?

I've been reading the documentation and it isn't clear and in my simple example, both seem to work.


Rob Bachrach's picture

BRepAlgo_XXX is left over from older versions of OCC, primarily for legacy applications. BRepAlgoAPI_XXX are newer versions that the developers claim are more robust, reliable, and quicker than the older versions. In my personal experience, the newer versions do work more often, but there are occasional cases where the newer version may not work, but the older one does. In general, you should be using the BRepAlgoAPI_XXX forms in your code.


Svetlozar Kostadinov's picture

Rob, do you know how to glue resultant coplanar faces? I read that BRepAlgo_XXX do this automatically, but BRepAlgoAPI does not. I tried different approaches, but failed.

Rob Bachrach's picture

Actually, they both handle coplanar faces. However, they both sometimes have problems. If 2 coplanar faces are adjacent, they are sewed to share a common edge. If they intersect, the common area is separated out and treated as necessary (for cut, fuse, etc). If they are coincident, they are removed. The operations will not remove the common edge to form a single face. It simply "glues" or sews them together.

Note however, that the OCC boolean operations do often have problems with coincident faces. We have several workarounds in our code, but it is not perfect.

Svetlozar Kostadinov's picture

Ok, consider one of the simplest cases: http://www.picvalley.net/v.php?p=u/1334/1512837010.PNG

These are 2 fused boxes. I'd like the coincident faces to be merged without the common edges. Do you know how to do this?

Rob Bachrach's picture

The boolean operations will only create shared edges, but will not remove them. There is no built in functionality to do this for you, you need to do it yourself. You usually do this by creating a new shell, adding most faces, but combining coplanar ones.

Try typing "coplanar face" into the forum search. You should see several threads trying to address the task.

Svetlozar Kostadinov's picture

Thank you, Rob!

c-riddell's picture

Thanks for the information. Is this documented anywhere?

Here's another that confuses me. How do these differ:


Rob Bachrach's picture

I'm not sure how well I can describe this, but I'll give it a shot:
- GC_MakeCylindricalSurface provides algorithms for constructing a Geom_CylindricalSurface.
- The Geom_CylindricalSurface is the actual geometry for the 3D surface. It allows you to operate on the surface, create topological shapes, and query values like points and derivatives.
- The gce_MakeCylinder provides algorithms for constructing a gp_Cylinder. This is the pure mathematical representation of a cylinder. You can use this yourself for basic cylinders. It is also used internally by the Geom package.


Mauro Mariotti's picture

On http://www.opencascade.org/org/forum/thread_19766/?forum=3 ,
PeterZ advises to use BRepAlgo_Section instead of BRepAlgoAPI_Section.

We currently use BRepAlgoAPI_XXX for boolean operations between solids
and BRepAlgo_Section to find intersection curves between faces.

What is the best thing to do?


Pawel's picture

Hello Mauro,

I think I still have a section of code where I use the old BOPs (BRepAlgo_XXX) because they do better (as far as I can remember for cutting a curve with a plane) because they do give a result (BRepAlgoAPI_XXX did not give any). But I haven't tested that with the refactored new BOPs.

Before, in some cases BRepAlgo_XXX were more stable (giving a result which was not necessarily correct - but not crashing!) but I don't think this applies to the current refactored version.