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

janehu at mcs.anl.gov janehu at mcs.anl.gov
Mon Dec 8 14:25:04 CST 2008


Author: janehu
Date: 2008-12-08 14:25:04 -0600 (Mon, 08 Dec 2008)
New Revision: 2474

Modified:
   cgm/trunk/geom/OCC/OCCDrawTool.cpp
   cgm/trunk/geom/OCC/OCCQueryEngine.cpp
Log:
Found a bug in OCCDrawTool in where Occsurface is wrongly deleted, hence later export operation will crash. Fixed it.

Modified: cgm/trunk/geom/OCC/OCCDrawTool.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCDrawTool.cpp	2008-12-08 19:57:06 UTC (rev 2473)
+++ cgm/trunk/geom/OCC/OCCDrawTool.cpp	2008-12-08 20:25:04 UTC (rev 2474)
@@ -215,7 +215,6 @@
 
   CubitStatus stat;
   stat = draw_surface(surf_ptr, color, tessellate, flush);
-  OQE->delete_solid_model_entities( surf_ptr );
 
   return stat;
 }

Modified: cgm/trunk/geom/OCC/OCCQueryEngine.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCQueryEngine.cpp	2008-12-08 19:57:06 UTC (rev 2473)
+++ cgm/trunk/geom/OCC/OCCQueryEngine.cpp	2008-12-08 20:25:04 UTC (rev 2474)
@@ -25,6 +25,8 @@
 #include "BRepBuilderAPI_MakeSolid.hxx"
 #include "OCCShapeAttributeSet.hpp"
 #include "BRepBuilderAPI_MakeShell.hxx"
+#include "GProp_GProps.hxx"
+#include "BRepGProp.hxx"
 #include "BRepTools_WireExplorer.hxx"
 #include "TColgp_Array1OfPnt.hxx"
 #include "Poly_Array1OfTriangle.hxx"
@@ -1368,19 +1370,19 @@
                                                   CubitBoolean build_body)
 {
   OCCSurface *surface = NULL;
+  GProp_GProps myProps;
+  BRepGProp::SurfaceProperties(aShape, myProps);
+  double area = myProps.Mass();
+  double tol = get_sme_resabs_tolerance();
+  if(area < tol * tol)
+    return (Surface*) NULL;
+
   if (!OCCMap->IsBound(aShape))
   {
     TopoDS_Face *poface = new TopoDS_Face;
     *poface = aShape;
     surface = new OCCSurface(poface);
 
-    double tol = get_sme_resabs_tolerance();
-    if(surface->measure() < tol * tol)
-    {
-      delete surface;
-      return (Surface*) NULL;
-    } 
-
     iTotalTBCreated++;
     OCCMap->Bind(*poface, iTotalTBCreated);
     OccToCGM->insert(valType(iTotalTBCreated,
@@ -1531,17 +1533,19 @@
 Curve* OCCQueryEngine::populate_topology_bridge(const TopoDS_Edge& aShape)
 {
   Curve *curve;
+  GProp_GProps myProps;
+  BRepGProp::LinearProperties(aShape, myProps);
+  double length =  myProps.Mass();
+  if(length < get_sme_resabs_tolerance())
+    return (Curve*) NULL;
+
   if (!OCCMap->IsBound(aShape)) 
     {
       TopoDS_Edge *poedge = new TopoDS_Edge;
       *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