DiscussionsIssue archiveModeling Data and Algorithms

Archived discussion

Suspect Volume Properties

Modeling Data and AlgorithmsWed, 10/16/2024 - 11:598 replies

Browse this forum
QuestionAuthor

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.

Author

Discussion

8 archived replies

Posts are displayed in their archived order.

01Commenter-1

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, Commenter-1.

02Author

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.

03Commenter-1

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, Commenter-1.

04Author

Thanks again Dmitrii!

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

05Commenter-2

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.

06Author

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

07Commenter-2

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
08Author

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