Open CASCADE, the 3D modelling kernel
3D modeling & numerical simulation

Open CASCADEShowroomGet it!Developer CornerSupport and ProductsAbout us
Technical overview
Areas of use
Advantages
FAQ
Screenshots
Shape factory
Shape gallery
Demonstrations
What's new
System requirements
Download Center
Public license
Documentation
Getting started
Forum
Open Source community
Training and e-learning
A la Carte Support
Value-added software
Complementary Components
Customer Corner
Company Profile
Marketing Materials
Contact Us
News
Home / Developer Corner / Forum / Failure to Cut box with halfspace that doesn't intersect box.

Forum

Failure to Cut box with halfspace that doesn't intersect box.
Michael Priestman2006/03/21 12:50
I'm having a problem with the BRepAlgoAPI_Cut operation. I'm trying to cut a box with a planar halfspace (i.e. just a single unbounded plane). The matter of the halfspace is entirely above the box, therefore the "cut" operation should do nothing and just return the box.

However, an exception is thrown in TopTools_IndexedMapOfShape::FindKey() (see call stack below), and so the entire operation fails with an error status of 101. The exception is thrown because the map is empty yet the caller is asking for the item with key 1.

I also get the same problem when I move the plane to be entirely below the box (in which case the box should be completely clipped).

Here is the code used to reproduce the problem:

// Build a box.

TopoDS_Shape theBox = BRepPrimAPI_MakeBox(gp_Pnt(0, 0, 0), gp_Pnt(5, 3, 8));

// Build a halfspace with the matter located "above" the plane.

gp_Ax3 ax(gp_Pnt(0.0, 0.0, 10.0), gp_Dir(0.0, 0.3, 1.0));
TopoDS_Face occ_face = BRepBuilderAPI_MakeFace(gp_Pln(ax));
BRepPrimAPI_MakeHalfSpace mhs(occ_face, gp_Pnt(0.0, 0.0, 20.0));
TopoDS_Shape theHalfSpace = mhs.Solid();

// Cut the box with the halfspace. Should result in the box being returned.

BRepAlgoAPI_Cut my_cut(theBox, theHalfSpace);
if(!my_cut.IsDone())
{
Standard_Integer error = my_cut.ErrorStatus();
return;
}
TopoDS_Shape ShapeCut = my_cut.Shape();

And here is the call stack showing exactly where the exception was thrown.

KERNEL32! 7c81eb33()
MSVCRTD! _CxxThrowException@8 + 57 bytes
Standard_OutOfRange::Throw() line 48
Standard_Failure::Reraise(char * const 0x100a4d38) line 76
Standard_OutOfRange::Raise(char * const 0x100a4d38) line 43
TopTools_IndexedMapOfShape::FindKey(const int 1) line 269 + 29 bytes
TopTools_IndexedMapOfShape::operator()(const int 1) line 91
BOPTools_StateFiller::ClassifyShapeByRef(const TopoDS_Shape & {...}, const TopoDS_Shape & {...}) line 126 + 10 bytes
BOPTools_SolidStateFiller::DoNonSections(const int 2) line 296 + 25 bytes
BOPTools_SolidStateFiller::Do() line 127
BOP_ShellSolid::Prepare() line 595
BOP_SolidSolid::DoWithFiller(const BOPTools_DSFiller & {...}) line 145
BRepAlgoAPI_BooleanOperation::Build() line 361
BRepAlgoAPI_Cut::BRepAlgoAPI_Cut(const TopoDS_Shape & {...}, const TopoDS_Shape & {...}) line 23
CTopologyOperationsDoc::OnCut() line 153 + 22 bytes

This looks like a bug in OpenCascade to me. I'm using version 5.2. Can anyone help with this issue?
 
 
Latest news
  • FAQ section updated
  • OPEN CASCADE Uses Intel ® Parallel Studio XE to Introduce Parallelism into SALOME SMESH Module
  • Open CASCADE Technology 6.5.2 is available for download!

  • © OPEN CASCADE 2000 - 2012  |  Search  |  Contacts   |  Site map