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

janehu at mcs.anl.gov janehu at mcs.anl.gov
Thu Jun 5 14:19:34 CDT 2008


Author: janehu
Date: 2008-06-05 14:19:34 -0500 (Thu, 05 Jun 2008)
New Revision: 1876

Modified:
   cgm/trunk/geom/OCC/OCCModifyEngine.cpp
   cgm/trunk/geom/OCC/OCCModifyEngine.hpp
Log:
Added imprint surface list by corresponding curve_lists_listt, each curve should cut the surface into at least two, otherwise it will fail,tto use a series of curves to make one cut, have to make them into one curve, or[create a shell or solid out of the curves and use that as a tool to imprint.

Modified: cgm/trunk/geom/OCC/OCCModifyEngine.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCModifyEngine.cpp	2008-06-05 18:26:07 UTC (rev 1875)
+++ cgm/trunk/geom/OCC/OCCModifyEngine.cpp	2008-06-05 19:19:34 UTC (rev 1876)
@@ -2783,19 +2783,73 @@
 // Author     : Jane Hu
 // Date       : 05/08
 //===============================================================================
-CubitStatus     OCCModifyEngine::imprint( DLIList<Surface*> &ref_face_list,
-                                          DLIList<Curve*> &edge_list,
-                                          DLIList<BodySM*>& new_body_list,
-                                          bool keep_old ) const
+CubitStatus OCCModifyEngine::imprint( DLIList<Surface*> &ref_face_list,
+                                      DLIList<Curve*> &edge_list,
+                                      DLIList<BodySM*>& new_body_list,
+                                      bool keep_old ) const
 {
   DLIList<TopoDS_Face*> face_list;
   DLIList<TopoDS_Shape*> shape_list;
+ 
+  face_edge_imprint(ref_face_list, edge_list, face_list, shape_list, keep_old);
+
+  for(int j = 0; j < shape_list.size(); j ++)
+  {
+    DLIList<TopologyBridge*> tbs;
+    TopoDS_Shape* shape = shape_list.get_and_step();
+    if (shape->TShape()->ShapeType() == TopAbs_COMPSOLID)
+    {
+      if(!OCCQueryEngine::instance()->OCCMap->IsBound(*shape)) 
+      {
+        TopExp_Explorer Ex;
+        for (Ex.Init(*shape, TopAbs_SOLID);Ex.More(); Ex.Next())
+        {
+          tbs += OCCQueryEngine::instance()->populate_topology_bridge(Ex.Current());
+          new_body_list.append_unique(CAST_TO(tbs.get(),BodySM));
+        }
+      }
+    }
+    else
+    {
+      tbs += OCCQueryEngine::instance()->populate_topology_bridge(*shape);
+      new_body_list.append_unique(CAST_TO(tbs.get(),BodySM));
+    }
+  }
+
+  if (keep_old)
+  {
+    for(int i = 0; i < face_list.size(); i++)
+    {
+      TopoDS_Face* face = face_list.get();
+      face->Nullify();
+      delete face;
+    }
+  }
+  return CUBIT_SUCCESS;
+}
+
+//===============================================================================
+// Function   : face_edge_imprint
+// Member Type: PRIVATE
+// Description: to be consistante with Acis imprint.
+//              The surfaces must be part of a body, but the curves
+//              just have to be valid OCC edge.
+// Author     : Jane Hu
+// Date       : 05/08
+//===============================================================================
+CubitStatus 
+OCCModifyEngine::face_edge_imprint( DLIList<Surface*> &ref_face_list,
+                                    DLIList<Curve*> &edge_list,
+                                    DLIList<TopoDS_Face*>& face_list,
+                                    DLIList<TopoDS_Shape*>& shape_list,
+                                    bool keep_old ) const
+{
   for(int i = 0; i <ref_face_list.size(); i++)
   {
     OCCSurface* surface = CAST_TO(ref_face_list.get_and_step(), OCCSurface);
     if(!surface)
       continue;
-   
+
     TopoDS_Face* topo_face = surface->get_TopoDS_Face();
     face_list.append(topo_face);
 
@@ -2803,7 +2857,7 @@
       shape_list.append(surface->my_shell()->get_TopoDS_Shell());
     else if(surface->my_body()) //a sheet body
       shape_list.append(topo_face);
-    else 
+    else
     {
       //int size = shape_list.size();
       OCCQueryEngine* oqe = OCCQueryEngine::instance();
@@ -2818,7 +2872,7 @@
         TopoDS_Shape ashape = *(body->get_TopoDS_Shape());
         TopExp::MapShapesAndAncestors(ashape, TopAbs_FACE, TopAbs_COMPSOLID, M);
         if(!M.Contains(*topo_face))
-          continue; 
+          continue;
         shape_list.append_unique(body->get_TopoDS_Shape());
       }
     }
@@ -2844,12 +2898,12 @@
             face_list.change_to(face);
           }
         }
-        face_list.step(); 
+        face_list.step();
       }
       shape_list.change_to(Shape1);
       shape_list.step();
     }
-  } 
+  }
 
   for (int i = 0; i < edge_list.size(); i++)
   {
@@ -2861,22 +2915,70 @@
     if (edge->IsNull())
       continue;
 
-    DLIList<OCCPoint*> point_list;
-    curve->get_points(point_list);
     for(int j = 0; j < shape_list.size(); j ++)
     {
       TopoDS_Shape* shape = shape_list.get_and_step();
       imprint_toposhapes(shape, (TopoDS_Shape*)edge, &face_list);
     }
   }
+  return CUBIT_SUCCESS;
+}
+//===============================================================================
+// Function   : imprint
+// Member Type: PUBLIC
+// Description: To be consistent with  AcisModifyEngine, althought it's hard 
+//              to have a GUI interface for users to input. All surface must
+//              on the same body. 
+// Author     : Jane HU 
+// Date       : 06/08
+//===============================================================================
+CubitStatus OCCModifyEngine::imprint( DLIList<Surface*>& surface_list,
+                                   DLIList<DLIList<Curve*>*>& curve_lists_list,
+                                   BodySM*& new_body,
+                                   bool keep_old ) const
+{
+  DLIList<TopoDS_Face*> face_list;
+  DLIList<TopoDS_Shape*> shape_list;
+  DLIList<TopoDS_Shape*> shape_list_all;
+  
+  assert (surface_list.size() == curve_lists_list.size());
 
+  for(int j = 0; j < surface_list.size(); j++)
+  {
+    Surface* surface = surface_list.get_and_step();
+    DLIList<Surface*> ref_face_list;
+    ref_face_list.append(surface);
+    DLIList<Curve*> *edge_list = curve_lists_list.get_and_step();
+    face_edge_imprint(ref_face_list, *edge_list, face_list, shape_list, keep_old);
+
+    for(int i = 0; i < shape_list.size(); i++)
+    {
+      TopoDS_Shape* shape = shape_list.get_and_step();
+      shape_list_all.append_unique(shape);
+    }
+    shape_list.clean_out();
+
+    if (keep_old)
+    {
+      for(int i = 0; i < face_list.size(); i++)
+      {
+        TopoDS_Face* face = face_list.get();
+        face->Nullify();
+        delete face;
+      }
+    }
+
+    face_list.clean_out();
+  }
+
+  DLIList<BodySM*> new_body_list;
   for(int j = 0; j < shape_list.size(); j ++)
   {
     DLIList<TopologyBridge*> tbs;
     TopoDS_Shape* shape = shape_list.get_and_step();
     if (shape->TShape()->ShapeType() == TopAbs_COMPSOLID)
     {
-      if(!OCCQueryEngine::instance()->OCCMap->IsBound(*shape)) 
+      if(!OCCQueryEngine::instance()->OCCMap->IsBound(*shape))
       {
         TopExp_Explorer Ex;
         for (Ex.Init(*shape, TopAbs_SOLID);Ex.More(); Ex.Next())
@@ -2893,40 +2995,21 @@
     }
   }
 
-  if (keep_old)
+  if (new_body_list.size() == 1)
   {
-    for(int i = 0; i < face_list.size(); i++)
-    {
-      TopoDS_Face* face = face_list.get();
-      face->Nullify();
-      delete face;
-    }
+    new_body = new_body_list.get();
+    return CUBIT_SUCCESS;
   }
-  return CUBIT_SUCCESS;
-}
-
-//===============================================================================
-// Function   : imprint
-// Member Type: PUBLIC
-// Description: imprint boolean operation on facet-based bodies
-// Author     : John Fowler
-// Date       : 10/02
-//===============================================================================
-CubitStatus     OCCModifyEngine::imprint( DLIList<Surface*> &/*surface_list*/,
-                                           DLIList<DLIList<Curve*>*> &/*curve_lists_list*/,
-                                           BodySM*& /*new_body*/,
-                                           bool /*keep_old_body*/ ) const
-{
-  PRINT_ERROR("Option not supported for mesh based geometry.\n");
   return CUBIT_FAILURE;
 }
 
 //===============================================================================
 // Function   : imprint
 // Member Type: PUBLIC
-// Description: imprint boolean operation on facet-based bodies
-// Author     : John Fowler
-// Date       : 10/02
+// Description: Imprints locations to bodies (for splitting curves or putting
+//              hardpoints on surfaces).   
+// Author     : Jane Hu
+// Date       : 06/08
 //===============================================================================
 CubitStatus     OCCModifyEngine::imprint( DLIList<BodySM*> &/*body_list*/,
                                            DLIList<CubitVector*> &/*vector_list*/,
@@ -2935,7 +3018,6 @@
                                            DLIList<TopologyBridge*>*,
                                            DLIList<TopologyBridge*>* ) const
 {
-  PRINT_ERROR("Option not supported for mesh based geometry.\n");
   return CUBIT_FAILURE;
 }
 

Modified: cgm/trunk/geom/OCC/OCCModifyEngine.hpp
===================================================================
--- cgm/trunk/geom/OCC/OCCModifyEngine.hpp	2008-06-05 18:26:07 UTC (rev 1875)
+++ cgm/trunk/geom/OCC/OCCModifyEngine.hpp	2008-06-05 19:19:34 UTC (rev 1876)
@@ -676,7 +676,11 @@
  CubitStatus get_shape_list(DLIList<BodySM*> BodySM_list,
                          DLIList<TopoDS_Shape*>& shape_list,
                          bool  keep_old) const;
-  
+ CubitStatus face_edge_imprint( DLIList<Surface*> &ref_face_list,
+                                DLIList<Curve*> &edge_list,
+                                DLIList<TopoDS_Face*>& face_list,
+                                DLIList<TopoDS_Shape*>& shape_list,
+                                bool keep_old ) const; 
 } ;
 
 #endif




More information about the cgma-dev mailing list