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

janehu at mcs.anl.gov janehu at mcs.anl.gov
Thu Feb 28 14:25:04 CST 2008


Author: janehu
Date: 2008-02-28 14:25:04 -0600 (Thu, 28 Feb 2008)
New Revision: 1625

Modified:
   cgm/trunk/geom/OCC/OCCModifyEngine.cpp
   cgm/trunk/geom/OCC/OCCQueryEngine.cpp
Log:
going through testing on make_BodySM from a list of RefVolumes, this step seems ok, but when deleting all bodies, it crashed. Check again, found that when reading in geometry, there is something wrong, so when deleting, crashed. This step passed before. Still checking on it.

Modified: cgm/trunk/geom/OCC/OCCModifyEngine.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCModifyEngine.cpp	2008-02-27 23:27:57 UTC (rev 1624)
+++ cgm/trunk/geom/OCC/OCCModifyEngine.cpp	2008-02-28 20:25:04 UTC (rev 1625)
@@ -1019,7 +1019,9 @@
   if (lump_list.size() == 0)
     return (BodySM*) NULL;
 
-  //Create a compsolid shape
+  //Create a compsolid shape, save all BodySM's correponding to lump_list
+  //for deletion.
+  DLIList<BodySM*> bodysm_list;
   TopoDS_CompSolid CS;
   BRep_Builder B;
   B.MakeCompSolid(CS);
@@ -1037,6 +1039,12 @@
      }
      TopoDS_Solid* solid = occ_lump->get_TopoDS_Solid();
      B.Add(CS, *solid);
+
+     BodySM* bodysm_ptr = occ_lump->get_body();
+     if(bodysm_ptr == NULL)
+          continue;
+
+     bodysm_list.append_unique(bodysm_ptr);
   }
  
   BodySM* bodysm = OCCQueryEngine::instance()->populate_topology_bridge(CS);
@@ -1044,13 +1052,9 @@
   if(bodysm)
   {
      //remove each Lump's body from the BodyList
-     for(int i = 0; i < lump_list.size(); i++)
+     for(int i = 0; i < bodysm_list.size(); i++)
      {
-        Lump* lump = lump_list.get_and_step();
-        OCCLump* occ_lump = CAST_TO(lump, OCCLump);
-        BodySM* bodysm_ptr = occ_lump->get_body();
-        if(bodysm_ptr == NULL)
-      	  continue;
+        BodySM* bodysm_ptr = bodysm_list.get_and_step();
 
         OCCQueryEngine::instance()->unhook_BodySM_from_OCC(bodysm_ptr);
      }

Modified: cgm/trunk/geom/OCC/OCCQueryEngine.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCQueryEngine.cpp	2008-02-27 23:27:57 UTC (rev 1624)
+++ cgm/trunk/geom/OCC/OCCQueryEngine.cpp	2008-02-28 20:25:04 UTC (rev 1625)
@@ -1422,7 +1422,6 @@
        occ_lump->remove_body();
      unhook_Lump_from_OCC(lump);
   }
-
   return unhook_BodySM_from_OCC(bodysm);
 }
 
@@ -1458,6 +1457,7 @@
      BodyList->remove(occ_body_find);
   else
      BodyList->remove(occ_body);
+  //delete shape;
   delete shape;
   delete bodysm;
 } 




More information about the cgma-dev mailing list