
Wed, 11/26/2008 - 23:10
Forums:
here is the code where we try to select a face and get its bounds!
Standard_Real umin,umax,vmin,vmax;
TopoDS_Face face;
myAISContext->InitSelected();
if (myAISContext->MoreSelected())
{
face = TopoDS::Face(myAISContext->SelectedShape());
}
BRepTools::UVBounds(face,umin,umax,vmin,vmax);//here the code breaks during run-time.
Fri, 11/28/2008 - 19:42
Note sure if it is the root-cause but anyway... To make your code safe, you need to check what you get as a selected object. It may be not the face or even not the shape (TopoDS_Shape) at all.
if (!face.IsNull()) {
BRepTools::UVBounds(face,umin,umax,vmin,vmax);
}
Hope this will be helpful.
---
opencascade.blogspot.com - blog on Open CASCADE
Mon, 12/01/2008 - 10:15
Actually, it'd be also good to check in that "if" condition for myAISContext->HasSelectedShape(). As long as the face is NOT NULL, it should work (it does for me, and I actually use that a lot).