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

jiangtao_ma at yahoo.com jiangtao_ma at yahoo.com
Thu Mar 26 13:34:58 CDT 2009


Author: janehu
Date: 2009-03-26 13:34:57 -0500 (Thu, 26 Mar 2009)
New Revision: 2757

Modified:
   cgm/trunk/geom/OCC/OCCModifyEngine.cpp
   cgm/trunk/geom/OCC/OCCShell.cpp
   cgm/trunk/geom/OCC/OCCSurface.cpp
   cgm/trunk/geom/OCC/OCCSurface.hpp
Log:
Updated for fillet/chamfer sheet body.

Modified: cgm/trunk/geom/OCC/OCCModifyEngine.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCModifyEngine.cpp	2009-03-26 15:40:44 UTC (rev 2756)
+++ cgm/trunk/geom/OCC/OCCModifyEngine.cpp	2009-03-26 18:34:57 UTC (rev 2757)
@@ -3260,7 +3260,7 @@
            else if(shapes.First().TShape()->ShapeType() == TopAbs_FACE)
              OCCSurface::update_OCC_entity(TopoDS::Face(*from_shape), 
                     shapes.First(), 
-                    (BRepBuilderAPI_MakeShape*) NULL, &splitor);
+                    (BRepBuilderAPI_MakeShape*) NULL, NULL, &splitor);
 
            from_shape->Nullify();
            delete from_shape;
@@ -6688,11 +6688,11 @@
       TopoDS_Shape modified_shape = fillet.Shape();
 
       TopExp_Explorer Ex;
-      OCCSurface::update_OCC_entity(newShape , modified_shape, &fillet);
+      OCCSurface::update_OCC_entity(newShape , modified_shape, &fillet, vertex);
       TopoDS_Face modified_face = TopoDS::Face(modified_shape);
       Surface* surf = OCCQueryEngine::instance()->populate_topology_bridge(modified_face, CUBIT_TRUE);
       BodySM* new_bodysm_ptr = CAST_TO(surf,OCCSurface)->my_body();
-      new_bodysm_list.append(new_bodysm_ptr);
+      new_bodysm_list.append_unique(new_bodysm_ptr);
     }
   }
 
@@ -6747,6 +6747,8 @@
   }
   TopoDS_Edge* topo_e1 = CAST_TO(edge1, OCCCurve)->get_TopoDS_Edge();
   TopoDS_Edge* topo_e2 = CAST_TO(edge2, OCCCurve)->get_TopoDS_Edge();
+  TopoDS_Vertex common_v;
+  TopExp::CommonVertex(*topo_e1, *topo_e2, common_v);
   fillet_edge = fillet.AddChamfer( *topo_e1, *topo_e2, d1, d2);
 
   fillet.Build() ;
@@ -6760,12 +6762,12 @@
   if( !preview )
   {
     TopExp_Explorer Ex;
-    Ex.Init(newShape, TopAbs_SOLID);
-    TopoDS_Solid old_solid = TopoDS::Solid(Ex.Current());
-    OCCLump::update_OCC_entity(old_solid , modified_shape, &fillet);
+    Ex.Init(newShape, TopAbs_FACE);
+    TopoDS_Face old_face = TopoDS::Face(Ex.Current());
+    OCCSurface::update_OCC_entity(old_face , modified_shape, &fillet, &common_v);
     DLIList<TopologyBridge*> tbs = OCCQueryEngine::instance()->populate_topology_bridge(modified_shape);
     BodySM* new_bodysm_ptr = CAST_TO(tbs.get(), BodySM);
-    new_bodysm_list.append(new_bodysm_ptr);
+    new_bodysm_list.append_unique(new_bodysm_ptr);
   }
   else
   {

Modified: cgm/trunk/geom/OCC/OCCShell.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCShell.cpp	2009-03-26 15:40:44 UTC (rev 2756)
+++ cgm/trunk/geom/OCC/OCCShell.cpp	2009-03-26 18:34:57 UTC (rev 2757)
@@ -315,7 +315,7 @@
     else 
       shape.Nullify();
     if(shapes.Extent() > 0 || (op && op->IsDeleted(face)))
-      OCCSurface::update_OCC_entity(face,shape, op, sp);
+      OCCSurface::update_OCC_entity(face,shape, op, NULL, sp);
   }
   if(!old_shell.IsSame(new_shell))
     OCCQueryEngine::instance()->update_OCC_map(old_shell, new_shell);

Modified: cgm/trunk/geom/OCC/OCCSurface.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCSurface.cpp	2009-03-26 15:40:44 UTC (rev 2756)
+++ cgm/trunk/geom/OCC/OCCSurface.cpp	2009-03-26 18:34:57 UTC (rev 2757)
@@ -45,6 +45,7 @@
 #include "BRepBuilderAPI_MakeShape.hxx"
 #include "BRepFilletAPI_MakeFillet2d.hxx"
 #include "BRepTools_WireExplorer.hxx"
+#include "TopExp.hxx"
 #include "BRep_Tool.hxx"
 #include "LocOpe_SplitShape.hxx"
 // ********** END CUBIT INCLUDES           **********
@@ -850,6 +851,7 @@
 CubitStatus OCCSurface::update_OCC_entity(TopoDS_Face& old_surface,
                                           TopoDS_Shape& new_surface,
                                           BRepBuilderAPI_MakeShape *op,
+                                          TopoDS_Vertex* removed_vertex,
                                           LocOpe_SplitShape* sp) 
 {
   //set the Wires
@@ -908,16 +910,17 @@
 
      //set curves
      BRepTools_WireExplorer Ex;
-     
+      
      for(Ex.Init(wire); Ex.More();Ex.Next())
      {
        TopoDS_Edge edge = Ex.Current();
-       if(op)
+       if(op && !test_op)
        {
          shapes.Assign(op->Modified(edge));
          if(shapes.Extent() == 0)
            shapes.Assign(op->Generated(edge));
        }
+         
        else if(sp)
          shapes.Assign(sp->DescendantShapes(edge));
 
@@ -945,12 +948,22 @@
        }
        else if (op->IsDeleted(edge))
          shape_edge.Nullify(); 
-       else 
+       else if (test_op)
+       {
+         if(!test_op->IsModified(edge))
+           shape_edge = edge;
+         else
+           shape_edge = (test_op->Modified(edge)).First();
+       } 
+       else
          shape_edge = edge;
 
        //update vertex
        TopoDS_Vertex vertex = Ex.CurrentVertex();
        shapes.Clear();
+       if(test_op)
+         assert(removed_vertex != NULL);
+
        if(op && ! test_op )
          shapes.Assign(op->Modified(vertex));
        else if(sp)
@@ -971,10 +984,12 @@
          }
          shape_vertex.Nullify() ;
        }
+       else if(test_op && !vertex.IsSame( *removed_vertex))
+         shape_vertex = vertex;
        else
          shape_vertex.Nullify();
-
-       if(!vertex.IsSame(shape_vertex) && (shapes.Extent() > 0 || (op && op->IsDeleted(vertex))))
+      
+       if(!vertex.IsSame(shape_vertex) )
          OCCQueryEngine::instance()->update_OCC_map(vertex, shape_vertex);
 
        if (!edge.IsSame(shape_edge))

Modified: cgm/trunk/geom/OCC/OCCSurface.hpp
===================================================================
--- cgm/trunk/geom/OCC/OCCSurface.hpp	2009-03-26 15:40:44 UTC (rev 2756)
+++ cgm/trunk/geom/OCC/OCCSurface.hpp	2009-03-26 18:34:57 UTC (rev 2757)
@@ -51,6 +51,7 @@
 class BRepAlgoAPI_BooleanOperation;
 class BRepBuilderAPI_MakeShape;
 class LocOpe_SplitShape;
+class TopoDS_Vertex;
 //// class CubitTransformMatrix;
 
 class OCCSurface : public Surface
@@ -63,9 +64,12 @@
   virtual ~OCCSurface() ;
     //- The destructor
    
+  //if op is of BRepFilletAPI_MakeFillet2d type, need to input the 
+  //removed_vertex for update.
   static CubitStatus update_OCC_entity(TopoDS_Face& old_surface,
                                        TopoDS_Shape& new_surface,
                                        BRepBuilderAPI_MakeShape *op,
+                                       TopoDS_Vertex* removed_vertex = NULL,
                                        LocOpe_SplitShape* sp = NULL);
 
 



More information about the cgma-dev mailing list