iterate face

I want to get all the planes of a shape.But the explore can only iterate the faces.However,the face may be a curved face or a plane.How can I make this difference?

Any advices will be appreciated!

Stephane Routelous's picture

TopoDS_Face theFace = GetFaceFromIterator(); //pseudo-code
Handle_Geom_Surface theSurface = BRep_Tool::Surface(theFace);
if ( theSurface->IsKind(STANDARD_TYPE(Geom_Plane)))
{
//THIS IS A PLANE
}

this code will get you all the planes. But take care ! You could have a planar face describe as a BSpolineSurface for example !

HTH

t5vk8g's picture

Thanks for your earnest!
But IsKind() is not the method of TopoDS_Shape.
I use try{}catch{} to tell the user to select a flat plane.
I downcast Geom_Surface to Geom_Plane.If the surface is not a plane,the exception will be throwed!

t5vk8g's picture

Sorry!
You are right!

Best regards!