BRepGProp returns negative volume

Hi everyone,

I´ve created a volume from a set of wires defining a loft, a frontface and an opposite backface. The building steps were:

1.) generate 5 "Guiding-" Wires (each of them are non-closed)
2.) Build an open Shell from these Wires with BRepOffsetApi_ThruSections()
3.) Attach the Frontface and the opposite Backface with BRepApi_Sewing() to the open shell of step 2) to form a closed shell
4.) Build a volume from the shell with BRepBuilderApi_MakeSolid()

You can see the volume in the attached bitmap.
My problem is, that the use of BRepGProp on that volume leads a negative value.
I think, this has to do with some faces having a wrong orientation. I tried to flip the frontface and/or the backface (by changing the order of the underlying Points) but the volume still computed negative.

I would be very appreciated for any hints about this problem.

Best regards!

Attachments: 
Christian Fox's picture

It seems that all faces have a wrong orientation: the edges of each face are ordered in clockwise order. But how can I control/change that ordering when I build the Shell with BRepOffsetApi_ThruSections() ???

Cauchy Ding's picture

Hi Christian,

I think that's the problem of your solid direction instead of this loft API. You can call API BRepClass3d_SolidClassifier to judge whether this solid is inward or outward. If it's outward, just call shape.Reverse() to reverse the solid direction for getting correct volume.

BRepClass3d_SolidClassifier classify;
classify.Load(solid);
classify.PerformInfinitePoint(1.0e-4);
TopAbs_State state = classify.State();
if(state==TopAbs_IN)
return false;
else
return true;

Ding

Christian Fox's picture

Hi Cauchy,

Many thanks for your fast reply!

I´ve tried your solution and it works perfect!

Christian