How to convert a Handle(Geom_BSplineSurface) to Handle(Geom_Surface) ?

Hello everybody,

How to convert a Handle(Geom_BSplineSurface) to Handle(Geom_Surface) ?

It seems that it used to be possible, but not anymore (I'm using OCCT 7.1.0).

Thank you!

Fernando

Forum supervisor's picture

Hello Fernando,

This problem looks strange, because such conversion should be possible in all versions.

Can you share a piece of code that does not work?

Thanks in advance!

Forum supervisor

Fernando Ghedin's picture

Hello, 

The snippet is available here => https://gist.github.com/ghedin/c2481a6d255bd5d09f13561e8471490b

Maybe I'm missing something pretty basic, but as you can see, I'm just giving a Handle(Geom_BSplineSurface) to the BRepBuilderAPI_MakeFace constructor with this signature:

BRepBuilderAPI_MakeFace(const Handle(Geom_Surface)& S, const Standard_Real TolDegen);

As per the compiler error, a reinterpret_cast is needed - but that didn't help either.

Any advice would be truly appreciated.

Thank you!

Fernando

Kirill Gavrilov's picture

Make sure that you have included Geom_BSplineSurface definition (e.g. #include <Geom_BSplineSurface.hxx>).
It is possible to make a forward declaration of Geom_BSplineSurface and Handle(Geom_BSplineSurface), but to use the inheritance information the class definition should be available to compiler.

Fernando Ghedin's picture

Hello Kirill, yes, the include was missing blush.

Thank you very much for your help.