OpenCascade判断曲面类型
OpenCascade版本:7.5
在读取STEP、IGES等格式的文件所表示的B-rep模型后,若想进行进一步的处理或计算,首先需要能正确识别出其中的实体和曲面。下面给出判断模型中曲面类型的示例:
for (TopExp_Explorer anExpSF(shape, TopAbs_FACE); anExpSF.More(); anExpSF.Next())
{
const TopoDS_Shape& aFace = anExpSF.Current();
faceNumber++;
TopoDS_Face face = TopoDS::Face(aFace);
BRepAdaptor_Surface BS(face, Standard_True);
GeomAdaptor_Surface AdpSurf = BS.Surface();
if (AdpSurf.GetType() == GeomAbs_Cylinder)
{
// Cylinder face found
}
else if (AdpSurf.GetType() == GeomAbs_Plane)
{
// Plane face found
}
else if (AdpSurf.GetType() == GeomAbs_Sphere)
{
// Sphere face found
}
}
支持的类型有:
GeomAbs_Plane , GeomAbs_Cylinder , GeomAbs_Cone , GeomAbs_Sphere ,
GeomAbs_Torus , GeomAbs_BezierSurface , GeomAbs_BSplineSurface , GeomAbs_SurfaceOfRevolution ,
GeomAbs_SurfaceOfExtrusion , GeomAbs_OffsetSurface , GeomAbs_OtherSurface
官方文档:
https://dev.opencascade.org/doc/refman/html/_geom_abs___surface_type_8hxx.html
参考资料:
http://www.cppblog.com/mythma/archive/2008/05/29/51527.html