Thu, 02/01/2024 - 22:41
Forums:
Hi geniuses! ;)
This code:
BRepAlgoAPI_Cut* cut = new BRepAlgoAPI_Cut(initialShape, appliedShape);
if (!cut->IsDone())
return false;cut->SimplifyResult();
sometimes just crash with access violation like this:
Exception thrown at 0x00007FFB21102D12 (TKBRep.dll) in cad.exe: 0xC0000005: Access violation writing location 0x0000000000000038.
How i can to avoid this crash and not kill all programm? Maybe i can catch some kind of signal or somehow pre-check that this algorithm will crash or that this algorithm does not have enough data... I don’t even know... Is it possible to somehow pre-prepare for this crash so that my function of extrusion/cut just return false, and not crash the entire software?
Fri, 02/02/2024 - 00:02
Hello, unfortunately we don't be able to help you with out a sample or file. Could you share?
Byt yes, you can use try/catch code on your side. Disabling exceptions not helps with unexpected acess.
Best regards, Dmitrii.
Fri, 02/02/2024 - 10:27
Dmitrii, hi!
It's very difficult to extract individual OCCT models from my CAD. Okay, I'll debug OCCT itself, I think it's just a bug inside, because this is not a regular exception that OCCT would specifically throw, this is a stupid attempt to write to a deleted pointer, that is, this is a bug.
Fri, 02/02/2024 - 12:13
Any TopoDS_Shape be able to exported into ".brep" format.
BRepTools::Write
Additionally, try{ code } catch(...) { code } can help. But not always. The best thing is resolve the bug.
Best regards, Dmitrii.
Fri, 02/02/2024 - 13:16
Dmitrii,
Access violation - fatal exception, try catch won't help here...
Hmm... ok, I caught the fall situation on two simple donuts, here they are in attachment (argument_shape.brep - this is the original solid body from which I want to cut out tool_shape.brep body with BRepAlgoAPI_Cut and after SimplifyResult() [access violation] ).
Hmm.. how can this help resolve the problem? Well, I see that the tool body does not have triangulation, but this is unlikely to be the case...
Fri, 02/02/2024 - 18:07
I can't not duplicate your crash here on debian bookworm with occt 7.8.0. It is strange that a crash would occur in SimplifyResult as there is nothing to simplify from that boolean operation. Maybe you are mixing debug and release builds on windows?
Fri, 02/02/2024 - 22:14
Hey man, where did you get 7.8.0 version? What is the correct link to the latest version of the sources on GitHub? This one? https://github.com/Open-Cascade-SAS/OCCT
Fri, 02/02/2024 - 22:49
Release V7_8_0 · Open-Cascade-SAS/OCCT (github.com)
Article: Open CASCADE Technology 7.8.0 released - Forum Open Cascade Technology
Fri, 02/02/2024 - 22:59
Thanks! I knew he was the one! But tell me please, why can’t I clone the latest sources from the official repository? Is access only available to contributors?
Sat, 02/03/2024 - 09:36
To load from our git you must to register your SSH key into dev portal in your profile.
To load anonimus you needs to read the next page: https://dev.opencascade.org/resources/git_repository
Best regards, Dmitrii.
Sat, 02/03/2024 - 10:26
Guys, good news!
I completely updated my soft to OCCT 7.8.0 (was 7.7.* i think, I build it a long time ago, I don’t even remember) and this bug with ACCESS VIOLATION at SimplifyResult() just disappeared!
Now everything works like a charm :)
Cool!
Thanks everyone for the information!