Wed, 05/22/2013 - 13:45
Forums:
I use OCCT6.6 in my mfc project. Boolean operatoions are used, the codes are like this:
TopoDS_Shape box1 = BRepPrimAPI_MakeBox(30, 30, 30);
TopoDS_Shape box2 = BRepPrimAPI_MakeBox(gp_Pnt(0, 0, 10), 30, 30, 10);
box1 = BRepAlgoAPI_Cut(box1, box2);
a crash cased in BRepAlgoAPI_Cut which comes from NCollection_BaseAllocator::Free.
what's wrong about it?
Thx!
Wed, 05/22/2013 - 14:11
Hello Tom,
are you using 64bit Win7?
If so, there seems to be a problem with this configuration when using BOPs, see:
http://tracker.dev.opencascade.org/view.php?id=23855
Pawel
Wed, 05/22/2013 - 14:20
Hello Pawel,
Yes, i'm using 64bit Win7,is there any ways to fix this?
Thx!
Wed, 05/22/2013 - 14:24
FYI, i test my code in an empty project(not mfc), and it work well.
Wed, 05/22/2013 - 14:32
Do you use TBB? If so try disabling it (MMGT_OPT = 0 instead of MMGT_OPT = 2) - it helped in my case.
Wed, 05/22/2013 - 14:28
Where do i find the MMGT_OPT?
Wed, 05/22/2013 - 14:35
MMGT_OPT can be set using batch files or globally for the system. If it's not set then OCCT assumes it is '0'. But in the latter case your problem is other that the one reported as issue 23855...
Wed, 05/22/2013 - 15:01
Hello Pawel,
I add MMGT_OPT in environment variable and set to 1. But still there comes a error.
This time Standard_ConstructionError_Raise_if (D <= gp::Resolution(), "") case the problem in gp_Dir2d::gp_Dir2d
Wed, 05/22/2013 - 15:11
when i set MMGT_OPT to 1, does OCCT still need tbb?
when i remove tbb libs and dlls, the project cannot run any more and tells that lose tbb lib
Wed, 05/22/2013 - 16:52
Dear Tom,
If you don't need TBB at all you may rebuild OCCT defining variable HAVE_TBB as presented below:
set HAVE_TBB=false
Regards
Wed, 05/22/2013 - 15:33
Hi, Pawel
By the way, what's difference between BRepAlgo_Cut and BRepAlgoAPI_Cut ?
Thx!
Wed, 05/22/2013 - 16:02
Hi Tom,
- BRepAlgo_Cut is the old API (not really actively maintained, as I understand), BRepAlgoAPI_Cut is the new/current one
- if OCCT is compiled against TBB you still need the dlls to run although the do not get called
- I just ran a small script in DRAW to test your case:
box b1 30 30 30
box b2 0 0 10 30 30 10
cut result b1 b2
and I can't observe any problem with it...
Pawel
Wed, 05/22/2013 - 16:08
... oops, I used the old BOP (BRepAlgo_Cut) in the sample script.
the script should read:
box b1 30 30 30
box b2 0 0 10 30 30 10
bop b1 b2
bopcut result_new
Wed, 05/22/2013 - 16:40
Hello Pawel, i finaly found out the answer. I use D3D as render context, the D3D changes floating-point control word, so jst reset it. Anyway, Thank you very much!