]> SALOME platform Git repositories - modules/geom.git/commitdiff
Salome HOME
MPV: Merge V1_2d
authorsmh <smh@opencascade.com>
Wed, 28 Jan 2004 14:08:37 +0000 (14:08 +0000)
committersmh <smh@opencascade.com>
Wed, 28 Jan 2004 14:08:37 +0000 (14:08 +0000)
16 files changed:
src/DisplayGUI/DisplayGUI.cxx
src/EntityGUI/EntityGUI_SubShapeDlg.cxx
src/GEOM/GEOM_Gen_i.cc
src/GEOMBase/GEOMBase.cxx
src/GEOMToolsGUI/GEOMToolsGUI.cxx
src/GEOM_SWIG/geompy.py
src/OBJECT/GEOM_AISShape.cxx
src/OBJECT/GEOM_Actor.cxx
src/OBJECT/GEOM_Actor.h
src/OBJECT/GEOM_AssemblyBuilder.cxx
src/OperationGUI/OperationGUI_PartitionDlg.cxx
src/PARTITION/Partition_Inter2d.cxx
src/PARTITION/Partition_Inter3d.cxx
src/PARTITION/Partition_Spliter.cdl
src/PARTITION/Partition_Spliter.cxx
src/PARTITION/Partition_Spliter.hxx

index b42972f89038a28b691ed000f600267bc0f5c68c..73235ed1b2638f44061cac6da7de74c624048df7 100644 (file)
@@ -440,6 +440,7 @@ void DisplayGUI::BuildPresentation(const Handle(SALOME_InteractiveObject)& theIO
                }
                Handle(GEOM_AISShape) aSh = new GEOM_AISShape(Shape, aName->Value());
                aSh->SetShadingColor(myDisplayGUI->myGeomBase->myShadingColor);
+               aSh->SetInfiniteState(Shape.Infinite());
                Handle(GEOM_InteractiveObject) IO = new GEOM_InteractiveObject(anIOR->Value(), myDisplayGUI->myGeomGUI->GetFatherior(), "GEOM");
                IO->setEntry(obj->GetID());
                aSh->setIO(IO);
index 28923363f96328ddce47784d36515dc984595c52..b782a2bd2ed4a8e3caadaa6cc08b1f6f44bedfad 100644 (file)
@@ -198,7 +198,7 @@ void EntityGUI_SubShapeDlg::ClickOnApply()
     QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE"));
 
   /* Reset all arguments and local context to allow user a new selection ...*/
-  this->ResetStateOfDialog();
+  //this->ResetStateOfDialog();
   return;
 }
 
index 3816897aed0468e974d074b613d0a3ea6b3e801d..c5b9bf2a7b4265fd7864b71a6e11979b5abe9dae 100644 (file)
@@ -452,7 +452,9 @@ SALOMEDS::TMPFile* GEOM_Gen_i::Save(SALOMEDS::SComponent_ptr theComponent,
   SALOMEDS::ListOfFileNames_var aSeq = new SALOMEDS::ListOfFileNames;
   aSeq->length(1);
   // Prepare a file name to open
-  TCollection_AsciiString aNameWithExt(SALOMEDS_Tool::GetNameFromPath(theComponent->GetStudy()->URL()));
+  TCollection_AsciiString aNameWithExt("");
+  if (isMultiFile)
+    aNameWithExt = TCollection_AsciiString(SALOMEDS_Tool::GetNameFromPath(theComponent->GetStudy()->URL()));
   aNameWithExt += TCollection_AsciiString("_GEOM.sgd");
   aSeq[0] = CORBA::string_dup(aNameWithExt.ToCString());
   // Build a full file name of temporary file
@@ -493,7 +495,10 @@ CORBA::Boolean GEOM_Gen_i::Load(SALOMEDS::SComponent_ptr theComponent,
                                                                       isMultiFile);
 
   // Prepare a file name to open
-  TCollection_AsciiString aNameWithExt(aSeq[0]);
+  TCollection_AsciiString aNameWithExt("");
+  if (isMultiFile)
+    aNameWithExt = TCollection_AsciiString(SALOMEDS_Tool::GetNameFromPath(theComponent->GetStudy()->URL()));
+  aNameWithExt += TCollection_AsciiString("_GEOM.sgd");
   TCollection_AsciiString aFullName = aTmpDir + aNameWithExt;
 
   // Open document
index 438a1e541e7eaa161dc87734f7e5bec2466a2e93..fd8b537af27f2d2297e347d35fd2e26427f4f852 100644 (file)
@@ -490,13 +490,13 @@ bool GEOMBase::Display(GEOM::GEOM_Shape_ptr aShape, Standard_CString name)
     anAttr = aStudyBuilder->FindOrCreateAttribute(father, "AttributePixMap");
     aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr);
     aPixmap->SetPixMap("ICON_OBJBROWSER_Geometry");
+    aStudyBuilder->DefineComponentInstance(father, myGeom);
     QAD_Application::getDesktop()->getActiveStudy()->updateObjBrowser();
     if(aLocked)
       aStudy->GetProperties()->SetLocked(true);
     op->finish();
   }
 
-  aStudyBuilder->DefineComponentInstance(father, myGeom);
   father->ComponentIOR(myGeomGUI->GetFatherior());
 
   TCollection_AsciiString nameG("");
@@ -540,6 +540,7 @@ bool GEOMBase::Display(GEOM::GEOM_Shape_ptr aShape, Standard_CString name)
     OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer();
     Handle(AIS_InteractiveContext) ic = v3d->getAISContext();
     Handle(GEOM_AISShape) theResult = new GEOM_AISShape(shape, nameG.ToCString());
+    theResult->SetInfiniteState(shape.Infinite());
     theResult->SetShadingColor(myShadingColor);
     IO = new GEOM_InteractiveObject(aShape->Name(), myGeomGUI->GetFatherior(), "GEOM");
     theResult->setIO(IO);
@@ -595,12 +596,12 @@ bool GEOMBase::AddInStudy(bool selection, const Handle(SALOME_InteractiveObject)
     anAttr = aStudyBuilder->FindOrCreateAttribute(father, "AttributePixMap");
     aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr);
     aPixmap->SetPixMap("ICON_OBJBROWSER_Geometry");
+    aStudyBuilder->DefineComponentInstance(father, myGeom);
     if (aLocked)
       aStudy->GetProperties()->SetLocked(true);
     op->finish();
   }
 
-  aStudyBuilder->DefineComponentInstance(father, myGeom);
   father->ComponentIOR(myGeomGUI->GetFatherior());
   
   SALOMEDS::SObject_var fatherSF = aStudy->FindObjectID(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->entry());
index fe0e3cc9c0e133108c646f7ffe83b9de61233448..5eddb4047d8af460211c6d5ca6c0c8fad3fd99e6 100644 (file)
@@ -313,7 +313,7 @@ bool GEOMToolsGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent)
       {
        QAD_PyEditor* PyEditor = QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getPyEditor();
        PyEditor->setText("from GEOM_usinggeom import *\n");
-       PyEditor->setText(">>> ");
+       //PyEditor->setText(">>> ");
        PyEditor->handleReturn();
        break;
       }
@@ -533,6 +533,9 @@ void GEOMToolsGUI::OnEditDelete()
   SALOMEDS::AttributeIOR_var anIOR;
   
   SALOME_ListIteratorOfListIO It(Sel->StoredIObjects());
+  QAD_Operation* op = new SALOMEGUI_ImportOperation( QAD_Application::getDesktop()->getActiveStudy() );
+  op->start();
+  Standard_Boolean deleted = false;
   for(;It.More();It.Next()) {
     Handle(SALOME_InteractiveObject) IObject = It.Value();
     if(IObject->hasEntry()) {
@@ -598,15 +601,16 @@ void GEOMToolsGUI::OnEditDelete()
       /* Erase objects in Study */
       SALOMEDS::SObject_var obj = aStudy->FindObjectID(IObject->getEntry());
       if(!obj->_is_nil()) {
-       QAD_Operation* op = new SALOMEGUI_ImportOperation(QAD_Application::getDesktop()->getActiveStudy());
-       op->start();
        aStudyBuilder->RemoveObject(obj);
-       op->finish();
+       deleted = true;
       }
 
     } /* IObject->hasEntry() */
   }   /* more/next           */
 
+  if (deleted) op->finish();
+  else op->abort();
+
   /* Clear any previous selection */
   Sel->ClearIObjects(); 
   QAD_Application::getDesktop()->getActiveStudy()->updateObjBrowser();
@@ -742,11 +746,11 @@ bool GEOMToolsGUI::Import(int aState)
       anAttr = aStudyBuilder->FindOrCreateAttribute(father, "AttributePixMap");
       aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr);
       aPixmap->SetPixMap( "ICON_OBJBROWSER_Geometry" );
+      aStudyBuilder->DefineComponentInstance( father, myGeom );
       if (aLocked) aStudy->GetProperties()->SetLocked(true);
       op->finish();
     }
 //      if (aLocked) return false;
-    aStudyBuilder->DefineComponentInstance( father, myGeom );
     father->ComponentIOR(myGeomGUI->GetFatherior());
 
     QString nameShape = QAD_Tools::getFileNameFromPath(file,false) +  QString("_%1").arg(myGeomGUI->GetNbGeom()++);
index 1e74b2938221f3ae99675dbc12a491ab03a9e266..4cfc0184f72b0d93033a525f43a944d1bab46dfa 100644 (file)
@@ -115,7 +115,7 @@ def addToStudy(aShape, aName):
 
 #NRI : BugID 1682 :     sg = SALOMEGUI_Swig()
 #NRI : BugID 1682 :     sg.updateObjBrowser(0)
-    salome.sg.updateObjBrowser(0)
+#    salome.sg.updateObjBrowser(0)
     return id
 
 def addToStudyInFather(aFather, aShape, aName):
@@ -141,7 +141,7 @@ def addToStudyInFather(aFather, aShape, aName):
     addArguments( aShape )
 
 #NRI : BugID 1682 :     sg.updateObjBrowser(0)
-    salome.sg.updateObjBrowser(0)
+#    salome.sg.updateObjBrowser(0)
     return id
 
 # -----------------------------------------------------------------------------
index e87917f5e173baaa1d09f251ee253a3d050a5516..81c83d1d356b3c2b15a230a02c096a144dc7cd4d 100644 (file)
@@ -103,11 +103,11 @@ void GEOM_AISShape::Compute(const Handle(PrsMgr_PresentationManager3d)& aPresent
       myDrawer->ShadingAspect()->Aspect()->SetDistinguishOn();
       
       Graphic3d_MaterialAspect aMatAspect;
-      aMatAspect.SetAmbient( 1 );
-      aMatAspect.SetDiffuse( 0 );
-      aMatAspect.SetEmissive( 0 );
-      aMatAspect.SetShininess(1 );
-      aMatAspect.SetSpecular( 0 );
+      aMatAspect.SetAmbient( 0.5 );
+      aMatAspect.SetDiffuse( 0.5 );
+      aMatAspect.SetEmissive( 0.5 );
+      aMatAspect.SetShininess(0.5 );
+      aMatAspect.SetSpecular( 0.5 );
       
       myDrawer->ShadingAspect()->Aspect()->SetFrontMaterial(aMatAspect);
       myDrawer->ShadingAspect()->Aspect()->SetBackMaterial(Graphic3d_NOM_JADE);
index 0602bc5caa36c4c2a42156b062364548e1f7a4da..dde683ac84056c54879aa10406dfaff7432a99a7 100644 (file)
@@ -76,6 +76,7 @@ GEOM_Actor::GEOM_Actor()
   this->ishighlighted = false;
 
   this->subshape = false;
+  this->myIsInfinite = false;
 }
 
 GEOM_Actor::~GEOM_Actor()
@@ -171,6 +172,7 @@ void GEOM_Actor::SetShadingProperty(vtkProperty* Prop) {
 // Mapper creating function
 //-------------------------------------------------------------
 void GEOM_Actor::CreateMapper(int theMode) {
+  this->myIsInfinite = myShape.Infinite();  
   if(myShape.ShapeType() == TopAbs_VERTEX) {
     gp_Pnt aPnt = BRep_Tool::Pnt(TopoDS::Vertex(myShape));
     this->SetPosition(aPnt.X(),aPnt.Y(),aPnt.Z());
@@ -220,7 +222,9 @@ void GEOM_Actor::Render(vtkRenderer *ren, vtkMapper *Mapper)
   }
 
   if(!ishighlighted) {
-    if(myDisplayMode >= 1) {
+    if ( ispreselected ) 
+      this->Property = PreviewProperty;
+    else if(myDisplayMode >= 1) {
       // SHADING
       this->Property = ShadingProperty;
     }
@@ -228,8 +232,6 @@ void GEOM_Actor::Render(vtkRenderer *ren, vtkMapper *Mapper)
       this->Property = WireframeProperty;     
     }
 
-    if ( ispreselected )
-      this->Property = PreviewProperty;
   }
 
   this->Property->Render(this, ren);
index c40dd100165ad5f6ed87457e4ec9fa8815c01e8e..cc62951591fe33ae1efecabca8310da3ae6bbea2 100644 (file)
@@ -93,7 +93,8 @@ class VTKOCC_EXPORT GEOM_Actor : public SALOME_Actor {
   // Color
   void SetColor(float r,float g,float b);
   void GetColor(float& r,float& g,float& b);
-  
+
+  virtual bool IsInfinite() {return myIsInfinite;}  
  protected:
 
   GEOM_Actor();
@@ -110,6 +111,7 @@ class VTKOCC_EXPORT GEOM_Actor : public SALOME_Actor {
  private:
 
   bool subshape;
+  bool myIsInfinite;
 
   TopoDS_Shape myShape;
   double deflection;
index 39aca3d9cacd25222c1a3ef6596c754717053b46..6c0f4df9269c346a3fdb3ad343c1b0d308ac0d14 100644 (file)
@@ -69,7 +69,7 @@ void GEOM_AssemblyBuilder::InitProperties(vtkProperty* IsoProp,
 {
   // Shading like default OCC material
   FaceProp->SetRepresentationToSurface();
-  FaceProp->SetInterpolation(1);
+  FaceProp->SetInterpolationToGouraud();
   FaceProp->SetAmbient(1.0);
   FaceProp->SetDiffuse(1.0);
   FaceProp->SetSpecular(0.4);
@@ -109,9 +109,9 @@ void GEOM_AssemblyBuilder::InitProperties(vtkProperty* IsoProp,
 
   // Wireframe for Preview edge 
   EdgePVProp->SetRepresentationToWireframe();
-  EdgePVProp->SetAmbientColor(0, 1, 1);
-  EdgePVProp->SetDiffuseColor(0, 1, 1);
-  EdgePVProp->SetSpecularColor(0, 1, 1);
+  EdgePVProp->SetAmbientColor(1, 1, 0);
+  EdgePVProp->SetDiffuseColor(1, 1, 0);
+  EdgePVProp->SetSpecularColor(1, 1, 0);
 
   // Wireframe for vertex 
   VertexProp->SetRepresentationToWireframe();
index add70022dfacef71b2649237caf215f8b578fbb0..fb93269ddc190ec8f57dcf72c1adfab4bc4e556e 100644 (file)
@@ -205,14 +205,19 @@ void OperationGUI_PartitionDlg::SelectionIntoArgument()
 
   int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString);
   if(nbSel < 1) {
-    if(myEditCurrentArgument == GroupPoints->LineEdit1)
+    if(myEditCurrentArgument == GroupPoints->LineEdit1) {
+      myListShapes.length(0);
       myOkListShapes = false;
-    else if(myEditCurrentArgument == GroupPoints->LineEdit2)
+    } else if(myEditCurrentArgument == GroupPoints->LineEdit2) {
+      myListTools.length(0);
       myOkListTools = false;
-    else if(myEditCurrentArgument == GroupPoints->LineEdit3)
+    } else if(myEditCurrentArgument == GroupPoints->LineEdit3) {
+      myListRemoveInside.length(0);
       myOkKeepShape = false;
-    else if(myEditCurrentArgument == GroupPoints->LineEdit4)
+    } else if(myEditCurrentArgument == GroupPoints->LineEdit4) {
+      myListKeepInside.length(0);
       myOkRemoveShape = false;
+    }
     return;
   }
 
index 54b25e6e99198d4ba6b7a3d5e80d8a589295b2aa..f8fa4931e03f318eae5b5fdaa359f92620533d24 100644 (file)
@@ -241,11 +241,14 @@ TopoDS_Vertex Partition_Inter2d::AddVonE(const TopoDS_Vertex& theV,
 
   if (!OnE1 && !OnE2 && !theF.IsNull())
   {
-    // analitically find vertices E1 and E2 must pass trough
+    // if 3 faces intersects each others, 3 new edges on them must pass
+    // through one vertex but real intersection points of each
+    // pair of edges are sometimes more far than a tolerance.
+    // Try to analitically find vertices that E1 and E2 must pass trough
 
     TopoDS_Shape F1 = getOtherShape( theF, AsDes->Ascendant( E1 ));
     TopoDS_Shape F2 = getOtherShape( theF, AsDes->Ascendant( E2 ));
-    if (!F1.IsNull() && !F2.IsNull())
+    if (!F1.IsNull() && !F2.IsNull() && !F1.IsSame( F2 ))
     {
       OnE1 = findVOnE ( theV, E1, E2, F1, F2, AsDes, V1 );
       OnE2 = findVOnE ( theV, E2, E1, F1, F2, AsDes, V2 );
index 7724b73f1a2a76103622ccc3030f36e346fbaa17..e9bf649ce6fb4d905706ac6a7c48b9fb7f460471 100644 (file)
@@ -67,7 +67,6 @@ using namespace std;
 #include <Geom_RectangularTrimmedSurface.hxx>
 #include <Geom_SphericalSurface.hxx>
 #include <Geom_Surface.hxx>
-#include <Geom_ToroidalSurface.hxx>
 #include <Geom_TrimmedCurve.hxx>
 #include <Precision.hxx>
 #include <TColStd_MapOfInteger.hxx>
@@ -136,10 +135,10 @@ void Partition_Inter3d::CompletPart3d(const TopTools_ListOfShape& SetOfFaces1,
     // avoid intersecting faces of one shape
     TopoDS_Shape S1;
     if (FaceShapeMap.IsBound(F1)) S1 = FaceShapeMap.Find(F1);
-    // avoid intersecting faces sharing vertices, suppose they belong to
-    // shapes sharing same faces
-    TopTools_IndexedMapOfShape VM;
-    TopExp::MapShapes( F1, TopAbs_VERTEX, VM);
+
+    // to filter faces sharing an edge
+    TopTools_IndexedMapOfShape EM;
+    TopExp::MapShapes( F1, TopAbs_EDGE, EM);
     
     TColStd_ListIteratorOfListOfInteger itLI = BOS.Compare(F1);
     for (; itLI.More(); itLI.Next()) {
@@ -152,13 +151,22 @@ void Partition_Inter3d::CompletPart3d(const TopTools_ListOfShape& SetOfFaces1,
       if (!S1.IsNull() && S1.IsSame(S2))
        continue; // descendants of one shape
 
-      TopExp_Explorer expV (F2, TopAbs_VERTEX);
-      for ( ; expV.More(); expV.Next())
-       if (VM.Contains( expV.Current() ))
+      TopExp_Explorer expE (F2, TopAbs_EDGE);
+      for ( ; expE.More(); expE.Next())
+       if (EM.Contains( expE.Current() ))
          break;
-      if (expV.More())
-       continue; // faces have a common edge
-      
+      if (expE.More())
+      {
+        // faces have a common edge, check if they are a tool and a face
+        // generated by the tool in another shape; in that case they are
+        // to be intersected
+        TopLoc_Location L1, L2;
+        Handle(Geom_Surface) S1 = BRep_Tool::Surface( F1, L1 );
+        Handle(Geom_Surface) S2 = BRep_Tool::Surface( F2, L2 );
+        if ( S1 != S2 || L1 != L2 )
+          continue;
+      }
+
       F1.Orientation(TopAbs_FORWARD);
       F2.Orientation(TopAbs_FORWARD);
       FacesPartition(F1,F2);     
@@ -210,8 +218,7 @@ static void PutInBounds (const TopoDS_Face&          F,
   // UPeriodic, sometimes it is in domain but nontheless it has
   // wrong position.
   // Check pcurve position by 3D point
-  if (S->IsKind(STANDARD_TYPE( Geom_SphericalSurface )) ||
-      S->IsKind(STANDARD_TYPE( Geom_ToroidalSurface )))
+  if (S->IsKind(STANDARD_TYPE( Geom_SphericalSurface )))
   {
     // get point on the surface
     gp_Pnt Ps = S->Value( Pm.X(), Pm.Y() );
@@ -472,11 +479,17 @@ void Partition_Inter3d::Inter3D(const TopoDS_Face& F1,
 
     TopoDS_Edge se = TopoDS::Edge( itLSE.Value() );
 
+    // move itLSE to the next se
     Standard_Integer ancRank = DS.AncestorRank(se);
     if (ME[ancRank-1].Contains( se ))
+    {
       LSE.Remove( itLSE ); // se is an edge of face it intersects
+      continue;
+    }
     else
+    {
       itLSE.Next();
+    }
 
     const TopoDS_Face& F = (ancRank == 1) ? F2 : F1;
 
index 0fc9b5be580c1fc624f99cf7bd3b0d76520789a5..75537b498c3f829b77fbf1d042fff648df8cf711 100644 (file)
@@ -163,6 +163,7 @@ fields
     myEqualEdges   : MapOfShape          from TopTools; -- equal splits
     myNewSection   : MapOfShape          from TopTools; -- new secton edges
     myClosedShapes : MapOfShape          from TopTools;
+    mySharedFaces  : MapOfShape          from TopTools; -- faces shared by several shapes
     myWrappingSolid: MapOfShape          from TopTools; -- solids having other shapes inside
     myFaceShapeMap : DataMapOfShapeShape from TopTools; -- to find a shape by face
                                           
index 8dd5d136dbb53aa2454203cd8ae9200ca85d83aa..dc4900963efee4ac78ab39565ec2a5b7355a49f0 100644 (file)
@@ -208,9 +208,10 @@ void Partition_Spliter::Clear()
   myListShapes.Clear();
   myMapFaces.Clear();
   myMapTools.Clear();
-  myClosedShapes.Clear();
   myEqualEdges.Clear();
   myNewSection.Clear();
+  myClosedShapes.Clear();
+  mySharedFaces.Clear();
   myWrappingSolid.Clear();
   myFaceShapeMap.Clear();
   
@@ -520,7 +521,8 @@ void Partition_Spliter::Compute(const TopAbs_ShapeEnum Limit)
     MakeShells (S , NSL);
     if (makeSolids && S.ShapeType() == TopAbs_SOLID )
       MakeSolids( S, NSL );
-    
+
+    // store new shells or solids
     TopTools_ListIteratorOfListOfShape itNSL (NSL);
     for ( ; itNSL.More(); itNSL.Next()) 
       myBuilder.Add (myShape, itNSL.Value());
@@ -593,7 +595,7 @@ void Partition_Spliter::MakeSolids(const TopoDS_Shape &   theSolid,
     }
   }
 
-  // find outer a shell most close to each hole shell
+  // find an outer shell most close to each hole shell
   TopTools_DataMapOfShapeShape aInOutMap;
   for (aShellIt.Initialize( aHoleShells ); aShellIt.More(); aShellIt.Next())
   {
@@ -913,42 +915,46 @@ TopoDS_Shape Partition_Spliter::FindFacesInside(const TopoDS_Shape& theShape,
   Standard_Boolean isSolid = (theShape.ShapeType() == TopAbs_SOLID);
   if (All || isSolid)  // All is for sub-result removal
   {
+    // loop on not used faces; checked faces will be removed from MFP
+    // during the loop
     for ( itm.Initialize( MFP ); itm.More(); itm.Next() ) {
-      TopoDS_Shape aFace = itm.Key();
+      const TopoDS_Shape & aFace = itm.Key();
 
-      // find a shape aFace originates from
+      // a shape which aFace originates from
       TopoDS_Shape anOrigShape = GetOriginalShape( aFace );
 
-      // find out if all faces of anOrigShape are not in MFP
+      // find out if all split faces of anOrigShape are not in MFP
       // and by the way remove them from MFP
       Standard_Boolean isAllOut = Standard_True;
       TopoDS_Shape aSplitFaces = anOrigShape;
       if (myImageShape.HasImage(anOrigShape))
         aSplitFaces = myImageShape.Image(anOrigShape).First();
 
-      TopTools_ListOfShape aSplitFaceL;
+      TopTools_ListOfShape aSplitFaceL; // faces candidate to be kept
       for (expl.Init( aSplitFaces, TopAbs_FACE ); expl.More(); expl.Next())
       {
         const TopoDS_Shape & aSpFace = expl.Current();
-        // a tool face which become object has image but the whole tool shape has not
+        // a tool face which became object has image but the whole tool shape has not
         if (myImageShape.HasImage( aSpFace ))
         {
           TopExp_Explorer exF (myImageShape.Image( aSpFace ).First(), TopAbs_FACE );
           for ( ; exF.More(); exF.Next() )
           {
             aSplitFaceL.Append( exF.Current() );
-            if ( ! MFP.Remove( exF.Current() ))
-              isAllOut = Standard_False;
+            if ( ! MFP.Remove( exF.Current() ) && isAllOut )
+              // a shared face might be removed from MFP during a prev loop
+              isAllOut = mySharedFaces.Contains( exF.Current() );
           }
         }
         else
         {
           aSplitFaceL.Append( aSpFace );
-          if ( ! MFP.Remove( aSpFace ))
-            isAllOut = Standard_False;
+          if ( ! MFP.Remove( aSpFace ) && isAllOut)
+            // a shared face might be removed from MFP during a prev loop
+            isAllOut = mySharedFaces.Contains( aSpFace );
         }
       }
-      itm.Initialize( MFP );
+      itm.Initialize( MFP ); // iterate remaining faces
       if ( !isAllOut )
         continue;
 
@@ -1301,15 +1307,17 @@ TopoDS_Shape Partition_Spliter::MakeFaces (const TopoDS_Shape& S)
         myImagesFaces.Bind(F,LNF);
 
         // replace the result faces that have already been built
-        // during same domain faces reconstruction
-        if (myInter3d.HasSameDomainF( F )) {
-          // build map edge to same domain faces
+        // during same domain faces reconstruction done earlier
+        if (myInter3d.HasSameDomainF( F ))
+        {
+          // build map edge to same domain faces: EFM
           TopTools_IndexedDataMapOfShapeListOfShape EFM;
           TopTools_MapOfShape SDFM; // avoid doubling
           itl.Initialize( myInter3d.SameDomain( F ));
           for (; itl.More(); itl.Next()) {
             if ( !myImagesFaces.HasImage( itl.Value() ))
               continue;
+            // loop on splits of a SD face
             TopTools_ListIteratorOfListOfShape itNF;
             itNF.Initialize (myImagesFaces.Image( itl.Value() ));
             for ( ; itNF.More(); itNF.Next()) {
@@ -1320,7 +1328,7 @@ TopoDS_Shape Partition_Spliter::MakeFaces (const TopoDS_Shape& S)
                 TopExp::MapShapesAndAncestors(SDF, TopAbs_EDGE, TopAbs_FACE, EFM);
             }
           }
-          // do replace
+          // do replace faces in the LNF
           TopTools_ListOfShape LOF;
           if ( !EFM.IsEmpty() )
             itl.Initialize( LNF );
@@ -1335,13 +1343,15 @@ TopoDS_Shape Partition_Spliter::MakeFaces (const TopoDS_Shape& S)
               Standard_Real dot;
               Partition_Loop3d::IsInside (E, TopoDS::Face(NF), TopoDS::Face(SDF),
                                           1, dot, GoodOri);
-              if (dot < 0) {
+              if (dot < 0)
+              {
+                // NF and SDF are on different side of E
                 if (SDFL.Extent() == 1) {
                   itl.Next();
                   continue;
                 }
                 else
-                  SDF = SDFL.Last();
+                  SDF = SDFL.Last(); // next face must be on the same side
               }
               gp_Vec V1 = Partition_Loop3d::Normal( E, TopoDS::Face( NF ));
               gp_Vec V2 = Partition_Loop3d::Normal( E, TopoDS::Face( SDF ));
@@ -1351,6 +1361,9 @@ TopoDS_Shape Partition_Spliter::MakeFaces (const TopoDS_Shape& S)
               if (!myImagesFaces.HasImage( NF ))
                 myImagesFaces.Bind( NF, SDF );
 
+              // mySharedFaces is used in FindFacesInside()
+              mySharedFaces.Add( SDF );
+
               LOF.Prepend ( SDF );
               LNF.Remove (itl);
             }
@@ -1367,9 +1380,11 @@ TopoDS_Shape Partition_Spliter::MakeFaces (const TopoDS_Shape& S)
        myImagesFaces.Bind(F,LNF);
       }
     } // if (myImagesFaces.HasImage( F ))
-    
+
+    // fill the resulting compound
     for (itl.Initialize(LNF); itl.More(); itl.Next())
       myBuilder.Add ( C, itl.Value());
+    
   } // loop on faces of S
 
   return C;
index 61700cecbc2e9d328bc3586ec74cd1e3e56346be..2f9e102bb37394735a046ee4e683bfcdd1f437af 100644 (file)
@@ -124,6 +124,7 @@ TopTools_MapOfShape myMapTools;
 TopTools_MapOfShape myEqualEdges;
 TopTools_MapOfShape myNewSection;
 TopTools_MapOfShape myClosedShapes;
+TopTools_MapOfShape mySharedFaces;
 TopTools_MapOfShape myWrappingSolid;
 TopTools_DataMapOfShapeShape myFaceShapeMap;
 TopTools_DataMapOfShapeShape myInternalFaces;