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

janehu at mcs.anl.gov janehu at mcs.anl.gov
Mon Nov 3 13:45:56 CST 2008


Author: janehu
Date: 2008-11-03 13:45:56 -0600 (Mon, 03 Nov 2008)
New Revision: 2201

Modified:
   cgm/trunk/geom/GeometryModifyTool.cpp
   cgm/trunk/geom/OCC/OCCModifyEngine.cpp
   cgm/trunk/test/modify.cpp
Log:
Added returning body for the sweep_along_curve interface in geom level and passed tests.

Modified: cgm/trunk/geom/GeometryModifyTool.cpp
===================================================================
--- cgm/trunk/geom/GeometryModifyTool.cpp	2008-11-03 19:08:03 UTC (rev 2200)
+++ cgm/trunk/geom/GeometryModifyTool.cpp	2008-11-03 19:45:56 UTC (rev 2201)
@@ -3568,6 +3568,14 @@
    if (!sweep_finish("along_curve", body_list, result_list, changed_new_ids))
     status = CUBIT_FAILURE;
 
+   body_list.clean_out();
+   for(int i = 0; i < result_list.size(); i++)
+   {
+     Body* body = CAST_TO(result_list.get_and_step()->topology_entity(),Body );
+     if(body)
+       body_list.append(body);
+   }
+   CAST_LIST( body_list, ref_ent_list, RefEntity);
    return status;
 
 }

Modified: cgm/trunk/geom/OCC/OCCModifyEngine.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCModifyEngine.cpp	2008-11-03 19:08:03 UTC (rev 2200)
+++ cgm/trunk/geom/OCC/OCCModifyEngine.cpp	2008-11-03 19:45:56 UTC (rev 2201)
@@ -4354,12 +4354,6 @@
   BRepLib_FuseEdges fuser(wire);
   fuser.SetConcatBSpl();
   fuser.Perform();
-  int removed_vertices = fuser.NbVertices();
-  if(removed_vertices < num_edges - 1)
-  {
-    PRINT_ERROR("The curve_list provided has to form a G1 continuous spline.\n");
-    return CUBIT_FAILURE;
-  }
   TopoDS_Shape  spline = fuser.Shape();
   wire = TopoDS::Wire(spline);
 
@@ -4386,6 +4380,11 @@
 
     //sweep along the wire
     BRepOffsetAPI_MakePipe maker(wire, toposhape);
+    if(!maker.IsDone())
+    {
+      PRINT_ERROR("Can't sweep along the provided curve(s).\n");
+      continue;
+    }
     TopoDS_Shape newShape = maker.Shape();
     
     tbs += OCCQueryEngine::instance()->populate_topology_bridge(newShape);

Modified: cgm/trunk/test/modify.cpp
===================================================================
--- cgm/trunk/test/modify.cpp	2008-11-03 19:08:03 UTC (rev 2200)
+++ cgm/trunk/test/modify.cpp	2008-11-03 19:45:56 UTC (rev 2201)
@@ -865,5 +865,40 @@
   d = body->measure();
   //d = 8.07227
 
+  //test sweep_along_curve function
+  //sweep along a staight curve with draft
+  refentities.clean_out();
+  refentities.append(rotate_face);
+  CubitVector pt4(0,1,0);
+  RefVertex* vt4 = gmti->make_RefVertex(pt4);
+  RefEdge* edge3 = gmti->make_RefEdge(STRAIGHT_CURVE_TYPE, vt1, vt4);
+  edges.clean_out();
+  edges.append(edge3);
+  gmti->sweep_along_curve(refentities, edges, 0.087,1);
+  body = CAST_TO(refentities.get(), Body);
+  d = body->measure();
+  //d = 134.7152, theoretical calculation is 135.66363, error 0.67%
+
+  //sweep along two curves which make a G1 continous wire, no draft is performed
+  refentities.clean_out();
+  refentities.append(rotate_face);
+  CubitVector pt5(0,2,7.5);
+  CubitVector pt6(0,0,-7.5);
+  CubitVector pt7(0,1,-15);
+  RefVertex* vt5 = gmti->make_RefVertex(pt7);
+  DLIList<CubitVector*> vector_list;
+  vector_list.append(&pt5);
+  
+  RefEdge* edge4 = gmti->make_RefEdge( SPLINE_CURVE_TYPE, vt1, vt4, vector_list);
+  vector_list.clean_out();
+  vector_list.append(&pt6);
+  RefEdge* edge5 = gmti->make_RefEdge( SPLINE_CURVE_TYPE, vt4, vt5, vector_list);  
+  edges.clean_out();
+  edges.append(edge4);
+  edges.append(edge5);
+  gmti->sweep_along_curve(refentities, edges, 0.087,1);
+  body = CAST_TO(refentities.get(), Body);
+  d = body->measure();
+  //d = 93.697, no effect of draft angle.
   return CUBIT_SUCCESS;
 }




More information about the cgma-dev mailing list