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

janehu at mcs.anl.gov janehu at mcs.anl.gov
Mon Mar 31 13:03:49 CDT 2008


Author: janehu
Date: 2008-03-31 13:03:49 -0500 (Mon, 31 Mar 2008)
New Revision: 1727

Modified:
   cgm/trunk/geom/OCC/OCCLump.hpp
   cgm/trunk/geom/OCC/OCCModifyEngine.cpp
   cgm/trunk/geom/OCC/OCCQueryEngine.cpp
   cgm/trunk/geom/OCC/OCCQueryEngine.hpp
Log:
Added for the case that a shell with multi-face imprinting on one single face case. In testing.

Modified: cgm/trunk/geom/OCC/OCCLump.hpp
===================================================================
--- cgm/trunk/geom/OCC/OCCLump.hpp	2008-03-31 17:46:33 UTC (rev 1726)
+++ cgm/trunk/geom/OCC/OCCLump.hpp	2008-03-31 18:03:49 UTC (rev 1727)
@@ -50,8 +50,6 @@
   virtual ~OCCLump();
     //- The destructor
 
-  BodySM* body() {return myBodyPtr;}
-
   void add_body(BodySM* new_body)
     {myBodyPtr = new_body;}
     

Modified: cgm/trunk/geom/OCC/OCCModifyEngine.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCModifyEngine.cpp	2008-03-31 17:46:33 UTC (rev 1726)
+++ cgm/trunk/geom/OCC/OCCModifyEngine.cpp	2008-03-31 18:03:49 UTC (rev 1727)
@@ -1060,18 +1060,24 @@
   }
 
   TopoDS_Shell aShell = aMakeShell.Shell();
-  BRepBuilderAPI_MakeSolid aMakeSolid(aShell);
-  if (!aMakeSolid.IsDone())
+  if(aShell.Closed())
   {
-     PRINT_ERROR("Cannot create an OCC Lump from the given surfaces.\n"
-                 "OCC internal error.\n");
-     return (Lump *)NULL;
-  }
+    BRepBuilderAPI_MakeSolid aMakeSolid(aShell);
+    if (!aMakeSolid.IsDone())
+    {
+       PRINT_ERROR("Cannot create an OCC Lump from the given surfaces.\n"
+                   "OCC internal error.\n");
+       return (Lump *)NULL;
+    }
 
-  TopoDS_Solid aSolid = aMakeSolid.Solid();
+    TopoDS_Solid aSolid = aMakeSolid.Solid();
 
-  return 
-    OCCQueryEngine::instance()->populate_topology_bridge(aSolid, CUBIT_TRUE); 
+    return
+      OCCQueryEngine::instance()->populate_topology_bridge(aSolid, CUBIT_TRUE); 
+  }
+  OCCShell* occ_shell = 
+    OCCQueryEngine::instance()->populate_topology_bridge(aShell, CUBIT_TRUE);
+  return occ_shell->my_lump();
 }
 
 //===============================================================================
@@ -1179,7 +1185,7 @@
   if (lump == NULL)
     return (BodySM*)NULL;
 
-  return CAST_TO(lump, OCCLump)->body();
+  return CAST_TO(lump, OCCLump)->get_body();
 }
 
 
@@ -1203,7 +1209,7 @@
   if (lump == NULL)
     return (BodySM*)NULL;
 
-  return CAST_TO(lump, OCCLump)->body();
+  return CAST_TO(lump, OCCLump)->get_body();
 }
 
 
@@ -1231,7 +1237,7 @@
   if (lump == NULL)
     return (BodySM*)NULL;
 
-  return CAST_TO(lump, OCCLump)->body(); 
+  return CAST_TO(lump, OCCLump)->get_body(); 
 }
 
 //===============================================================================
@@ -1279,7 +1285,7 @@
   if (lump == NULL)
     return (BodySM*)NULL;
 
-  return CAST_TO(lump, OCCLump)->body();
+  return CAST_TO(lump, OCCLump)->get_body();
   
 }
 
@@ -1347,7 +1353,7 @@
     return (BodySM*)NULL;
   }
 
-  return CAST_TO(lump, OCCLump)->body();
+  return CAST_TO(lump, OCCLump)->get_body();
 }
 
 //===============================================================================
@@ -1374,7 +1380,7 @@
     return (BodySM*)NULL;
   }
 
-  return CAST_TO(lump, OCCLump)->body();
+  return CAST_TO(lump, OCCLump)->get_body();
 }
 
 //===============================================================================
@@ -1467,7 +1473,7 @@
   lump = OCCQueryEngine::instance()->populate_topology_bridge(newSolid,
 							CUBIT_TRUE);
   
-  return CAST_TO(lump, OCCLump)->body();
+  return CAST_TO(lump, OCCLump)->get_body();
 }
 
 //===============================================================================
@@ -1797,7 +1803,8 @@
 
       //find the intersecting edges and faces.
       int max_edge = 0;
-      TopoDS_Face from_face, tool_face; 
+      TopoDS_Face from_face,tool_face; 
+      DLIList<TopoDS_Face*> tool_faces;
       for(; intersector.MoreIntersection(); intersector.NextIntersection())
 	{
 	  TopoDS_Shape face1 = intersector.ChangeFacesIntersector().Face(1);
@@ -1806,13 +1813,52 @@
 	  TopTools_ListOfShape temp_list_of_edges;
 	  temp_list_of_edges.Assign(section.SectionEdges());
 	  int num_edges = temp_list_of_edges.Extent();
-	  if (max_edge < num_edges)
+          CubitBoolean is_same = face1.IsSame(from_face);
+          CubitBoolean is_same_tool_face = CUBIT_FALSE;
+          for (int j = 0; j < tool_faces.size(); j++)
+          {
+  	    if(face2.IsSame(*(tool_faces.get_and_step())))
+            {
+              is_same_tool_face = CUBIT_TRUE;
+	      break;
+	    }
+          }
+	  if (max_edge < num_edges && !is_same)
 	    {
 	      list_of_edges.Assign(temp_list_of_edges);  
 	      max_edge =  num_edges ;
 	      from_face = TopoDS::Face(face1);
               tool_face = TopoDS::Face(face2);
+              tool_faces.clean_out();
+              for(int i = 0 ; i < num_edges; i++)
+                tool_faces.append(&tool_face);
 	    }
+          else if(num_edges == max_edge && is_same && !is_same_tool_face) 
+          //multi tool faces cut the same face
+          {
+            TopTools_ListIteratorOfListOfShape Itor, temp_Itor;
+            temp_Itor.Initialize(temp_list_of_edges);
+            for(; temp_Itor.More(); temp_Itor.Next())
+            {
+              TopoDS_Edge temp_edge = TopoDS::Edge(temp_Itor.Value());
+              Itor.Initialize(list_of_edges);
+              CubitBoolean same_edge = CUBIT_FALSE;
+              for(; Itor.More(); Itor.Next())
+              {
+                TopoDS_Edge edge = TopoDS::Edge(Itor.Value());
+                if(edge.IsSame(temp_edge))
+                {
+		  same_edge = CUBIT_TRUE;
+                  break;
+  		}
+	      }
+              if(!same_edge)
+              {
+                list_of_edges.Append(temp_edge);
+                tool_faces.append(&(TopoDS::Face(face2)));
+ 	      }
+            }
+          }
 	}
 
       TopTools_ListIteratorOfListOfShape Itor;
@@ -1830,7 +1876,7 @@
 	{
 	  TopoDS_Edge from_edge = TopoDS::Edge(Ex.Current());
           TopOpeBRep_EdgesIntersector intersector;
-   	  intersector.SetFaces(tool_face, from_face);
+   	  intersector.SetFaces(*(tool_faces.get_and_step()), from_face);
           intersector.Perform(edge, from_edge);
           int num_edges = intersector.NbSegments();
 	  if(num_edges == 1) //overlap

Modified: cgm/trunk/geom/OCC/OCCQueryEngine.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCQueryEngine.cpp	2008-03-31 17:46:33 UTC (rev 1726)
+++ cgm/trunk/geom/OCC/OCCQueryEngine.cpp	2008-03-31 18:03:49 UTC (rev 1727)
@@ -1062,7 +1062,7 @@
 DLIList<TopologyBridge*> OCCQueryEngine::populate_topology_bridge(TopoDS_Shape aShape)
 {
   DLIList<TopologyBridge*> tblist;
-  // suitable to popolate for a TopoDS_CompSolid or TopoDS_Compound shape.
+  // suitable to populate for a TopoDS_CompSolid or TopoDS_Compound shape.
   TopExp_Explorer Ex;
   for (Ex.Init(aShape, TopAbs_COMPSOLID); Ex.More(); Ex.Next())
     tblist.append(populate_topology_bridge(TopoDS::CompSolid(Ex.Current())));
@@ -1071,7 +1071,7 @@
   {
     Lump *lump = 
     populate_topology_bridge(TopoDS::Solid(Ex.Current()), CUBIT_TRUE);
-    tblist.append(CAST_TO(lump, OCCLump)->body());
+    tblist.append(CAST_TO(lump, OCCLump)->get_body());
   }
 
   for (Ex.Init(aShape, TopAbs_SHELL, TopAbs_SOLID); Ex.More(); Ex.Next())
@@ -1545,8 +1545,8 @@
      ShellSM* shell = CAST_TO(children.get_and_step(), ShellSM); 
      unhook_ShellSM_from_OCC(shell);
   }
-  if (occ_lump->body() != NULL)
-    BodyList->remove(CAST_TO(occ_lump->body(), OCCBody));
+  if (occ_lump->get_body() != NULL)
+    BodyList->remove(CAST_TO(occ_lump->get_body(), OCCBody));
   delete solid;
   delete lump;
   return CUBIT_SUCCESS;

Modified: cgm/trunk/geom/OCC/OCCQueryEngine.hpp
===================================================================
--- cgm/trunk/geom/OCC/OCCQueryEngine.hpp	2008-03-31 17:46:33 UTC (rev 1726)
+++ cgm/trunk/geom/OCC/OCCQueryEngine.hpp	2008-03-31 18:03:49 UTC (rev 1727)
@@ -345,6 +345,8 @@
   Curve* populate_topology_bridge(TopoDS_Edge aShape);
   Point* populate_topology_bridge(TopoDS_Vertex aShape);
 
+  OCCShell* populate_topology_bridge(TopoDS_Shell aShape,
+                                     CubitBoolean standalone = CUBIT_FALSE );
   DLIList<OCCBody*> *BodyList ;
   DLIList<OCCSurface*> *SurfaceList ;
   DLIList<OCCLoop*> *WireList; //standalone wire list
@@ -361,8 +363,6 @@
 
   OCCLoop* populate_topology_bridge(TopoDS_Wire aShape,
 				    CubitBoolean standalone = CUBIT_FALSE);  
-  OCCShell* populate_topology_bridge(TopoDS_Shell aShape,
-				     CubitBoolean standalone = CUBIT_FALSE );
 
   CubitStatus write_topology( const char* file_name, 
                               DLIList<OCCBody*> &facet_bodies,




More information about the cgma-dev mailing list