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

janehu at mcs.anl.gov janehu at mcs.anl.gov
Mon May 19 15:21:01 CDT 2008


Author: janehu
Date: 2008-05-19 15:21:01 -0500 (Mon, 19 May 2008)
New Revision: 1825

Modified:
   cgm/trunk/geom/OCC/OCCBody.cpp
   cgm/trunk/geom/OCC/OCCCurve.cpp
   cgm/trunk/geom/OCC/OCCLoop.cpp
   cgm/trunk/geom/OCC/OCCLump.cpp
   cgm/trunk/geom/OCC/OCCModifyEngine.cpp
   cgm/trunk/geom/OCC/OCCPoint.cpp
   cgm/trunk/geom/OCC/OCCQueryEngine.cpp
   cgm/trunk/geom/OCC/OCCShell.cpp
   cgm/trunk/geom/OCC/OCCSurface.cpp
Log:
fixed makept errors, still need one more test on making a spline to pass.

Modified: cgm/trunk/geom/OCC/OCCBody.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCBody.cpp	2008-05-19 20:20:15 UTC (rev 1824)
+++ cgm/trunk/geom/OCC/OCCBody.cpp	2008-05-19 20:21:01 UTC (rev 1825)
@@ -86,9 +86,9 @@
 void OCCBody::set_TopoDS_Shape( TopoDS_CompSolid theshape)
 {
   if(myTopoDSShape)
-    *myTopoDSShape = theshape;
-  else
-    myTopoDSShape = new TopoDS_CompSolid(theshape);
+    delete myTopoDSShape;
+
+  myTopoDSShape = new TopoDS_CompSolid(theshape);
 }
 
 OCCBody::OCCBody(DLIList<Lump*>& my_lumps)
@@ -349,11 +349,13 @@
   TopoDS_CompSolid compsolid;
   if(aBRepTrsf)
   {
-    TopoDS_Shape shape = aBRepTrsf->Shape();
+    TopoDS_Shape shape = aBRepTrsf->ModifiedShape(*myTopoDSShape);
     TopoDS_CompSolid compsolid = TopoDS::CompSolid(shape);
   
     if(OCCQueryEngine::instance()->OCCMap->IsBound(*myTopoDSShape) )
        OCCQueryEngine::instance()->update_OCC_map(*myTopoDSShape, shape);
+    else if (!shape.IsEqual(*myTopoDSShape))
+       set_TopoDS_Shape(compsolid);
   }
 
   //Boolean operation works only on one lump body

Modified: cgm/trunk/geom/OCC/OCCCurve.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCCurve.cpp	2008-05-19 20:20:15 UTC (rev 1824)
+++ cgm/trunk/geom/OCC/OCCCurve.cpp	2008-05-19 20:21:01 UTC (rev 1825)
@@ -117,9 +117,9 @@
 
 void OCCCurve::set_TopoDS_Edge(TopoDS_Edge edge)
 {
-  if(!myTopoDSEdge)
-    myTopoDSEdge = new TopoDS_Edge;
-  *myTopoDSEdge = edge;
+  if(myTopoDSEdge)
+    delete myTopoDSEdge;
+  myTopoDSEdge = new TopoDS_Edge(edge);
 }
 
 //-------------------------------------------------------------------------

Modified: cgm/trunk/geom/OCC/OCCLoop.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCLoop.cpp	2008-05-19 20:20:15 UTC (rev 1824)
+++ cgm/trunk/geom/OCC/OCCLoop.cpp	2008-05-19 20:21:01 UTC (rev 1825)
@@ -68,9 +68,9 @@
 
 void OCCLoop::set_TopoDS_Wire(TopoDS_Wire loop)
 {
-   if(!myTopoDSWire)
-     myTopoDSWire = new TopoDS_Wire;
-   *myTopoDSWire = loop;
+   if(myTopoDSWire)
+     delete myTopoDSWire;
+   myTopoDSWire = new TopoDS_Wire(loop);
 }
 //-------------------------------------------------------------------------
 // Purpose       : Tear down topology

Modified: cgm/trunk/geom/OCC/OCCLump.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCLump.cpp	2008-05-19 20:20:15 UTC (rev 1824)
+++ cgm/trunk/geom/OCC/OCCLump.cpp	2008-05-19 20:21:01 UTC (rev 1825)
@@ -82,9 +82,9 @@
 void OCCLump::set_TopoDS_Solid(TopoDS_Solid solid)
 {
   if(myTopoDSSolid)
-    *myTopoDSSolid = solid;
-  else
-    myTopoDSSolid = new TopoDS_Solid(solid);
+    delete myTopoDSSolid ;
+
+  myTopoDSSolid = new TopoDS_Solid(solid);
 }
 //-------------------------------------------------------------------------
 // Purpose       : Find centroid

Modified: cgm/trunk/geom/OCC/OCCModifyEngine.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCModifyEngine.cpp	2008-05-19 20:20:15 UTC (rev 1824)
+++ cgm/trunk/geom/OCC/OCCModifyEngine.cpp	2008-05-19 20:21:01 UTC (rev 1825)
@@ -1143,20 +1143,7 @@
   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.
+  //Create a compsolid shape, copy all BodySM's solids to create new compbody 
   DLIList<BodySM*> bodysm_list;
   TopoDS_CompSolid CS;
   BRep_Builder B;
@@ -1174,7 +1161,9 @@
         return (BodySM *)NULL;
      }
      TopoDS_Solid* solid = occ_lump->get_TopoDS_Solid();
-     B.Add(CS, *solid);
+     BRepBuilderAPI_Copy api_copy(*solid);
+     TopoDS_Shape newShape = api_copy.ModifiedShape(*solid);
+     B.Add(CS, newShape);
   }
  
   BodySM* bodysm = OCCQueryEngine::instance()->populate_topology_bridge(CS);

Modified: cgm/trunk/geom/OCC/OCCPoint.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCPoint.cpp	2008-05-19 20:20:15 UTC (rev 1824)
+++ cgm/trunk/geom/OCC/OCCPoint.cpp	2008-05-19 20:21:01 UTC (rev 1825)
@@ -88,9 +88,9 @@
 
 void OCCPoint::set_TopoDS_Vertex(TopoDS_Vertex vertex)
 {
-  if(!myTopoDSVertex)
-    myTopoDSVertex = new TopoDS_Vertex;
-  *myTopoDSVertex = vertex;
+  if(myTopoDSVertex)
+    delete myTopoDSVertex;
+  myTopoDSVertex = new TopoDS_Vertex(vertex);
 }
 //-------------------------------------------------------------------------
 // Purpose       : The purpose of this function is to append a

Modified: cgm/trunk/geom/OCC/OCCQueryEngine.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCQueryEngine.cpp	2008-05-19 20:20:15 UTC (rev 1824)
+++ cgm/trunk/geom/OCC/OCCQueryEngine.cpp	2008-05-19 20:21:01 UTC (rev 1825)
@@ -1254,6 +1254,8 @@
     if(standalone)
       occ_surface->set_shell(shell);
   }
+  if(aShape.Orientation() == TopAbs_REVERSED)
+    cofaces_new.reverse();
   shell->cofaces(cofaces_new);
   return shell;
 }
@@ -1364,6 +1366,8 @@
       occ_curve->add_loop(loop);
     }
   }
+  if(aShape.Orientation() == TopAbs_REVERSED)
+    coedges_new.reverse();
   loop->coedges(coedges_new);
 
   return loop;
@@ -1587,10 +1591,10 @@
   CubitStatus stat = unhook_BodySM_from_OCC(bodysm);
 
   for(int j = 0; j < shell_list.size(); j++)
-     delete shell_list.pop();
+     delete shell_list.get_and_step();
 
   for(int i =0; i < lumps.size(); i++)
-     delete lumps.pop(); 
+     delete lumps.get_and_step(); 
 
   BodyList->remove(occ_body);
   delete bodysm;

Modified: cgm/trunk/geom/OCC/OCCShell.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCShell.cpp	2008-05-19 20:20:15 UTC (rev 1824)
+++ cgm/trunk/geom/OCC/OCCShell.cpp	2008-05-19 20:21:01 UTC (rev 1825)
@@ -82,9 +82,10 @@
 
 void OCCShell::set_TopoDS_Shell(TopoDS_Shell shell)
 {
-  if (!myTopoDSShell)
-    myTopoDSShell = new TopoDS_Shell();
-  *myTopoDSShell = shell;
+  if (myTopoDSShell)
+    delete myTopoDSShell;
+
+  myTopoDSShell = new TopoDS_Shell(shell);
 }
 
 //-------------------------------------------------------------------------

Modified: cgm/trunk/geom/OCC/OCCSurface.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCSurface.cpp	2008-05-19 20:20:15 UTC (rev 1824)
+++ cgm/trunk/geom/OCC/OCCSurface.cpp	2008-05-19 20:21:01 UTC (rev 1825)
@@ -101,9 +101,9 @@
 
 void OCCSurface::set_TopoDS_Face(TopoDS_Face face)
 {
-  if(!myTopoDSFace)
-    myTopoDSFace = new TopoDS_Face; 
-  *myTopoDSFace = face;
+  if(myTopoDSFace)
+    delete myTopoDSFace;
+  myTopoDSFace = new TopoDS_Face(face); 
 }
 
 




More information about the cgma-dev mailing list