the use of BRepTools_ReShape is very slow

Hello,
I want to remove a topods_shape from a localcontext but I don't I have not found a quick method.
I actually used this method to delete a vertex in myAISContext but it is very slow because I have many shape so I have to go through all the shapes that have to remove a vertex Vertex.

if (myAISContext->NbSelected()!=0)
{
std::vector vectTopoDsShape;
int i,modified;
TopExp_Explorer Ex;
for (myAISContext->InitSelected(); myAISContext->MoreSelected(); yAISContext->NextSelected())
{
vectTopoDsShape.push_back(myAISContext->SelectedShape());
}
BRepTools_ReShape aReshape;
for (myAISContext->InitSelected(); myAISContext->MoreSelected(); yAISContext->NextSelected())
{
modified=0;

if(vectTopoDsShape.size()!=0)
{
Handle(AIS_Shape) aisShape = andle(AIS_Shape)::DownCast(myAISContext->SelectedInteractive());
TopoDS_Shape aTopoDsShape=aisShape->Shape();
for(Ex.Init(aTopoDsShape,TopAbs_VERTEX); Ex.More(); Ex.Next())
{
i=0;
while((i {if(Ex.Current().IsEqual(vectTopoDsShape.at(i)))
{
aReshape.Remove(vectTopoDsShape.at(i));
vectTopoDsShape.erase(vectTopoDsShape.begin()+i);
modified=1;
break;
}
i++;
}
}
if(modified==1)
{
TopoDS_Shape aNewShape=aReshape.Apply(aTopoDsShape);
aisShape->Set(aNewShape);
myAISContext->Redisplay(aisShape);
}
}
}
}

Regards

JuryS's picture

I think your problem with using std::vector
It's no cool idea to use this method for OCC classes.

Try to use TopTools_ListOfShape