Problem with surface normal


Hello everybody!

I am trying to find out the normal vectors in two planar surfaces. These surfaces construct the end parts of a blade turbine models (the uploaded image). Apparently, the surfaces normals are (-1,0,0) for the first one and (1,0,0) for the second.

The BRepLProp_SLProps.Normal() function responds (-1,0,0) for both of them. I checked these faces orientation and both of them were TopABS_FORWARD.

I've seen lots of threads in this topic but not a definite solution has been suggested by now. Is this a bug in OCC?

Any help is pre-appreciated

H. Parvaz

hadi.parvaz's picture

Dear friends

I found the solution!

A class named ShapeFix with a method ShapeFix_Shell can change the orientation of faces in a shell such that the all normal vectors are in the same directions. But still I couldn't approve that all of these normals are outwards! Any help in this purpose is well appreciated!

Mark Blome's picture

Dear hadi,

I stumbled over the same issue some time ago with ShapeFix_Shell fixing face orientations
sometimes in a way such that all face normals are pointing inwards.

The resulting shells are valid in OCC but their material is defined to be "outside" and hence
they have a negative volume.

BRepLib().OrientClosedSolid() should be used to correct this case (for the corresponding solids),
but apparently (and as documented in this forum) it suffers from a known bug.

For now my approach to deal with such cases is to check the solids volume and if necessary
reverse the orientation of the shell (or solid) (PythonOCC code):

if ShapeVolume(translatedsolid)<0.0:


def ShapeVolume(aShape):
props = GProp_GProps()
BRepGProp().VolumeProperties(aShape, props)
return props.Mass()

Dear Forum-Supervisor: Is BRepLib().OrientClosedSolid() the correct method to use in such cases and if so
is it true that it suffer from a known bug ? If it has a bug, which versions of OCC are affected ?


hadi.parvaz's picture

Dear Mark

Your suggestion was really constructive. I used this it in my project. Thanks man!

But for more information consider taking a look at this thread:

Best Regards

Mark Blome's picture

Dear Hadi,

thanks for the link! That's a good hint to use BRepClass3d_SolidClassifier
to test for this case. Certainly better than computing the shapes volume.

Looking at the source code of OrientClosedSolid reveals that it's
actually using BRepClass3d_SolidClassifier for it's purpose:

//function : OrientClosedSolid
//purpose :
Standard_Boolean BRepLib::OrientClosedSolid(TopoDS_Solid& solid)
// Set material inside the solid
BRepClass3d_SolidClassifier where(solid);
if (where.State()==TopAbs_IN) {
else if (where.State()==TopAbs_ON || where.State()==TopAbs_UNKNOWN)
return Standard_False;

return Standard_True;