Archived issue #0030825
Crash during use BRepOffsetAPI_MakePipeShell
Description
I got a crash at the time when I expect a result or an error message when using BRepOffsetAPI_MakePipeShell for attached input data.
Steps to reproduce
1. Download Attachment 1 (BREP) and put it into ${opencascade-7.3.0}\data\occ
2. Replace corresponding method in ${opencascade-7.3.0}\samples\mfc\standard\02_Modeling\src\ModelingDoc.cpp
void CModelingDoc::OnPipe()
{
AIS_ListOfInteractive aList;
myAISContext->DisplayedObjects(aList);
AIS_ListIteratorOfListOfInteractive aListIterator;
for(aListIterator.Initialize(aList);aListIterator.More();aListIterator.Next()){
myAISContext->Remove (aListIterator.Value(), Standard_False);
}
// Read arguments
TopoDS_Shape compound;
{
std::filebuf aFileBuf;
std::istream aStream(&aFileBuf);
CString tool_file;
tool_file.GetEnvironmentVariable(L"CSF_OCCTDataPath");
tool_file += "\\occ\\Attachment 1 (BREP)";
if(!aFileBuf.open(tool_file, ios::in))
{
AfxMessageBox(L"File not found");
return;
}
BRep_Builder aBuilder;
BRepTools::Read(compound, aStream, aBuilder);
}
std::vector<TopoDS_Shape> path_profile;
for(TopoDS_Iterator exp(compound); exp.More(); exp.Next())
{
path_profile.push_back(exp.Value());
}
if(path_profile.size() != 2)
{
AfxMessageBox(L"Invalid number of arguments");
return;
}
TopoDS_Shape path = path_profile[0];
{
Handle(AIS_Shape) ais = new AIS_Shape(path);
myAISContext->SetColor(ais, Quantity_NOC_GREEN, Standard_False);
myAISContext->Display(ais, Standard_False);
Fit();
Sleep(1000);
}
TopoDS_Shape profile = path_profile[1];
{
Handle(AIS_Shape) ais = new AIS_Shape(profile);
myAISContext->SetColor(ais, Quantity_NOC_MATRABLUE, Standard_False);
myAISContext->Display(ais, Standard_False);
Fit();
Sleep(1000);
}
TopoDS_Wire path_wire = TopoDS::Wire(path);
BRepOffsetAPI_MakePipeShell sweep(path_wire);
TopExp_Explorer exp(path, TopAbs_EDGE);
TopoDS_Vertex vertex = TopExp::FirstVertex(TopoDS::Edge(exp.Current()), Standard_True);
sweep.SetTransitionMode(BRepBuilderAPI_TransitionMode::BRepBuilderAPI_RightCorner);
sweep.Add(profile, vertex, Standard_False, Standard_False);
sweep.Build();
}
2. Replace corresponding method in ${opencascade-7.3.0}\samples\mfc\standard\02_Modeling\src\ModelingDoc.cpp
void CModelingDoc::OnPipe()
{
AIS_ListOfInteractive aList;
myAISContext->DisplayedObjects(aList);
AIS_ListIteratorOfListOfInteractive aListIterator;
for(aListIterator.Initialize(aList);aListIterator.More();aListIterator.Next()){
myAISContext->Remove (aListIterator.Value(), Standard_False);
}
// Read arguments
TopoDS_Shape compound;
{
std::filebuf aFileBuf;
std::istream aStream(&aFileBuf);
CString tool_file;
tool_file.GetEnvironmentVariable(L"CSF_OCCTDataPath");
tool_file += "\\occ\\Attachment 1 (BREP)";
if(!aFileBuf.open(tool_file, ios::in))
{
AfxMessageBox(L"File not found");
return;
}
BRep_Builder aBuilder;
BRepTools::Read(compound, aStream, aBuilder);
}
std::vector<TopoDS_Shape> path_profile;
for(TopoDS_Iterator exp(compound); exp.More(); exp.Next())
{
path_profile.push_back(exp.Value());
}
if(path_profile.size() != 2)
{
AfxMessageBox(L"Invalid number of arguments");
return;
}
TopoDS_Shape path = path_profile[0];
{
Handle(AIS_Shape) ais = new AIS_Shape(path);
myAISContext->SetColor(ais, Quantity_NOC_GREEN, Standard_False);
myAISContext->Display(ais, Standard_False);
Fit();
Sleep(1000);
}
TopoDS_Shape profile = path_profile[1];
{
Handle(AIS_Shape) ais = new AIS_Shape(profile);
myAISContext->SetColor(ais, Quantity_NOC_MATRABLUE, Standard_False);
myAISContext->Display(ais, Standard_False);
Fit();
Sleep(1000);
}
TopoDS_Wire path_wire = TopoDS::Wire(path);
BRepOffsetAPI_MakePipeShell sweep(path_wire);
TopExp_Explorer exp(path, TopAbs_EDGE);
TopoDS_Vertex vertex = TopExp::FirstVertex(TopoDS::Edge(exp.Current()), Standard_True);
sweep.SetTransitionMode(BRepBuilderAPI_TransitionMode::BRepBuilderAPI_RightCorner);
sweep.Add(profile, vertex, Standard_False, Standard_False);
sweep.Build();
}
Public activity
2 archived notes
Participants are labeled by their role within this record.
Fixed in 7.4.0
Then I propose to close it.