Using the results of BRepPrimAPI_Makexxx -functions outside the actual function

Hallo!! A happy New Year to everyone.

In my application I create some 3D-models with the functions BRepPrimAPI_Makexxx.
I can't find a way to save the results of this functions for further use in other functions outside the function in which I create them.

For example it is possible to create a handle for an instance of the class Geom_CartesianPoint and to use this handle in other functions of the programm. But for the BRepPrimAPI_Makexxx functions this does not work.

Can anyone give me an idea how to save the results for later use (display or use as input to further BRepPrimAPI_Makexxx functions).

Best regards and best thanks in advance.

Hans Bauer

Forum supervisor's picture

Hello Hans,
as you might know, there are two types of classes in Open CASCADE - ordinary classes (like TopoDS_Shape), and classes manipulated by handle (like Geom_CartesianPoint).
You correctly note that it is possible to pass handled object created inside some function outside of this function, by assigning to a handle.
But it is also easy to act similarly when dealing with ordinary classes, namely with TopoDS_Shape returned by BRepPrimAPI_Makexxx (that's the type they all return as a result). It can look like, for example :

TopoDS_Shape Function1 ()
{
//...
TopoDS_Shape S = BRepPrimAPI_Makexxx();
return S;
}

or

void Function2 (TopoDS_Shape& S)
{
//...
S = BRepPrimAPI_Makexxx();
}

Can this help you?
With best regards,
Forum Supervisor

h_bauer's picture

Thank you very much for your answer.

I use a similar solution now. I store the instances of BRepPrimAPI_Makexxx as class members of a own class. In this way I can use the instances within the whole class. This works very well for me.

Hans Bauer