
Tue, 04/18/2023 - 11:01
Forums:
Hello everyone,
I use opencascade for my c# project and because of that I have a OCCTProxy like occt sample project.
I want to open holes on stl file. Firstly I import a stl file and create a cylinder which will be a hole on stl file. While cutting the my stl file, I got an error about System.AccessViolationException.
Do you know why I'm getting this error?
Error is: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
PS: I don't want to use legacy method StlAPI_Reader because when I import it, takes too much time.
TCollection_AsciiString theFileName = Utilities::ToAsciiString(inp); auto aTris = RWStl::ReadFile(theFileName.ToCString(), 0.1); auto face = TopoDS_Face(); auto aBuilder = BRep_Builder(); aBuilder.MakeFace(face, aTris); Handle(AIS_Shape) shape = new AIS_Shape(face); BRepPrimAPI_MakeCylinder holeMaker(position, holeRadius, 100); TopoDS_Shape holeTopoDsShape = holeMaker.Shape(); BRepAlgoAPI_Cut cutMaker(shape->Shape(), holeTopoDsShape); //error occurs TopoDS_Shape result = cutMaker.Shape();