For all issues regarding the Forums use, please, refer to the Forum Rules.

Our Solutions

Need professional assistance?
Consider our:

Support Offerings


Need to speed up your development?
Have a look at our:

Samples & Tools


Need some functionality extending standard OCCT capabilities?
Check out our:

Adv. Components

AdvApprox_ApproxAFunction::Approximation returns with wrong error code.

Christian R. Krug's picture


I found a bug in AdvApprox_ApproxAFunction::Approximation(...). The last parameter of this function, namely 'ErrorCode', should propagate an error state if the approximation was not successfull.
But line 560 which read in OCC version 5.2
is now commented out
// pour l'instant ErrorCode=-1;

This has the effect that e.g. in Geom2dConvert_ApproxCurve the IsDone() method always returns true, even when the approximation did not succeed, i.e. when MaxError is greater than the specified Tol2d.

After I restored the original ErrorCode statement in AdvApprox_ApproxAFunction the Geom2dConvert_ApproxCurve behaves as it should: if MaxError > Tol2d, then IsDone() == Standard_False. So far I could not detect any side effects.

Kind regards, Kris.

Mauro Mariotti's picture

Forum supervisor,

this fix sounds right.
Has it been integrated in the official OCC ?


Forum supervisor's picture

Dear Mauro,
As I see this line (now it has number #575) is still commented out.
The previous description has no any reproducer.
But if you can reproduce it I suggest you to register the issue in Mantis Bugtracker which is available via the Collaborative portal -