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

janehu at mcs.anl.gov janehu at mcs.anl.gov
Mon Jan 7 12:40:57 CST 2008


Author: janehu
Date: 2008-01-07 12:40:57 -0600 (Mon, 07 Jan 2008)
New Revision: 1509

Modified:
   cgm/trunk/geom/OCC/OCCBody.cpp
   cgm/trunk/geom/OCC/OCCBody.hpp
Log:
for moving/reflecting etc. funtions, OCC operation gives a new
object, need to update for body/lump of their underling CompSolid/solid. now crashs at lump->set_TopoDS_Solid(TopoDS::Solid(M(i))); need to investigate.

Modified: cgm/trunk/geom/OCC/OCCBody.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCBody.cpp	2008-01-04 01:42:37 UTC (rev 1508)
+++ cgm/trunk/geom/OCC/OCCBody.cpp	2008-01-07 18:40:57 UTC (rev 1509)
@@ -66,6 +66,7 @@
 
 void OCCBody::lumps(DLIList<Lump*>& my_lumps)
 {
+  myLumps.clean_out();
   myLumps += my_lumps;
 }
 
@@ -204,13 +205,14 @@
 
 //----------------------------------------------------------------
 // Function: reflect
-// Description: reflect the body about a exis
+// Description: reflect the body about an plane given the normal
+//              vector.
 //
 // Author: Jane Hu
 //----------------------------------------------------------------
 CubitStatus OCCBody::reflect( double reflect_axis_x,
-                                double reflect_axis_y,
-                                double reflect_axis_z )
+                              double reflect_axis_y,
+                              double reflect_axis_z )
 {
   gp_Pnt aOrigin(0,0,0);
   gp_Dir aDir(reflect_axis_x, reflect_axis_y,reflect_axis_z); 
@@ -220,11 +222,37 @@
   aTrsf.SetMirror(anAx2);
 
   BRepBuilderAPI_Transform aBRepTrsf(*myTopoDSShape, aTrsf); 
+  TopoDS_Shape shape = aBRepTrsf.ModifiedShape(*myTopoDSShape);
+  
+  update_OCC_entity(shape);
   update_bounding_box();
   return CUBIT_SUCCESS;
 }
 
 //----------------------------------------------------------------
+// Function: private function to update the core compsolid and      
+//           for any movement of the body.
+// Note:     input shape must have the same number of CompSolids
+//           as the body's lumps number.
+// Author: Jane Hu
+//----------------------------------------------------------------
+CubitStatus OCCBody::update_OCC_entity( TopoDS_Shape shape) 
+{
+  TopoDS_CompSolid compsolid = TopoDS::CompSolid(shape);
+  set_TopoDS_Shape(compsolid);
+
+  //set the lumps
+  DLIList<Lump *> lumps;
+  lumps = this->lumps();
+  TopTools_IndexedMapOfShape M;
+  TopExp::MapShapes(*myTopoDSShape, TopAbs_SOLID, M);
+  for (int i = 0; i < lumps.size(); i++)
+  {
+     OCCLump *lump = CAST_TO(lumps.get_and_step(), OCCLump);
+     lump->set_TopoDS_Solid(TopoDS::Solid(M(i)));
+  }
+}
+//----------------------------------------------------------------
 // Function: update_bounding_box
 // Description: calculate for bounding box of this OCCBody
 //

Modified: cgm/trunk/geom/OCC/OCCBody.hpp
===================================================================
--- cgm/trunk/geom/OCC/OCCBody.hpp	2008-01-04 01:42:37 UTC (rev 1508)
+++ cgm/trunk/geom/OCC/OCCBody.hpp	2008-01-07 18:40:57 UTC (rev 1509)
@@ -61,7 +61,7 @@
     //- associated with the object.
   
   TopoDS_CompSolid *get_TopoDS_Shape() {return myTopoDSShape; }
-  void set_TopoDS_Shape( TopoDS_CompSolid shape){*myTopoDSShape = shape;}
+  void set_TopoDS_Shape( TopoDS_CompSolid theshape){*myTopoDSShape = theshape;}
 
   virtual CubitStatus get_transforms( CubitTransformMatrix &tfm );
   //R CubitStatus
@@ -175,6 +175,7 @@
   TopoDS_CompSolid *myTopoDSShape;
 
   CubitBox boundingbox;
+  CubitStatus update_OCC_entity( TopoDS_Shape shape); //update the lumps
 };
 
 




More information about the cgma-dev mailing list