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.
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: