Fixing the tolerances inside a shape


is there a way to recompute the tolerances of a shape and its subshapes, without doing a compleate repairing?
I need an algorithm which sets the tolerances of vertexes and edges to as small a value as is enough to cover the gaps.

My problem is the following.
I often have faces or solids which have high tolerances (0.001 or even 0.01), which make OpenCASCADE algoriths fail (boolean operations, etc.), but the real gaps are much smaller.
I was suggested to fix these shapes by setting all tolerances to 1.e-7 and then calling ShapeFix.
Maybe I will put this in an interactive command of my application, but it is too strong and risky to be applied automatically to every model, so I would like just to fix the tolerances without modifying curves, etc.

Thanks a lot.

Sébastien Raymond's picture


ShapeFix_ShapeTolerance::SetTolerance (const TopoDS_Shape &shape, const Standard_Real preci, const TopAbs_ShapeEnum styp=TopAbs_SHAPE)

Should help you to change the tolerance of your shape without repairing.


Mauro Mariotti's picture

Thank you for answering,

but ShapeFix_ShapeTolerance::SetTolerance sets a fixed (input) value in all subshapes.

I need a function which re-computes the tolerances, giving to each subshape the "right" tolerance value.

If it does not exist, I am afraid I will have to look inside the code of the ShapeFix package, to extract the tolerance computation.


Timo Roth's picture

Is there some news regarding recalculating the tolerances? Is also would be interested in it.