Test if my selection is a circle

I would like to know how to make out a will if my selection is a circle:
I get back my selection in this way:

TopoDS_Shape m_selectShape = context->SelectedShape();

How can it be done?

Thank you

Marco Matt's picture

If you are sure that the selection is an edge...

BRepAdaptor_Curve adaptor(TopoDS::Edge(m_selectShape));
if ( adaptor.GetType() == GeomAbs_Circle )
{
...
}

duduch24's picture

I've tried it but i have an error at the function "BrepAdaptor_Curve" : TopoDS isn't a class...

Paul Jimenez's picture

#include ?

duduch24's picture

Thank you i'm sorry it's a stupid error.
But when i select the circle an error is generated at line :
TopoDS_Shape m_selectShape = context->SelectedShape();
Have you an idea ?

Thank you for your help

Paul Jimenez's picture

Try it like this:

context->InitSelected();

if (context->MoreSelected() && context->HasSelectedShape())
{
TopoDS_Shape m_selectShape = context->SelectedShape();
// ...
}

duduch24's picture

Thank you already i can compile and execute, i have a question : when i select my circle i have just 3/4 of circle selectionned and that's why what my function does not identify a circle.

duduch24's picture

Do not take into account the previous message, it works very well.

On the other hand I have a small problem, my messagebox appears and disappears at once.