Fixing the tolerances inside a shape

Hello,

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

Sébastien Raymond's picture

Hello,

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.

Sébastien

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.

Mauro

Timo Roth's picture

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

Jihui Cong's picture

ShapeFix_ShapeTolerance::SetTolerance does not really work
You can see the tolerance has been changed but old tolerance still be using in OCC APIs.
I think this is a bug

Dmitrii Pasukhin's picture

It possible only in magic way :)

Or internal bug :(

But SetTolerace set directly into shared object. Which parameters do you use for update tolerance? And which shape type have old tolerance values?

Best regards, Dmitrii.