
Wed, 07/27/2016 - 05:30
I'm starting to use OpenCascade, and of course learning as I go. I'm successfully loading STEP files and exampining the toploogy.
OpenCascade is clearly a very powerful system. But I'm not sure of the difference between the various classes I'm using.
For instance, what is the difference between the class Geom_Plane and the class gp_Pln? (Or between Geom_CylindricalSurface and gp_Cylinder)?
Geom_Plane contains a gp_Pln. But it seems you do some operations on the Geom_Plane and some on the gp_Pln
What is the difference/relationship between Geom_Plane and gp_Pln? They both contain a method 'Axis()'
When should you use Geom_Plane, and when gp_Pln?
Is there any documentation on this? I have looked, but without success . Perhaps I'm looking in the wrong place.
My (working!) loading code is below.
void MyClass::GetShapeInfo(const TopoDS_Shape& aShape)
{
//Get all faces in the shape with an explorer
for (TopExp_Explorer aFaceExplorer(aShape, TopAbs_FACE); aFaceExplorer.More(); aFaceExplorer.Next())
{
TopoDS_Face aFace = TopoDS::Face(aFaceExplorer.Current());
//Get surface from face
Handle(Geom_Surface) aSurface = BRep_Tool::Surface(aFace);
//Get the type of the surface
Standard_CString surfaceName = aSurface->DynamicType()->Name(); //!!jw**
// Handle different surface types.
if (aSurface->DynamicType() == STANDARD_TYPE(Geom_Plane))
{
Handle(Geom_Plane) aPlane = Handle(Geom_Plane)::DownCast(aSurface);
//Get plane's normal
gp_Dir norm = aPlane->Pln().Axis().Direction();
Thank you very much
Wed, 07/27/2016 - 10:28
Hello Jim,
I guess gp_* are "lightweght" geometric classes, that is they do not derive from a smart pointer - like class, so
they are suitable for geometric computations that not involve topology. For example, gp_Pln is suitable to compute
a mean plane of a cloud of points.
Geom_* surfaces, instead, can be shared by smart pointers, so they are more suitable to be used as data member
of topological classes like TopoDS_Face.
Best Regards.
Mario Mancusi
Sat, 05/23/2020 - 10:37
Thanks for your answer!
Wed, 07/27/2016 - 12:04
That's true. Classes from gp form the geometric "language" of the library (gp = geometric primitive). Classes from Geom and Geom2d are designed to participate in B-Rep models (that is, to be shared).
Wed, 07/27/2016 - 23:19
Thank you, that's very helpful.
Jim
Wed, 07/27/2016 - 23:36
Where is the best place to research this sort of thing, in the documentation or elsewhere? I have looked at the documentation, but couldn't find an answer to this question.
Thanks,
Jim
Wed, 07/27/2016 - 23:54
This forum is a pretty nice knowledge database which you can use to search. And, of course, just keep asking questions, so that you and others will benefit from the conversations which would follow. There are actually TONS of subtleties which you will never find in the documentation, and will unlikely figure out by yourself without a hint from the community. This library is very complicated, but also very challenging. Have fun!