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

jiangtao_ma at yahoo.com jiangtao_ma at yahoo.com
Fri Nov 18 12:37:45 CST 2011


Author: janehu
Date: 2011-11-18 12:37:42 -0600 (Fri, 18 Nov 2011)
New Revision: 5219

Modified:
   cgm/trunk/geom/OCC/OCCBody.cpp
   cgm/trunk/geom/OCC/OCCModifyEngine.cpp
   cgm/trunk/geom/OCC/OCCModifyEngine.hpp
Log:
Fixed the mcnp2cad/cone, cone2, cone3 cases, it passed cgm make check, rgg/assygen 7 is still working at speed 9.9 min now. Since it introduces boolean operation for imprint, it's pending for Tim's approval for possible body pointer changes.

Modified: cgm/trunk/geom/OCC/OCCBody.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCBody.cpp	2011-11-17 00:32:00 UTC (rev 5218)
+++ cgm/trunk/geom/OCC/OCCBody.cpp	2011-11-18 18:37:42 UTC (rev 5219)
@@ -554,9 +554,28 @@
   //set the Shells
   TopTools_IndexedMapOfShape M;
   TopExp::MapShapes(old_shape, TopAbs_SOLID, M);
+  TopTools_IndexedMapOfShape M_new;
+  TopExp::MapShapes(new_shape, TopAbs_SOLID, M_new);
   TopTools_ListOfShape shapes;
   TopoDS_Shape shape;
 
+  CubitBoolean updated = CUBIT_FALSE;	
+  if(!old_shape.IsNull() && old_shape.ShapeType() == TopAbs_COMPOUND && 
+     !new_shape.IsNull() && new_shape.ShapeType() == TopAbs_COMPOUND &&
+     !old_shape.IsSame(new_shape) && M.Extent() == M_new.Extent())
+  {
+    //By updating underling solids, shells etc., the old_shape will get changed.
+    //trying to make sure the the number of each entity in the old and new 
+    //shapes are the same, which means that nothing is delete, that we can 
+    //update the map here. Otherwise, when deleting solids, it'll delete the
+    //the old body and create new body. This is Ok for general boolean operation    //except imprint when booleans are called, usually the original body are
+    // supposed to be kept. 
+    updated = CUBIT_TRUE;
+    OCCQueryEngine::instance()->update_OCC_map(old_shape, new_shape);
+  }
+ 
+  DLIList<int> new_solid_nums;
+  DLIList<int> unfound_nums;
   for(int ii=1; ii<=M.Extent(); ii++)
   {
     TopoDS_Solid solid = TopoDS::Solid(M(ii));
@@ -588,10 +607,38 @@
     }
     else if(op->IsDeleted(solid))
     {
-       TopTools_IndexedMapOfShape M_new;
-       TopExp::MapShapes(new_shape, TopAbs_SOLID, M_new);
        if (M_new.Extent()== 1)
          shape = M_new(1);
+       else if(M_new.Extent() > 1)
+       {
+         GProp_GProps myProps;
+         BRepGProp::VolumeProperties(solid, myProps);
+         double bf_mass = myProps.Mass();
+         gp_Pnt old_center = myProps.CentreOfMass();
+         CubitBoolean found = CUBIT_FALSE;
+         for(int l = 1; l <= M_new.Extent(); l++)
+         {
+           BRepGProp::VolumeProperties(M_new(l), myProps);


More information about the cgma-dev mailing list