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

jiangtao_ma at yahoo.com jiangtao_ma at yahoo.com
Fri Jan 6 12:27:57 CST 2012


Author: janehu
Date: 2012-01-06 12:27:55 -0600 (Fri, 06 Jan 2012)
New Revision: 5293

Modified:
   cgm/trunk/geom/OCC/OCCBody.cpp
   cgm/trunk/geom/OCC/OCCBody.hpp
   cgm/trunk/geom/OCC/OCCModifyEngine.cpp
   cgm/trunk/geom/OCC/OCCQueryEngine.cpp
   cgm/trunk/geom/OCC/OCCShell.cpp
   cgm/trunk/geom/OCC/OCCSurface.cpp
Log:
Fixed the bug that sometimes shell can't find its parent by adding a overload function to return body's shape no matter what type it has. Before this function only returns body's Compound shape. Passed make check in cgm.

Modified: cgm/trunk/geom/OCC/OCCBody.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCBody.cpp	2012-01-06 18:24:46 UTC (rev 5292)
+++ cgm/trunk/geom/OCC/OCCBody.cpp	2012-01-06 18:27:55 UTC (rev 5293)
@@ -81,10 +81,42 @@
 TopoDS_Compound* OCCBody::get_TopoDS_Shape()
 {
   if (myTopoDSShape && !myTopoDSShape->IsNull())
+  {
     assert(myTopoDSShape->ShapeType() == TopAbs_COMPOUND);
-  return myTopoDSShape;
+    return myTopoDSShape;
+  }
 }
 
+void OCCBody::get_TopoDS_Shape(TopoDS_Shape *& shape)
+{
+  if (myTopoDSShape && !myTopoDSShape->IsNull())
+  {
+    assert(myTopoDSShape->ShapeType() == TopAbs_COMPOUND);
+    shape =  myTopoDSShape;
+  }
+  else
+  {
+    DLIList<Lump*> lumps = this->lumps();
+    DLIList<OCCShell*> shells = this->shells();
+    DLIList<OCCSurface*> surfaces = this->my_sheet_surfaces();
+    if(lumps.size() + shells.size() + surfaces.size() == 1)
+    {
+      if(lumps.size() == 1)
+      {
+        OCCLump* lump = CAST_TO(lumps.get(), OCCLump);
+        assert(lump != NULL);
+        shape = CAST_TO(lump, OCCLump)->get_TopoDS_Solid();
+      }
+      else if(shells.size() == 1)
+        shape = shells.get()->get_TopoDS_Shell(); 
+      else
+        shape = surfaces.get()->get_TopoDS_Face();
+    }
+    else
+      shape = NULL;
+  }
+}
+
 void OCCBody::set_sheet_surfaces(DLIList<OCCSurface*> surfaces)
 {
   mySheetSurfaces = surfaces;

Modified: cgm/trunk/geom/OCC/OCCBody.hpp
===================================================================


More information about the cgma-dev mailing list