- TopoDS_Shell S = TopoDS::Shell(its.Value());
- bu.Add(C, S); // add first shell to compound
- shellList.Remove(its);
- bool shellAdded = true;
- bool bigTolerance = false;
-
- while ((shellList.Extent() > 0) && shellAdded) {
- shellAdded = false;
- its.Initialize(shellList);
- for (; its.More(); its.Next()) {
- S = TopoDS::Shell(its.Value());
-
- // compare tolerance with shape's size
- Bnd_Box aBox;
- BRepBndLib::Add(S, aBox);
- Standard_Real Xmin, Ymin, Zmin, Xmax, Ymax, Zmax;
- aBox.Get(Xmin, Ymin, Zmin, Xmax, Ymax, Zmax);
- Standard_Real aTolerance = theTolerance;
- if (aBox.IsXThin(100. * aTolerance))
- aTolerance = 0.01 * (Xmax - Xmin);
- if (aBox.IsYThin(100. * aTolerance))
- aTolerance = 0.01 * (Ymax - Ymin);
- if (aBox.IsZThin(100. * aTolerance))
- aTolerance = 0.01 * (Zmax - Zmin);
- if (theTolerance > aTolerance)
- bigTolerance = true;
-
- bool isConnected = false;
- TopTools_ListOfShape newEdges; // common edges from new compound
- TopTools_ListOfShape oldEdges; // common edges from face to add
- TopoDS_Compound CFN;
- TopoDS_Compound CFO;
- bu.MakeCompound(CFN); // empty compound for new faces
- bu.MakeCompound(CFO); // empty compound for old faces
-
- for (TopExp_Explorer exp (S, TopAbs_FACE); exp.More(); exp.Next()) {
- // try to find corresponding face in new compound
- TopoDS_Face F = TopoDS::Face(exp.Current());
- TopoDS_Face newFace = FindSameFace(C,F,aTolerance);
- if (! newFace.IsNull())
- {
- // face found
- isConnected = true;
- bu.Add(CFN, newFace); // common faces from new compound
- for (TopExp_Explorer ee (F, TopAbs_EDGE); ee.More(); ee.Next()) {
- // find edge pair
- TopoDS_Edge Eold = TopoDS::Edge(ee.Current());
- TopoDS_Edge Enew = FindSameEdge(newFace, Eold, aTolerance);
- if (Enew.IsNull()) {
- Standard_ConstructionError::Raise("Glue aborted : no same edge in same face");
- }
- oldEdges.Append(Eold);
- newEdges.Append(Enew);
- }
- } else {
- bu.Add(CFO, F); // not common faces from shell to add
- }
- }
- if (isConnected) {
- // some faces found
- shellAdded = true;
- BRepTools_Quilt glue;
- glue.Add(CFN);
- TopTools_ListIteratorOfListOfShape ito (oldEdges);
- TopTools_ListIteratorOfListOfShape itn (newEdges);
- for (; ito.More(); ito.Next()) {
- // bind
- glue.Bind(TopoDS::Edge(ito.Value()), TopoDS::Edge(itn.Value()));
- itn.Next();
- }
- glue.Add(CFO);
- TopoDS_Compound newc = TopoDS::Compound(glue.Shells());
- for (TopExp_Explorer exs (newc, TopAbs_SHELL); exs.More(); exs.Next()) {
- TopoDS_Shell NS = TopoDS::Shell(exs.Current());
- bu.Add(C, NS);
- }
- shellList.Remove(its);
- // remove shell from list
+ iErr = aGluer.ErrorStatus();
+ if (iErr) {
+ switch (iErr) {
+ case 2:
+ Standard_Failure::Raise("No vertices found in source shape");
+ break;
+ case 5:
+ Standard_Failure::Raise("Source shape is Null");
+ break;
+ case 6:
+ Standard_Failure::Raise("Result shape is Null");
+ break;
+ case 200:
+ Standard_Failure::Raise("Error occured during check of geometric coincidence");
+ break;
+ default:
+ {
+ // description of all errors see in GEOMAlgo_Gluer.cxx
+ TCollection_AsciiString aMsg ("Error in GEOMAlgo_Gluer with code ");
+ aMsg += TCollection_AsciiString(iErr);
+ Standard_Failure::Raise(aMsg.ToCString());