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

janehu at mcs.anl.gov janehu at mcs.anl.gov
Mon Apr 21 14:49:42 CDT 2008


Author: janehu
Date: 2008-04-21 14:49:42 -0500 (Mon, 21 Apr 2008)
New Revision: 1772

Modified:
   cgm/trunk/geom/OCC/OCCModifyEngine.cpp
   cgm/trunk/geom/OCC/OCCSurface.cpp
Log:
Solved the stitched shell unclosed issue: we have to check the closed status, and set up the flag. some other make_Lump changes.

Modified: cgm/trunk/geom/OCC/OCCModifyEngine.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCModifyEngine.cpp	2008-04-18 19:20:39 UTC (rev 1771)
+++ cgm/trunk/geom/OCC/OCCModifyEngine.cpp	2008-04-21 19:49:42 UTC (rev 1772)
@@ -1040,14 +1040,34 @@
   TopoDS_Shape aShape;
   CubitStatus stat = stitch_surfs(body_list, aShape);
   
-  TopExp_Explorer Ex;
+  TopExp_Explorer Ex, Ex2;
   TopoDS_Shell aShell ;
   for (Ex.Init(aShape, TopAbs_SHELL, TopAbs_SOLID); Ex.More()&& stat; Ex.Next())
     aShell = TopoDS::Shell(Ex.Current());
  
-  int num_edge = 0;
+  //check to make sure the aShell is closed.
+  int num_edges = 0;
+  int pairs = 0;
   for (Ex.Init(aShell, TopAbs_EDGE); Ex.More()&& stat; Ex.Next())
-    num_edge++;
+  {
+    TopoDS_Edge edge1 = TopoDS::Edge(Ex.Current());
+    num_edges++;
+    for (Ex2.Init(aShell, TopAbs_EDGE); Ex2.More()&& stat; Ex2.Next())  
+    {
+      TopoDS_Edge edge2 = TopoDS::Edge(Ex2.Current());    
+      if (!edge1.IsEqual(edge2)&& edge1.IsSame(edge2))
+      {
+        pairs++;
+        break;
+      }
+    }
+  }
+  if (num_edges == pairs)
+    aShell.Closed(CUBIT_TRUE);
+
+  else
+    PRINT_ERROR("Surfaces must make a water-tight shape to make a lump.\n");
+  
   if(aShell.Closed())
   {
     BRepBuilderAPI_MakeSolid aMakeSolid(aShell);
@@ -1111,6 +1131,18 @@
   if (lump_list.size() == 0)
     return (BodySM*) NULL;
 
+  //make sure the lumps in lump_list don't attached to any Bodies.
+  for (int i = 0; i < lump_list.size(); i++)
+  {
+    Lump* lump = lump_list.get_and_step();
+    BodySM* body = CAST_TO(lump, OCCLump)->get_body();
+    if (body)
+    {
+      if (lump_list.size()>1)
+        PRINT_ERROR("the lump_list should be free to bodysm's to make a new bodysm.\n");
+      return body;
+    } 
+  }
   //Create a compsolid shape, save all BodySM's correponding to lump_list
   //for deletion.
   DLIList<BodySM*> bodysm_list;

Modified: cgm/trunk/geom/OCC/OCCSurface.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCSurface.cpp	2008-04-18 19:20:39 UTC (rev 1771)
+++ cgm/trunk/geom/OCC/OCCSurface.cpp	2008-04-21 19:49:42 UTC (rev 1772)
@@ -784,13 +784,13 @@
     if (shapes.Extent() > 0)
       shape = shapes.First();
     else
-      need_update = CUBIT_FALSE;
+      return CUBIT_SUCCESS;
   }
  
   TopoDS_Face surface; 
   surface = TopoDS::Face(shape);
 
-  if (aBRepTrsf  && need_update)
+  if (aBRepTrsf) 
   {
     OCCQueryEngine::instance()->update_OCC_map(*myTopoDSFace, surface);
 
@@ -805,13 +805,9 @@
     set_TopoDS_Face(surface);
   }
 
-  else if(op && need_update)
+  else if(op)
     update_OCC_entity(*myTopoDSFace, surface, op);
 
-  else
-    update_OCC_entity(*myTopoDSFace, *myTopoDSFace, op); //underling curves may
-    //need update
-
   return CUBIT_SUCCESS;
 }
 
@@ -859,6 +855,9 @@
        else
          continue;
 
+       if(wire.Orientation() == TopAbs_REVERSED)
+         shape.Orientation(
+          shape.Orientation()==TopAbs_FORWARD? TopAbs_REVERSED:TopAbs_FORWARD);
        OCCQueryEngine::instance()->update_OCC_map(edge, shape); 
   
        //update vertex




More information about the cgma-dev mailing list