Suspect Volume Properties

Hi

I have an application where I receive data in an independent format and recreate the shape(s) via OpenCascade. However when using brepgprop.VolumeProperties it gives problematic answers. E.g. the attached file is intended to be a 10,000 x 10,000 x 10 square prism (and visually appears as such), but the volume properties gives a CoG of (5298.9, 5197.0, 5) and volume 793500000.

Any pointers would be appreciated.

Michael

Attachments: 
Dmitrii Pasukhin's picture

The issue probably because it is a BSpline. With some strage knots like 3.33333E+03. Could you please use not a BSpline geometry? In other scenario is better to use BRepBndLib::AddOptimal to have precise value for BBox. OR for volume you can use VolumePropertiesGK

Best regads, Dmitrii.

Michael Capocci's picture

Sadly we are passed the NURBS from another application.

The actual CoG is (5000,5000,50), volumeproperties reports (5298.9, 5197.0, 5) and volumepropertiesGK (0,0,5). Using a bounding box won't help with the volume of a curved solid.

I'm not sure where to go from here.

Dmitrii Pasukhin's picture

As an option, you can use IncMesh to generate mesh and extract the volume based on that mesh.

Standard_EXPORT static Standard_Real VolumeProperties (const TopoDS_Shape& S,
GProp_GProps& VProps, 
const Standard_Real Eps,
const Standard_Boolean OnlyClosed = Standard_False,
const Standard_Boolean SkipShared = Standard_False);

Additionally, you can play with eps.

Best regards, Dmitrii.

Michael Capocci's picture

Thanks again Dmitrii!

I don't know why, but using VolumePropertiesGK with IFlag=True solves this issue completely! Perfect results.

gkv311 n's picture

I don't know why, but using VolumePropertiesGK with IFlag=True solves this issue completely! Perfect results.

IFlag requests algorithm to compute matrix of inertia.

Michael Capocci's picture

Thanks for the info. Why this helps is a mystery....

gkv311 n's picture

There is also BRepGProp::VolumeProperties() that takes Eps parameter to specify desired maximum computation error of integration algorithm. Specify error below to 1.0 mm:

static Standard_Real    VolumeProperties (const TopoDS_Shape &S, GProp_GProps &VProps, const Standard_Real Eps, const Standard_Boolean OnlyClosed=Standard_False, const Standard_Boolean SkipShared=Standard_False)

In DRAW (eps=0.001mm):

pload MODELING XDE
testreadstep NAPA-OCX_M1.stp s
vprops s 0.001
Michael Capocci's picture

Eps doesn't seem to have a good effect for me.