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

jiangtao_ma at yahoo.com jiangtao_ma at yahoo.com
Wed Aug 11 12:20:39 CDT 2010


Author: janehu
Date: 2010-08-11 12:20:39 -0500 (Wed, 11 Aug 2010)
New Revision: 4079

Modified:
   cgm/trunk/geom/OCC/OCCModifyEngine.cpp
Log:
Take account for intersect function to get lower dimensional shapes.

Modified: cgm/trunk/geom/OCC/OCCModifyEngine.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCModifyEngine.cpp	2010-08-11 17:17:43 UTC (rev 4078)
+++ cgm/trunk/geom/OCC/OCCModifyEngine.cpp	2010-08-11 17:20:39 UTC (rev 4079)
@@ -3506,8 +3506,37 @@
     TopoDS_Shape* from_shape = shape_list.get_and_step();
     BodySM* from_body = from_bodies.get_and_step();
     BRepAlgoAPI_Common intersector(*from_shape, *tool_shape);
-    TopoDS_Shape common_shape = intersector.Shape();
-    check_operation(common_shape, from_shape, is_volume[i], has_changed, 
+    TopTools_ListOfShape shapes;
+    shapes.Assign(intersector.Modified(*tool_shape));
+    if (shapes.IsEmpty())
+    {
+      PRINT_INFO("The %d body did not have common part with the tool_body.\n", i+1);
+    continue;
+    }
+    if ( shapes.Extent() > 1)
+    {
+      PRINT_ERROR("Tool has multiple intersection with the shape, make it simpler. \n");
+      continue;
+    }
+    TopoDS_Shape common_shape = shapes.First();
+    if (is_volume[i] == CUBIT_TRUE && 
+        (common_shape.TShape()->ShapeType() == TopAbs_SHELL || 
+         common_shape.TShape()->ShapeType() == TopAbs_FACE ||
+         common_shape.TShape()->ShapeType() == TopAbs_EDGE ||
+         common_shape.TShape()->ShapeType() == TopAbs_VERTEX))
+    {  
+      has_changed = CUBIT_TRUE;
+      *from_shape = common_shape;
+    }
+    else if(is_volume[i] == CUBIT_FALSE && 
+            (common_shape.TShape()->ShapeType() == TopAbs_EDGE ||
+             common_shape.TShape()->ShapeType() == TopAbs_VERTEX))
+    {
+      has_changed = CUBIT_TRUE;
+      *from_shape = common_shape;
+    }
+    else
+      check_operation(common_shape, from_shape, is_volume[i], has_changed, 
                     &intersector, keep_old); 
 
     if(from_shape->IsNull() )









More information about the cgma-dev mailing list