How do i Know a Geom_BsplineSurface is a Base Surface or Trimmed Surface?

Dear all:
How do i Know a Geom_BsplineSurface is a Based Surface or Trimmed Surface? Is There any way to Judge it? Thanks

JJC's picture

I type wrong, What I want to know is TopoDS_Face not Geom_BsplineSurface.
Thanks.

ES's picture

TopLoc_Location l;
const Handle(Geom_Surface)& S = BRep_Tool::Surface(Face);
if (!S.IsNull()) {
BRepAdaptor_Surface S(Face,Standard_False);
GeomAbs_SurfaceType SurfType = S.GetType();
switch (SurfType) {
case GeomAbs_BSplineSurface :
printf("this is BSpline Surface");
break;
case OtherSurface... :
break;
}
}

JJC's picture

Thank you for your reply.
so... If the Surftype is GeomAbs_BSplineSurface, this means Face is not a Trimmed Surface? I want to Know: Is a TopoDS_Face a trimmed Surface?
Thanks you

ES's picture

const Handle(Geom_Surface)& S = BRep_Tool::Surface(Face);
Handle(Standard_Type) TheType = S->DynamicType();
if ( TheType == STANDARD_TYPE(Geom_Plane)) {
OS << Handle(Geom_Plane)::DownCast(S);
}
else if ( TheType == STANDARD_TYPE(Geom_CylindricalSurface)) {
OS << Handle(Geom_CylindricalSurface)::DownCast(S);
}
else if ( TheType == STANDARD_TYPE(Geom_ConicalSurface)) {
OS << Handle(Geom_ConicalSurface)::DownCast(S);
}
else if ( TheType == STANDARD_TYPE(Geom_SphericalSurface)) {
OS << Handle(Geom_SphericalSurface)::DownCast(S);
}
else if ( TheType == STANDARD_TYPE(Geom_ToroidalSurface)) {
OS << Handle(Geom_ToroidalSurface)::DownCast(S);
}
else if ( TheType == STANDARD_TYPE(Geom_SurfaceOfLinearExtrusion)) {
OS << Handle(Geom_SurfaceOfLinearExtrusion)::DownCast(S);
}
else if ( TheType == STANDARD_TYPE(Geom_SurfaceOfRevolution)) {
OS << Handle(Geom_SurfaceOfRevolution)::DownCast(S);
}
else if ( TheType == STANDARD_TYPE(Geom_BezierSurface)) {
OS << Handle(Geom_BezierSurface)::DownCast(S);
}
else if ( TheType == STANDARD_TYPE(Geom_BSplineSurface)) {
OS << Handle(Geom_BSplineSurface)::DownCast(S);
}
else if ( TheType == STANDARD_TYPE(Geom_RectangularTrimmedSurface)) {
OS << Handle(Geom_RectangularTrimmedSurface)::DownCast(S);
}
else if ( TheType == STANDARD_TYPE(Geom_OffsetSurface)) {
OS << Handle(Geom_OffsetSurface)::DownCast(S);
}
else {
aMsg <<"UNKNOWN SURFACE TYPE" <

JJC's picture

Thank you very much. Now I understand. Thank you.

Roman Lygin's picture

Please read Modeling Data User's guide to understand the concept.

A Face is a *topological* entity which limits *geometrical* entity Surface by adding a boundary represented by a Wire. a Wire is a *topological* entity which is a set of *topological* entities - Edges, which limit *geometrical* curves they lie on.

A face lying on a B-Spline surface must always have an explicit wire (or wires - if a face has holes). The latter may either correspond to some arbitrary contour lying on a surface or bounds of the B-Spline surface. In the latter case the face has NaturalRestriction flag turned on - BRep_Tool::NaturalRestriction (face) should return TRUE.

Hope this helps.

Roman Lygin

jelle's picture

very helpful Roman, valuable info... thanks...