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

janehu at mcs.anl.gov janehu at mcs.anl.gov
Fri Jan 9 13:49:31 CST 2009


Author: janehu
Date: 2009-01-09 13:49:30 -0600 (Fri, 09 Jan 2009)
New Revision: 2524

Modified:
   cgm/trunk/geom/OCC/OCCModifyEngine.cpp
   cgm/trunk/geom/OCC/OCCModifyEngine.hpp
Log:
Added loft_surfaces function to create a shell body.

Modified: cgm/trunk/geom/OCC/OCCModifyEngine.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCModifyEngine.cpp	2009-01-09 18:05:45 UTC (rev 2523)
+++ cgm/trunk/geom/OCC/OCCModifyEngine.cpp	2009-01-09 19:49:30 UTC (rev 2524)
@@ -5958,27 +5958,41 @@
 }
 
 //================================================================================
-// Description: Creates a body from lofting surfaces.
-// Author     : Tyronne Lim
-// Date       : 08/18/03
+// Description: Creates a shell body from lofting surfaces.
+// Author     : Jane Hu
+// Date       : 01/09
 //================================================================================
-CubitStatus OCCModifyEngine::loft_surfaces( Surface * /*face1*/, 
+CubitStatus OCCModifyEngine::loft_surfaces( Surface * face1, 
                                             const double & /*takeoff1*/,
-                                            Surface * /*face2*/, 
+                                            Surface * face2, 
                                             const double & /*takeoff2*/,
-                                            BodySM*& /*new_body*/,
+                                            BodySM*& new_body,
                                             CubitBoolean /*arc_length_option*/, 
                                             CubitBoolean /*twist_option*/,
                                             CubitBoolean /*align_direction*/, 
                                             CubitBoolean /*perpendicular*/,
                                             CubitBoolean /*simplify_option*/ ) const
 {
-   PRINT_ERROR("Function not implemented in this engine.\n");
-   return CUBIT_FAILURE;
+   BRepOffsetAPI_ThruSections loft(CUBIT_FALSE);
+   CubitStatus stat = do_loft(loft, face1, face2);
+   if(!stat)
+     return CUBIT_FAILURE;
+
+   TopoDS_Shape shape = loft.Shape();
+   TopoDS_Shell shell = TopoDS::Shell(shape);
+   OCCShell* occ_shell = OCCQueryEngine::instance()->populate_topology_bridge(shell, CUBIT_TRUE);
+   if (occ_shell == NULL)
+   {
+     PRINT_ERROR("In OCCModifyEngine::loft_surfaces\n"
+                 "   Cannot create a loft surface for given surfaces.\n");
+     return CUBIT_FAILURE;
+   }
+   new_body = occ_shell->my_body();
+   return CUBIT_SUCCESS;
 }
 
 //================================================================================
-// Description: Creates a body by lofting surfaces between surfaces
+// Description: Creates a solid body by lofting surfaces between surfaces
 // Author     : Jane Hu
 // Date       : 01/09
 //================================================================================
@@ -5994,8 +6008,29 @@
                              CubitBoolean /*simplify_option*/ ) const
 {
    BRepOffsetAPI_ThruSections loft(CUBIT_TRUE);
+   CubitStatus stat = do_loft(loft, face1, face2);
+   if(!stat)
+     return CUBIT_FAILURE;
+
+   TopoDS_Shape shape = loft.Shape();
+   TopoDS_Solid solid = TopoDS::Solid(shape);
+   Lump* lump = OCCQueryEngine::instance()->populate_topology_bridge(solid);
+   if (lump == NULL)
+   {
+     PRINT_ERROR("In OCCModifyEngine::loft_surfaces_to_body\n"
+                 "   Cannot create a loft body for given surfaces.\n");
+     return CUBIT_FAILURE;
+   }
+   new_body = CAST_TO(lump, OCCLump)->get_body();
+   return CUBIT_SUCCESS;   
+}
+ 
+CubitStatus OCCModifyEngine::do_loft(BRepOffsetAPI_ThruSections& loft,
+                                  Surface * face1,
+                                  Surface * face2) const
+{
    OCCSurface* surf1 = CAST_TO(face1, OCCSurface);
-   OCCSurface* surf2 = CAST_TO(face2, OCCSurface); 
+   OCCSurface* surf2 = CAST_TO(face2, OCCSurface);
    if(!surf1 || !surf2)
    {
      PRINT_ERROR("Surfaces are not OCC type.\n");
@@ -6026,19 +6061,9 @@
      PRINT_ERROR("Surfaces can't be loft into a body.\n");
      return CUBIT_FAILURE;
    }
-   TopoDS_Shape shape = loft.Shape();
-   TopoDS_Solid solid = TopoDS::Solid(shape);
-   Lump* lump = OCCQueryEngine::instance()->populate_topology_bridge(solid);
-   if (lump == NULL)
-   {
-     PRINT_ERROR("In OCCModifyEngine::loft_surfaces_to_body\n"
-                 "   Cannot create a loft body for given surfaces.\n");
-     return CUBIT_FAILURE;
-   }
-   new_body = CAST_TO(lump, OCCLump)->get_body();
-   return CUBIT_SUCCESS;   
-}
- 
+   return CUBIT_SUCCESS;
+}  
+
 //================================================================================
 // Description: Creates a surface.
 // Author     : Tyronne Lim

Modified: cgm/trunk/geom/OCC/OCCModifyEngine.hpp
===================================================================
--- cgm/trunk/geom/OCC/OCCModifyEngine.hpp	2009-01-09 18:05:45 UTC (rev 2523)
+++ cgm/trunk/geom/OCC/OCCModifyEngine.hpp	2009-01-09 19:49:30 UTC (rev 2524)
@@ -29,6 +29,7 @@
 class TopoDS_Face;
 class CubitBox;
 class BRepAlgoAPI_BooleanOperation;
+class BRepOffsetAPI_ThruSections;
 
 class OCCModifyEngine : public GeometryModifyEngine
 {
@@ -680,8 +681,14 @@
  CubitStatus stitch_surfs(DLIList<BodySM*>& surf_bodies,
                           TopoDS_Shape& stitched_shape) const;
 private:
+
+ CubitStatus do_loft(BRepOffsetAPI_ThruSections& loft,
+                     Surface * face1,
+                     Surface * face2) const;
+
  int check_intersection(DLIList<TopoDS_Edge*>* edge_list,
                         TopoDS_Face from_face)const;
+
  CubitStatus get_shape_list(DLIList<BodySM*>& BodySM_list,
                          DLIList<TopoDS_Shape*>& shape_list,
                          DLIList<CubitBoolean>& is_volume,




More information about the cgma-dev mailing list