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

janehu at mcs.anl.gov janehu at mcs.anl.gov
Fri Feb 15 14:31:07 CST 2008


Author: janehu
Date: 2008-02-15 14:31:00 -0600 (Fri, 15 Feb 2008)
New Revision: 1599

Modified:
   cgm/trunk/geom/OCC/OCCModifyEngine.cpp
   cgm/trunk/geom/OCC/OCCQueryEngine.cpp
Log:
corrected to populate_topology_bridge for stand-along surface. The Sheet body generated currently has less vertices than the original one, because OCC's MakeShell code uses the surface of a TopoDS_Face to create shell instead of directly using TopoDS_Face, apparently it's not designed for making sheet body. So we have to look for other ways to walk around this senario.

Modified: cgm/trunk/geom/OCC/OCCModifyEngine.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCModifyEngine.cpp	2008-02-14 20:58:45 UTC (rev 1598)
+++ cgm/trunk/geom/OCC/OCCModifyEngine.cpp	2008-02-15 20:31:00 UTC (rev 1599)
@@ -46,6 +46,7 @@
 #include "TopologyBridge.hpp"
 #include "Handle_Geom_TrimmedCurve.hxx"
 #include "Handle_Geom_RectangularTrimmedSurface.hxx"
+#include "TopExp_Explorer.hxx"
 #include "OCCModifyEngine.hpp"
 #include "OCCQueryEngine.hpp"
 #include "CubitMessage.hpp"
@@ -522,6 +523,23 @@
      return (Surface *)NULL;
   }
 
+  //Testing for number of Vertices.
+  DLIList<OCCCurve*> curve_list;
+  DLIList<OCCPoint*> point_list;
+  occ_surface->get_curves(curve_list);
+  for (int i = 0; i < curve_list.size(); i++)
+  {
+    curve_list.get_and_step()->get_points(point_list);
+    point_list.uniquify_unordered();
+  }
+
+  TopoDS_Face * Face = occ_surface->get_TopoDS_Face();
+  TopExp_Explorer Ex;
+  int count = 0;
+  for (Ex.Init(*Face, TopAbs_VERTEX); Ex.More(); Ex.Next())
+    count++;
+
+  //Start of the codes
   double UMax, VMax, UMin, VMin;
   occ_surface->get_param_range_U(UMin, UMax);
   occ_surface->get_param_range_V(VMin, VMax);
@@ -592,8 +610,6 @@
          trimmed_cyl = GC_MakeTrimmedCylinder(axis, radius, height);
          newFace = BRepBuilderAPI_MakeFace(trimmed_cyl);
        } 
-       U2 = 2 * CUBIT_PI;
-       U1 = 0;
      }
      else if(type == SPHERE_SURFACE_TYPE)
      {
@@ -622,6 +638,8 @@
     newFace = TopoDS::Face(newShape);
   }
   
+  Surface *temp_surface = OCCQueryEngine::instance()->populate_topology_bridge(
+				newFace);
   //get new parameters
   asurface.Initialize(newFace);
   U1 = asurface.FirstUParameter();
@@ -633,11 +651,7 @@
   Handle_Geom_Surface HGeom_surface = BRep_Tool::Surface(newFace);
 
   TopoDS_Shell topo_shell; 
-  if (extended_from == CUBIT_FALSE)
-    topo_shell = BRepBuilderAPI_MakeShell(HGeom_surface, UMin, UMax,
-                            VMin, VMax);
-  else
-    topo_shell = BRepBuilderAPI_MakeShell(HGeom_surface, U1, U2, V1, V2);
+  topo_shell = BRepBuilderAPI_MakeShell(HGeom_surface, U1, U2, V1, V2);
  
   TopoDS_Solid topo_solid = BRepBuilderAPI_MakeSolid(topo_shell);
   Lump *lump = 

Modified: cgm/trunk/geom/OCC/OCCQueryEngine.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCQueryEngine.cpp	2008-02-14 20:58:45 UTC (rev 1598)
+++ cgm/trunk/geom/OCC/OCCQueryEngine.cpp	2008-02-15 20:31:00 UTC (rev 1599)
@@ -1195,15 +1195,8 @@
   OCCSurface *surface;
   if (!OCCMap->IsBound(*poface))
     {
-      if(PRINT_RESULT)
-	PRINT_INFO("Adding faces.\n");
-      iTotalTBCreated++;
       surface = new OCCSurface(poface);
 
-      OCCMap->Bind(*poface, iTotalTBCreated);
-      OccToCGM->insert(valType(iTotalTBCreated,
-			       (TopologyBridge*)surface));
-      SurfaceList->append(surface);
       if(build_body)
       {
       	OCCSurface* occ_surface = CAST_TO(surface, OCCSurface);
@@ -1230,7 +1223,21 @@
                 "       Cannot make sheet body object.\n");
           return (Surface *)NULL;
         }
+        DLIList<Surface*> surfs;
+        lump->surfaces( surfs );
+        delete surface;
+        surface = CAST_TO(surfs.get(),OCCSurface);
       }
+      else
+      {
+        if(PRINT_RESULT)
+          PRINT_INFO("Adding faces.\n");
+        iTotalTBCreated++;
+        OCCMap->Bind(*poface, iTotalTBCreated);
+        OccToCGM->insert(valType(iTotalTBCreated,
+                               (TopologyBridge*)surface));
+        SurfaceList->append(surface);
+      }
     } 
   else 
     {




More information about the cgma-dev mailing list