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

janehu at mcs.anl.gov janehu at mcs.anl.gov
Mon Nov 24 13:08:50 CST 2008


Author: janehu
Date: 2008-11-24 13:08:50 -0600 (Mon, 24 Nov 2008)
New Revision: 2281

Modified:
   cgm/trunk/geom/OCC/OCCQueryEngine.cpp
Log:
Make sure no degenerated curve or surface will generate from populate_topology_bridge. Fix for user reported bug.

Modified: cgm/trunk/geom/OCC/OCCQueryEngine.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCQueryEngine.cpp	2008-11-24 17:27:15 UTC (rev 2280)
+++ cgm/trunk/geom/OCC/OCCQueryEngine.cpp	2008-11-24 19:08:50 UTC (rev 2281)
@@ -1318,6 +1318,8 @@
     Surface* face =
       populate_topology_bridge(topo_face, build_body);
     
+    if(!face)
+      continue;
     OCCSurface *occ_surface = CAST_TO(face, OCCSurface);
     CubitBoolean exist = CUBIT_FALSE;
     OCCCoFace * coface = NULL;
@@ -1364,6 +1366,12 @@
     *poface = aShape;
     surface = new OCCSurface(poface);
 
+    double tol = get_sme_resabs_tolerance();
+    if(surface->measure() < tol * tol)
+    {
+      delete surface;
+      return (Surface*) NULL;
+    } 
     if(PRINT_RESULT)
       PRINT_INFO("Adding faces.\n");
     iTotalTBCreated++;
@@ -1434,6 +1442,8 @@
   for (Ex.Init(aShape); Ex.More(); Ex.Next())
   {
     Curve* curve = populate_topology_bridge(Ex.Current());
+    if(!curve)
+      continue;
     OCCCurve *occ_curve = CAST_TO(curve, OCCCurve);
     DLIList<OCCLoop*> loops = occ_curve->loops();
     CubitBoolean exist = CUBIT_FALSE;
@@ -1524,6 +1534,11 @@
       *poedge = aShape;
       iTotalTBCreated++;
       curve = new OCCCurve(poedge);
+      if(curve->measure() < get_sme_resabs_tolerance())
+      {
+        delete curve;
+        return (Curve*) NULL;
+      }
       OCCMap->Bind(*poedge, iTotalTBCreated);
       OccToCGM->insert(valType(iTotalTBCreated,
 			       (TopologyBridge*)curve));




More information about the cgma-dev mailing list