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

janehu at mcs.anl.gov janehu at mcs.anl.gov
Mon Oct 27 13:44:35 CDT 2008


Author: janehu
Date: 2008-10-27 13:44:34 -0500 (Mon, 27 Oct 2008)
New Revision: 2175

Modified:
   cgm/trunk/geom/OCC/OCCModifyEngine.cpp
   cgm/trunk/test/modify.cpp
Log:
Finished testing for sweep_rotational for face and curve.

Modified: cgm/trunk/geom/OCC/OCCModifyEngine.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCModifyEngine.cpp	2008-10-24 20:04:49 UTC (rev 2174)
+++ cgm/trunk/geom/OCC/OCCModifyEngine.cpp	2008-10-27 18:44:34 UTC (rev 2175)
@@ -4167,13 +4167,15 @@
         DLIList<OCCPoint*> point_list;
         curve->get_points(point_list);
         assert(2 == point_list.size());
+        GeometryType type = curve->geometry_type();
         start = point_list.get_and_step()->coordinates();
         end = point_list.get()->coordinates();
-
+        CubitBoolean start_int = CUBIT_FALSE;
+        CubitBoolean end_int = CUBIT_FALSE;
         if(intersect_pts.size() > 0)
         {
+          double tol = OCCQueryEngine::instance()->get_sme_resabs_tolerance();
           CubitBoolean non_int = CUBIT_FALSE;
-          double tol = OCCQueryEngine::instance()->get_sme_resabs_tolerance();
           for(int i = 0; i < intersect_pts.size(); i++)
           {
              CubitVector prt = *(intersect_pts.get_and_step());
@@ -4183,10 +4185,19 @@
                 non_int = CUBIT_TRUE;
                 PRINT_ERROR("Only curves with no intersection point with the axis can be revolve-swept.\n");
                 break;
-              }
+             }
+             else if(prt.distance_between(start) <= tol)
+                start_int = CUBIT_TRUE;
+             else if(prt.distance_between(end) <= tol)
+                end_int = CUBIT_TRUE;
           }
           if(non_int)
             continue;
+          if(start_int && end_int && type == STRAIGHT_CURVE_TYPE)
+          {
+            PRINT_ERROR("Sweep along curve itself is not allowed.\n");
+            continue;
+          } 
         }
       }
       else

Modified: cgm/trunk/test/modify.cpp
===================================================================
--- cgm/trunk/test/modify.cpp	2008-10-24 20:04:49 UTC (rev 2174)
+++ cgm/trunk/test/modify.cpp	2008-10-27 18:44:34 UTC (rev 2175)
@@ -810,7 +810,8 @@
   RefVertex* vt1 = gmti->make_RefVertex(pt1);
   RefVertex* vt2 = gmti->make_RefVertex(pt2);
   RefVertex* vt3 = gmti->make_RefVertex(pt3);
-  RefEdge* edge1 = gmti->make_RefEdge(vt1, vt2, rotate_face, vt3);
+  RefEdge* edge1 = gmti->make_RefEdge(ARC_CURVE_TYPE, vt1, vt3, &pt2, 
+                  CUBIT_FORWARD );
   CubitVector apoint(0,-0.5,15);
   refentities.clean_out();
   refentities.append(edge1);
@@ -821,11 +822,48 @@
   //   make_solid option set to be true.
   refentities.append(edge1);
   CubitVector rotate_axis(0, 1, 0);
-  //  gmti->sweep_rotational(refentities, center, rotate_axis, angle, 0, 0, 1,
+  gmti->sweep_rotational(refentities, center, rotate_axis, angle, 0, 0, 1,
                          CUBIT_FALSE, CUBIT_TRUE, CUBIT_FALSE);
-    //body = CAST_TO(refentities.get(), Body);
-    //d = body->measure();
-  //d = 19.7292
+  body = CAST_TO(refentities.get(), Body);
+  d = body->measure();
+  //d = 1.046667
 
+  //8. open curve rotates along an intersecting axis at end points with
+  //   make_solid option set to be false.
+  refentities.clean_out();
+  refentities.append(edge1);
+  gmti->sweep_rotational(refentities, center, rotate_axis, -angle, 0, 0, 1,
+                         CUBIT_FALSE, CUBIT_FALSE, CUBIT_FALSE);
+  body = CAST_TO(refentities.get(), Body);
+  d = body->measure();
+  //d = 3.14
+
+  //9. staight line rotate about itself fails.
+  RefEdge* edge2 = gmti->make_RefEdge(vt1, vt2, rotate_face);
+  refentities.clean_out();
+  refentities.append(edge2);
+  gmti->sweep_rotational(refentities, center, rotate_axis, -angle, 0, 0, 1,
+                         CUBIT_FALSE, CUBIT_FALSE, CUBIT_FALSE); 
+
+  //10. open curve rotates along a non-intersect axis with make_solid option
+  //    set to be true.
+  refentities.append(edge1);
+  CubitVector off_center(1,0,15);
+  gmti->sweep_rotational(refentities, off_center, rotate_axis, angle, 0, 0, 1,
+                         CUBIT_FALSE, CUBIT_TRUE, CUBIT_FALSE);
+  body = CAST_TO(refentities.get(), Body);
+  d = body->measure();
+  //d = 5.0828
+
+  //11. open curve rotates along a non-intersect axis with make_solid option
+  //    set to be false.
+  refentities.clean_out();
+  refentities.append(edge1);
+  gmti->sweep_rotational(refentities, off_center, rotate_axis, -angle, 0, 0, 1,
+                         CUBIT_FALSE, CUBIT_FALSE, CUBIT_FALSE);
+  body = CAST_TO(refentities.get(), Body);
+  d = body->measure();
+  //d = 8.07227
+
   return CUBIT_SUCCESS;
 }




More information about the cgma-dev mailing list