[cgma-dev] r1768 - cgm/trunk/geom/OCC

janehu at mcs.anl.gov janehu at mcs.anl.gov
Tue Apr 15 14:15:02 CDT 2008


Author: janehu
Date: 2008-04-15 14:15:02 -0500 (Tue, 15 Apr 2008)
New Revision: 1768

Modified:
   cgm/trunk/geom/OCC/OCCBody.cpp
   cgm/trunk/geom/OCC/OCCBody.hpp
   cgm/trunk/geom/OCC/OCCLoop.cpp
   cgm/trunk/geom/OCC/OCCLump.hpp
   cgm/trunk/geom/OCC/OCCModifyEngine.cpp
   cgm/trunk/geom/OCC/OCCQueryEngine.cpp
   cgm/trunk/geom/OCC/OCCShell.cpp
   cgm/trunk/geom/OCC/OCCShell.hpp
   cgm/trunk/geom/OCC/OCCSurface.cpp
Log:
Still working on the entity update for boolean operation, it's a little confusion that when a TopoDS_Face get a map to newly generated TopoDS_Face, the Wire under it can't find the corresponding new Wire. Investigating why.

Modified: cgm/trunk/geom/OCC/OCCBody.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCBody.cpp	2008-04-15 14:48:02 UTC (rev 1767)
+++ cgm/trunk/geom/OCC/OCCBody.cpp	2008-04-15 19:15:02 UTC (rev 1768)
@@ -69,6 +69,14 @@
   update_bounding_box();
 }
 
+void OCCBody::set_sheet_surface(OCCSurface* surface)
+{
+  IsSheetBody = CUBIT_TRUE;
+  mySheetSurface = surface;
+  if(surface == NULL)
+    IsSheetBody = CUBIT_FALSE;
+}
+
 void OCCBody::lumps(DLIList<Lump*>& my_lumps)
 {
   myLumps.clean_out();

Modified: cgm/trunk/geom/OCC/OCCBody.hpp
===================================================================
--- cgm/trunk/geom/OCC/OCCBody.hpp	2008-04-15 14:48:02 UTC (rev 1767)
+++ cgm/trunk/geom/OCC/OCCBody.hpp	2008-04-15 19:15:02 UTC (rev 1768)
@@ -180,6 +180,8 @@
 
   OCCSurface* my_sheet_surface(){if(IsSheetBody) return mySheetSurface;
 				 return (OCCSurface*) NULL;} 
+  void set_sheet_surface(OCCSurface* surface); 
+
 protected: 
   
 private:

Modified: cgm/trunk/geom/OCC/OCCLoop.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCLoop.cpp	2008-04-15 14:48:02 UTC (rev 1767)
+++ cgm/trunk/geom/OCC/OCCLoop.cpp	2008-04-15 19:15:02 UTC (rev 1768)
@@ -227,6 +227,7 @@
   assert(aBRepTrsf != NULL || op != NULL);
 
   TopoDS_Shape shape;
+  CubitBoolean need_update = CUBIT_TRUE;
   if (aBRepTrsf)
     shape = aBRepTrsf->ModifiedShape(*get_TopoDS_Wire());
   else
@@ -236,18 +237,21 @@
     if(shapes.Extent())
       shape = shapes.First();
     else
-      return CUBIT_SUCCESS;
+      need_update = CUBIT_FALSE;
   }
-  TopoDS_Wire loop = TopoDS::Wire(shape);
-
-  OCCQueryEngine::instance()->update_OCC_map(*myTopoDSWire, loop);
-
+  TopoDS_Wire loop;
+  if (need_update)
+  {
+    loop = TopoDS::Wire(shape);
+    OCCQueryEngine::instance()->update_OCC_map(*myTopoDSWire, loop);
+  }
   //set the curves
   for (int i = 1; i <= myCoEdgeList.size(); i++)
   {
      OCCCurve *curve = CAST_TO(myCoEdgeList.get_and_step()->curve(), OCCCurve);
      curve->update_OCC_entity(aBRepTrsf, op);
   }
-  set_TopoDS_Wire(loop);
+  if (need_update)
+    set_TopoDS_Wire(loop);
 }
 

Modified: cgm/trunk/geom/OCC/OCCLump.hpp
===================================================================
--- cgm/trunk/geom/OCC/OCCLump.hpp	2008-04-15 14:48:02 UTC (rev 1767)
+++ cgm/trunk/geom/OCC/OCCLump.hpp	2008-04-15 19:15:02 UTC (rev 1768)
@@ -47,6 +47,11 @@
   OCCLump(TopoDS_Solid *theSolid, OCCSurface* surface = NULL, 
           OCCShell* shell = NULL);
   
+  OCCSurface* my_sheet_surface() {return mySheetSurface;}
+  OCCShell * my_shell() {return myShell;}
+  void set_surface(OCCSurface* surface) {mySheetSurface = surface;}
+  void set_shell(OCCShell* shell) {myShell = shell;}
+
   virtual ~OCCLump();
     //- The destructor
 

Modified: cgm/trunk/geom/OCC/OCCModifyEngine.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCModifyEngine.cpp	2008-04-15 14:48:02 UTC (rev 1767)
+++ cgm/trunk/geom/OCC/OCCModifyEngine.cpp	2008-04-15 19:15:02 UTC (rev 1768)
@@ -1532,7 +1532,6 @@
   faces_to_stitch.reset();
   surf_bodies.reset();
   TopoDS_Shape* first_face  = faces_to_stitch.pop();
-  surf_bodies.pop(); //make consistance with faces_to_stitch.
 
   TopoDS_Face* second_face = NULL;
   TopoDS_Shape fuse;
@@ -1542,7 +1541,8 @@
      BRepAlgoAPI_Fuse fuser(*second_face, *first_face);
      fuse = fuser.Shape();
      first_face = &fuse;
-     CAST_TO(surf_bodies[i], OCCBody)->my_sheet_surface()->my_shell()->update_OCC_entity(NULL, &fuser);      
+     OCCBody* occ_body = CAST_TO(surf_bodies[i], OCCBody);
+     occ_body->my_sheet_surface()->update_OCC_entity(NULL, &fuser);
   }
 
   TopExp_Explorer Ex;

Modified: cgm/trunk/geom/OCC/OCCQueryEngine.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCQueryEngine.cpp	2008-04-15 14:48:02 UTC (rev 1767)
+++ cgm/trunk/geom/OCC/OCCQueryEngine.cpp	2008-04-15 19:15:02 UTC (rev 1768)
@@ -1242,6 +1242,8 @@
       surface->set_body(body);
       surface->set_lump(lump);
       surface->set_shell(shell);
+      shell->set_body(body);
+      shell->set_lump(lump);
       //Doesn't need to save sheet bodies.
     }
     TopExp_Explorer Ex;

Modified: cgm/trunk/geom/OCC/OCCShell.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCShell.cpp	2008-04-15 14:48:02 UTC (rev 1767)
+++ cgm/trunk/geom/OCC/OCCShell.cpp	2008-04-15 19:15:02 UTC (rev 1768)
@@ -32,6 +32,7 @@
 
 #include <TopExp.hxx>
 #include <TopTools_IndexedMapOfShape.hxx>
+#include "TopExp_Explorer.hxx"
 #include "TopTools_IndexedDataMapOfShapeListOfShape.hxx"
 #include "TopoDS.hxx"
 #include "TopTools_ListIteratorOfListOfShape.hxx"
@@ -71,6 +72,13 @@
 {
 }
 
+void OCCShell::set_TopoDS_Shell(TopoDS_Shell shell)
+{
+  if (!myTopoDSShell)
+    myTopoDSShell = new TopoDS_Shell();
+  *myTopoDSShell = shell;
+}
+
 //-------------------------------------------------------------------------
 // Purpose       : Get geometry modeling engine: OCCQueryEngine
 //
@@ -169,15 +177,34 @@
 CubitStatus OCCShell::update_OCC_entity( BRepBuilderAPI_Transform *aBRepTrsf,
                                         BRepAlgoAPI_BooleanOperation *op)
 {
-  if(mySheetSurface)
+  if(mySheetSurface && op == NULL)
     return CUBIT_FAILURE;
 
+  else if(mySheetSurface && op)//stitch surface body into shell body
+  {
+    mySheetSurface->update_OCC_entity(aBRepTrsf, op); 
+    TopoDS_Shape shape = op->Shape();
+    TopExp_Explorer Ex;
+    TopoDS_Shell shell;
+    for (Ex.Init(shape, TopAbs_SHELL, TopAbs_SOLID); Ex.More(); Ex.Next())
+    {
+      shell = TopoDS::Shell(Ex.Current());
+      this->set_TopoDS_Shell(shell);
+      this->my_lump()->set_surface(NULL);
+      this->my_lump()->set_shell(this);
+      this->my_body()->shell(this);
+      this->my_body()->set_sheet_surface(NULL);
+      this->set_sheet_surface(NULL);
+      break;
+    }   
+    return CUBIT_SUCCESS;
+  }
   assert (aBRepTrsf != NULL || op != NULL);
 
   TopoDS_Shape shape;
   if (aBRepTrsf)
     shape = aBRepTrsf->ModifiedShape(*get_TopoDS_Shell());
-  else
+  else if(!mySheetSurface)
   {
     TopTools_ListOfShape shapes;
     shapes.Assign(op->Modified(*get_TopoDS_Shell()));

Modified: cgm/trunk/geom/OCC/OCCShell.hpp
===================================================================
--- cgm/trunk/geom/OCC/OCCShell.hpp	2008-04-15 14:48:02 UTC (rev 1767)
+++ cgm/trunk/geom/OCC/OCCShell.hpp	2008-04-15 19:15:02 UTC (rev 1768)
@@ -49,10 +49,13 @@
     //- Destructor.
 
   TopoDS_Shell* get_TopoDS_Shell() {return myTopoDSShell;}
-  void set_TopoDS_Shell(TopoDS_Shell shell){*myTopoDSShell = shell;} 
+  void set_TopoDS_Shell(TopoDS_Shell shell);
 
   OCCLump* my_lump() {return myLump;}
   OCCBody* my_body() {return myBody;}
+  OCCSurface* my_surface() {return mySheetSurface;}
+  void set_sheet_surface (OCCSurface* surface) {mySheetSurface = surface;}
+
   void set_lump(OCCLump* lump) {myLump = lump;}
   void set_body(OCCBody* body) {myBody = body;}
 

Modified: cgm/trunk/geom/OCC/OCCSurface.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCSurface.cpp	2008-04-15 14:48:02 UTC (rev 1767)
+++ cgm/trunk/geom/OCC/OCCSurface.cpp	2008-04-15 19:15:02 UTC (rev 1768)
@@ -773,7 +773,6 @@
   assert(aBRepTrsf != NULL || op != NULL);
 
   TopoDS_Shape shape;
-  CubitBoolean need_update = CUBIT_TRUE;
   if (aBRepTrsf)
     shape = aBRepTrsf->ModifiedShape(*get_TopoDS_Face());
   else




More information about the cgma-dev mailing list