[cgma-dev] r1883 - in cgm/trunk: geom/OCC test

janehu at mcs.anl.gov janehu at mcs.anl.gov
Mon Jun 9 14:28:19 CDT 2008


Author: janehu
Date: 2008-06-09 14:28:19 -0500 (Mon, 09 Jun 2008)
New Revision: 1883

Modified:
   cgm/trunk/geom/OCC/OCCCurve.cpp
   cgm/trunk/geom/OCC/OCCModifyEngine.cpp
   cgm/trunk/geom/OCC/OCCModifyEngine.hpp
   cgm/trunk/test/modify.cpp
Log:
Test-passed using point to split curve on body.

Modified: cgm/trunk/geom/OCC/OCCCurve.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCCurve.cpp	2008-06-09 18:11:52 UTC (rev 1882)
+++ cgm/trunk/geom/OCC/OCCCurve.cpp	2008-06-09 19:28:19 UTC (rev 1883)
@@ -454,7 +454,7 @@
 		  }
 	  }
   }
-  if(global_newVal < 10^10)
+  if(global_newVal > 0.0)
   {
     closest_location = CubitVector(newP.X(), newP.Y(), newP.Z());
     if (tangent_ptr != NULL) {

Modified: cgm/trunk/geom/OCC/OCCModifyEngine.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCModifyEngine.cpp	2008-06-09 18:11:52 UTC (rev 1882)
+++ cgm/trunk/geom/OCC/OCCModifyEngine.cpp	2008-06-09 19:28:19 UTC (rev 1883)
@@ -2976,6 +2976,26 @@
   }
 
   DLIList<BodySM*> new_body_list;
+  shape_to_bodySM(shape_list, new_body_list);
+  
+  if (new_body_list.size() == 1)
+  {
+    new_body = new_body_list.get();
+    return CUBIT_SUCCESS;
+  }
+  return CUBIT_FAILURE;
+}
+
+//===============================================================================
+// Function   : shape_to_bodySM
+// Member Type: PRIVATE
+// Description: After imprint, update shape list to bodySM_list
+// Author     : Jane Hu
+// Date       : 06/08
+//===============================================================================
+void OCCModifyEngine::shape_to_bodySM( DLIList<TopoDS_Shape*> shape_list,
+                                       DLIList<BodySM*>& new_body_list)const
+{
   for(int j = 0; j < shape_list.size(); j ++)
   {
     DLIList<TopologyBridge*> tbs;
@@ -2998,13 +3018,6 @@
       new_body_list.append_unique(CAST_TO(tbs.get(),BodySM));
     }
   }
-
-  if (new_body_list.size() == 1)
-  {
-    new_body = new_body_list.get();
-    return CUBIT_SUCCESS;
-  }
-  return CUBIT_FAILURE;
 }
 
 //===============================================================================
@@ -3046,7 +3059,9 @@
     CubitBoolean on_curve = CUBIT_FALSE;
     for (int j = 0; j < vector_list.size(); j ++)
     {
-      CubitVector* v = vector_list.get_and_step();
+      CubitVector* v = vector_list[j];
+      if(v == NULL)
+        continue;
       for (int k = 0;  k < curves.size(); k ++)
       {
          OCCCurve* curve = curves.get_and_step();
@@ -3066,9 +3081,24 @@
            TopoDS_Vertex vertex = BRepBuilderAPI_MakeVertex(pt);
            double param = curve->u_from_position(*v);
            splitor.Add(vertex, param, edge);
+           
+           //update the curve_list
+           TopTools_ListOfShape edge_shapes;
+           edge_shapes.Assign(splitor.DescendantShapes(edge));
+           while(edge_shapes.Extent())
+           {
+             TopoDS_Shape edge_shape = edge_shapes.First();
+             TopoDS_Edge occ_edge = TopoDS::Edge(edge_shape);
+             OCCCurve* test_curve; 
+             test_curve = CAST_TO(OCCQueryEngine::instance()->populate_topology_bridge(occ_edge), OCCCurve);
+             if(test_curve)
+               curves.append(test_curve);
+             edge_shapes.RemoveFirst();
+           }
+           curves.remove(curve);
+           
            TopTools_ListOfShape shapes;
            shapes.Assign(splitor.DescendantShapes(*from_shape));
-           BRepBuilderAPI_MakeShape* pointor = NULL;
            if(from_shape->TShape()->ShapeType() ==TopAbs_COMPSOLID)
              OCCBody::update_OCC_entity(*from_shape, shapes.First(), 
                     (BRepBuilderAPI_MakeShape*) NULL, &splitor);
@@ -3086,6 +3116,10 @@
              OCCSurface::update_OCC_entity(TopoDS::Face(*from_shape), 
                     shapes.First(), 
                     (BRepBuilderAPI_MakeShape*) NULL, &splitor);
+
+           from_shape->Nullify();
+           delete from_shape;
+           from_shape = new TopoDS_Shape(shapes.First());
            break;
          }  
        } 
@@ -3110,6 +3144,9 @@
        }
     }
   }       
+
+  shape_to_bodySM(shape_list, new_body_list);
+  
   return stat;
 }
 

Modified: cgm/trunk/geom/OCC/OCCModifyEngine.hpp
===================================================================
--- cgm/trunk/geom/OCC/OCCModifyEngine.hpp	2008-06-09 18:11:52 UTC (rev 1882)
+++ cgm/trunk/geom/OCC/OCCModifyEngine.hpp	2008-06-09 19:28:19 UTC (rev 1883)
@@ -681,6 +681,8 @@
                                 DLIList<TopoDS_Face*>& face_list,
                                 DLIList<TopoDS_Shape*>& shape_list,
                                 bool keep_old ) const; 
+ void shape_to_bodySM( DLIList<TopoDS_Shape*> shape_list,
+                       DLIList<BodySM*>& new_body_list)const;
 } ;
 
 #endif

Modified: cgm/trunk/test/modify.cpp
===================================================================
--- cgm/trunk/test/modify.cpp	2008-06-09 18:11:52 UTC (rev 1882)
+++ cgm/trunk/test/modify.cpp	2008-06-09 19:28:19 UTC (rev 1883)
@@ -313,10 +313,6 @@
       face_list.step();
   }
   assert(face_list.size() == 1);
-  new_bodies.clean_out();
-  vertices.clean_out();
-  cp_from_body2->ref_vertices(vertices);
-  vertices.clean_out();
   ref_edges.step_and_get()->ref_vertices(vertices);
   stat = gmti->imprint(unimprint_faces, ref_edges, new_bodies, CUBIT_FALSE);
 
@@ -332,11 +328,21 @@
       face_list.step();
   }
 
-  vertices.clean_out();
-  face_list.get()->ref_vertices(vertices);
-  vertices.clean_out();
-  ref_edges.step_and_get()->ref_vertices(vertices);
+  //imprint a point on an edge, split it
+  CubitVector pp1(10,1,8);
+  CubitVector pp2(10,5,9);
+  CubitVector pp3(10,1,6);
+  DLIList<CubitVector*> vectors;
+  vectors.append(&pp1);
+  vectors.append(&pp2);
+  vectors.append(&pp3);
+  from_bodies.clean_out();
+  from_bodies.append(cp_from_body2);
+  new_bodies.clean_out(); 
+  stat = gmti->imprint(from_bodies, vectors, new_bodies, CUBIT_FALSE);
 
+  n = new_bodies.get()->num_ref_edges();//n = 17
+
   OCCBody* check_body = CAST_TO(face_list.get()->body()->get_body_sm_ptr(), OCCBody);
   stat = gmti->imprint(face_list, ref_edges, new_bodies, CUBIT_FALSE);
 




More information about the cgma-dev mailing list