+ NCollection_Sequence<Bnd_Box> BBs;
+ //try to find the largest bbox
+ for (int i = 1; i <= allWires.Size(); i++)
+ {
+ TopoDS_Wire W = allWires(i);
+ Bnd_Box BB;
+ BRepBndLib::AddClose(W, BB);
+ BBs.Append(BB);
+ }
+ for (int i = 1; i <= BBs.Size(); i++)
+ {
+ bool IsIn = false;
+ for (int j = 1; j <= BBs.Size(); j++)
+ {
+ if (i == j)
+ continue;
+ Standard_Real iXmax, iXmin, iYmax, iYmin, z0, z1;
+ Standard_Real jXmax, jXmin, jYmax, jYmin;
+ BBs(i).Get(iXmin, iYmin, z0, iXmax, iYmax, z1);
+ BBs(j).Get(jXmin, jYmin, z0, jXmax, jYmax, z1);
+ if (!(iXmin > jXmin &&
+ iYmin > jYmin &&
+ iXmax < jXmax &&
+ iYmax < jYmax))
+ IsIn = true;
+ }
+ if (IsIn)
+ {
+ OutWIndex = i;
+ break;
+ }
+ }