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

janehu at mcs.anl.gov janehu at mcs.anl.gov
Wed Sep 3 11:04:25 CDT 2008


Author: janehu
Date: 2008-09-03 11:04:25 -0500 (Wed, 03 Sep 2008)
New Revision: 2053

Modified:
   cgm/trunk/geom/OCC/OCCAttribSet.cpp
   cgm/trunk/geom/OCC/OCCBody.cpp
   cgm/trunk/geom/OCC/OCCModifyEngine.cpp
   cgm/trunk/geom/OCC/OCCQueryEngine.cpp
   cgm/trunk/geom/OCC/OCCQueryEngine.hpp
Log:
Fixed the problem of losing attributes when doing boolean operations.

Modified: cgm/trunk/geom/OCC/OCCAttribSet.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCAttribSet.cpp	2008-08-29 16:51:46 UTC (rev 2052)
+++ cgm/trunk/geom/OCC/OCCAttribSet.cpp	2008-09-03 16:04:25 UTC (rev 2053)
@@ -43,7 +43,7 @@
     TopoDS_Shape old_shape;
     if(aLabel.FindAttribute(TDataStd_Shape::GetID(), attr_shape))
       old_shape = attr_shape->Get(aLabel);
-    if(old_shape.IsSame(shape))
+    if(old_shape.IsPartner(shape))
     {
       found = CUBIT_TRUE;
       break;
@@ -74,8 +74,8 @@
   TDF_Label lab;
   Handle_TDataStd_Name attr_name;
   TCollection_ExtendedString name_string;
-  CubitString type = csa->character_type();
-  TCollection_ExtendedString cstring( (Standard_CString)type.c_str() );
+  CubitString* type = csa->string_data_list()->get_and_step();
+  TCollection_ExtendedString cstring( (Standard_CString)type->c_str() );
   found = CUBIT_FALSE;
   for (TDF_ChildIterator it(aLabel,CUBIT_FALSE); it.More(); it.Next()) 
   {

Modified: cgm/trunk/geom/OCC/OCCBody.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCBody.cpp	2008-08-29 16:51:46 UTC (rev 2052)
+++ cgm/trunk/geom/OCC/OCCBody.cpp	2008-09-03 16:04:25 UTC (rev 2053)
@@ -570,9 +570,9 @@
   TopExp::MapShapes(*myTopoDSShape, TopAbs_SOLID, M);
   int ii;
   for (ii=1; ii<=M.Extent(); ii++) {
-	  TopologyBridge *lump = OCCQueryEngine::instance()->occ_to_cgm(M(ii));
-          if (lump)
-	    lumps.append_unique(lump);
+     TopologyBridge *lump = OCCQueryEngine::instance()->occ_to_cgm(M(ii));
+     if (lump)
+       lumps.append_unique(lump);
   }
 }
 
@@ -678,9 +678,9 @@
   TopExp::MapShapes(shape, TopAbs_FACE, M);
   int ii;
   for (ii=1; ii<=M.Extent(); ii++) {
-          TopologyBridge *surface = OCCQueryEngine::instance()->occ_to_cgm(M(ii));
-          OCCSurface* occ_surface = CAST_TO(surface, OCCSurface);
-	  if (occ_surface)
+       TopologyBridge *surface = OCCQueryEngine::instance()->occ_to_cgm(M(ii));
+       OCCSurface* occ_surface = CAST_TO(surface, OCCSurface);
+       if (occ_surface)
             surfaces.append_unique(occ_surface);
   }
 }
@@ -719,10 +719,10 @@
   TopExp::MapShapes(shape, TopAbs_EDGE, M);
   int ii;
   for (ii=1; ii<=M.Extent(); ii++) {
-          TopologyBridge *curve = OCCQueryEngine::instance()->occ_to_cgm(M(ii));
-          OCCCurve* occ_curve = CAST_TO(curve, OCCCurve);
-          if (occ_curve)
-            curves.append_unique(occ_curve);
+       TopologyBridge *curve = OCCQueryEngine::instance()->occ_to_cgm(M(ii));
+       OCCCurve* occ_curve = CAST_TO(curve, OCCCurve);
+       if (occ_curve)
+         curves.append_unique(occ_curve);
   }
 }
 
@@ -761,10 +761,10 @@
   TopExp::MapShapes(shape, TopAbs_VERTEX, M);
   int ii;
   for (ii=1; ii<=M.Extent(); ii++) {
-          TopologyBridge *vertex = OCCQueryEngine::instance()->occ_to_cgm(M(ii));
-          OCCPoint* occ_point = CAST_TO(vertex, OCCPoint);
-          if (occ_point)
-            points.append_unique(occ_point);
+       TopologyBridge *vertex = OCCQueryEngine::instance()->occ_to_cgm(M(ii));
+       OCCPoint* occ_point = CAST_TO(vertex, OCCPoint);
+       if (occ_point)
+         points.append_unique(occ_point);
   }
 }
 

Modified: cgm/trunk/geom/OCC/OCCModifyEngine.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCModifyEngine.cpp	2008-08-29 16:51:46 UTC (rev 2052)
+++ cgm/trunk/geom/OCC/OCCModifyEngine.cpp	2008-09-03 16:04:25 UTC (rev 2053)
@@ -2794,7 +2794,8 @@
         TopExp_Explorer Ex;
         for (Ex.Init(*shape, TopAbs_SOLID);Ex.More(); Ex.Next())
         {
-          tbs += OCCQueryEngine::instance()->populate_topology_bridge(Ex.Current());
+          TopoDS_Shape subshape = Ex.Current();
+          tbs += OCCQueryEngine::instance()->populate_topology_bridge(subshape);
           new_body_list.append_unique(CAST_TO(tbs.get(),BodySM));
         }
       }
@@ -2994,7 +2995,8 @@
         TopExp_Explorer Ex;
         for (Ex.Init(*shape, TopAbs_SOLID);Ex.More(); Ex.Next())
         {
-          tbs += OCCQueryEngine::instance()->populate_topology_bridge(Ex.Current());
+          TopoDS_Shape subshape = Ex.Current();
+          tbs += OCCQueryEngine::instance()->populate_topology_bridge(subshape);
           new_body_list.append_unique(CAST_TO(tbs.get(),BodySM));
         }
       }

Modified: cgm/trunk/geom/OCC/OCCQueryEngine.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCQueryEngine.cpp	2008-08-29 16:51:46 UTC (rev 2052)
+++ cgm/trunk/geom/OCC/OCCQueryEngine.cpp	2008-09-03 16:04:25 UTC (rev 2053)
@@ -1123,7 +1123,7 @@
 //Date:         11/16/2007
 //===========================================================================
 
-DLIList<TopologyBridge*> OCCQueryEngine::populate_topology_bridge(TopoDS_Shape aShape)
+DLIList<TopologyBridge*> OCCQueryEngine::populate_topology_bridge(TopoDS_Shape& aShape)
 {
   DLIList<TopologyBridge*> tblist;
   // suitable to populate for a TopoDS_CompSolid or TopoDS_Compound shape.
@@ -1165,7 +1165,7 @@
   return tblist;
 }
 
-BodySM* OCCQueryEngine::populate_topology_bridge(TopoDS_CompSolid aShape)
+BodySM* OCCQueryEngine::populate_topology_bridge(const TopoDS_CompSolid& aShape)
 {
   OCCBody *body;
   if (!OCCMap->IsBound(aShape))
@@ -1201,7 +1201,7 @@
   return body;
 }
 
-Lump* OCCQueryEngine::populate_topology_bridge(TopoDS_Solid aShape,
+Lump* OCCQueryEngine::populate_topology_bridge(const TopoDS_Solid& aShape,
 		 			       CubitBoolean build_body)
 {
   //one OCCBody corresponds one OCCLump
@@ -1247,7 +1247,7 @@
   return lump;
 }
 
-OCCShell* OCCQueryEngine::populate_topology_bridge(TopoDS_Shell aShape,
+OCCShell* OCCQueryEngine::populate_topology_bridge(const TopoDS_Shell& aShape,
 						   CubitBoolean standalone)
 {
   OCCShell *shell ;
@@ -1327,7 +1327,7 @@
   return shell;
 }
 
-Surface* OCCQueryEngine::populate_topology_bridge(TopoDS_Face aShape,
+Surface* OCCQueryEngine::populate_topology_bridge(const TopoDS_Face& aShape,
                                                   CubitBoolean build_body)
 {
   OCCSurface *surface = NULL;
@@ -1375,7 +1375,7 @@
   return surface;
 }
 
-OCCLoop* OCCQueryEngine::populate_topology_bridge(TopoDS_Wire aShape,
+OCCLoop* OCCQueryEngine::populate_topology_bridge(const TopoDS_Wire& aShape,
 						  CubitBoolean standalone)
 {
   OCCLoop *loop ;
@@ -1472,7 +1472,7 @@
   return loop;
 }
 
-Curve* OCCQueryEngine::populate_topology_bridge(TopoDS_Edge aShape)
+Curve* OCCQueryEngine::populate_topology_bridge(const TopoDS_Edge& aShape)
 {
   Curve *curve;
   if (!OCCMap->IsBound(aShape)) 
@@ -1502,7 +1502,7 @@
   return curve;
 }
 
-Point* OCCQueryEngine::populate_topology_bridge(TopoDS_Vertex aShape)
+Point* OCCQueryEngine::populate_topology_bridge(const TopoDS_Vertex& aShape)
 {
   OCCPoint *point;
   if (iTotalTBCreated == 0 || !OCCMap->IsBound(aShape)) 
@@ -1526,7 +1526,7 @@
   return point;
 }
 
-TopologyBridge* OCCQueryEngine::occ_to_cgm(TopoDS_Shape shape)
+TopologyBridge* OCCQueryEngine::occ_to_cgm(const TopoDS_Shape& shape)
 {
   if(!OCCMap->IsBound(shape))
     return (TopologyBridge*) NULL;
@@ -2632,8 +2632,8 @@
   return CUBIT_FALSE;
 }
 
-void OCCQueryEngine::copy_attributes(TopoDS_Shape old_shape,
-                                     TopoDS_Shape new_shape)
+void OCCQueryEngine::copy_attributes(TopoDS_Shape& old_shape,
+                                     TopoDS_Shape& new_shape)
 {
   //update the attribute label tree
   DLIList<CubitSimpleAttrib*> list;
@@ -2646,8 +2646,8 @@
   }
 }
 
-int OCCQueryEngine::update_OCC_map(TopoDS_Shape old_shape, 
-                                   TopoDS_Shape new_shape)
+int OCCQueryEngine::update_OCC_map(TopoDS_Shape& old_shape, 
+                                   TopoDS_Shape& new_shape)
 {
   if (!OCCMap->IsBound(old_shape) || old_shape.IsEqual(new_shape))
     return -1;
@@ -2769,7 +2769,7 @@
   unhook_CoEdges_from_OCC(coedges);
 }
 void OCCQueryEngine::set_TopoDS_Shape(TopologyBridge* tb,
-                                      TopoDS_Shape shape)
+                                      TopoDS_Shape& shape)
 {
   BodySM* body = CAST_TO(tb, BodySM);
   if(body)

Modified: cgm/trunk/geom/OCC/OCCQueryEngine.hpp
===================================================================
--- cgm/trunk/geom/OCC/OCCQueryEngine.hpp	2008-08-29 16:51:46 UTC (rev 2052)
+++ cgm/trunk/geom/OCC/OCCQueryEngine.hpp	2008-09-03 16:04:25 UTC (rev 2053)
@@ -114,10 +114,10 @@
 
   CubitBoolean EXPORT_ATTRIB;
 
-  void copy_attributes(TopoDS_Shape old_shape,
-                       TopoDS_Shape new_shape);
+  void copy_attributes(TopoDS_Shape& old_shape,
+                       TopoDS_Shape& new_shape);
 
-  int update_OCC_map(TopoDS_Shape old_shape, TopoDS_Shape new_shape);
+  int update_OCC_map(TopoDS_Shape& old_shape, TopoDS_Shape& new_shape);
 
   virtual ~OCCQueryEngine();
   
@@ -320,7 +320,7 @@
                                   BRepBuilderAPI_Transform* aTranf,
                                   BRepAlgoAPI_BooleanOperation *op = NULL);
 
-  void set_TopoDS_Shape(TopologyBridge* tb, TopoDS_Shape new_shape);
+  void set_TopoDS_Shape(TopologyBridge* tb, TopoDS_Shape& new_shape);
   CubitStatus translate( BodySM* body, const CubitVector& offset );
   CubitStatus rotate   ( BodySM* body, const CubitVector& axis, double angle );
   CubitStatus scale    ( BodySM* body, double factor );
@@ -347,20 +347,20 @@
   //-  are overlaping.  The full intersect Boolean is needed to see if
   //-  the bodies actually overlap and don't just touch.
 
-  TopologyBridge* occ_to_cgm(TopoDS_Shape shape);
+  TopologyBridge* occ_to_cgm(const TopoDS_Shape& shape);
   
   virtual CubitBoolean volumes_overlap (Lump *lump1, Lump *lump2 ) const ;
 
-  DLIList<TopologyBridge*> populate_topology_bridge(TopoDS_Shape aShape);
-  BodySM* populate_topology_bridge(TopoDS_CompSolid aShape);
-  Lump* populate_topology_bridge(TopoDS_Solid aShape, 
+  DLIList<TopologyBridge*> populate_topology_bridge(TopoDS_Shape& aShape);
+  BodySM* populate_topology_bridge(const TopoDS_CompSolid& aShape);
+  Lump* populate_topology_bridge(const TopoDS_Solid& aShape, 
 				   CubitBoolean build_body = CUBIT_FALSE);
-  Surface* populate_topology_bridge(TopoDS_Face aShape,
+  Surface* populate_topology_bridge(const TopoDS_Face& aShape,
                                     CubitBoolean build_body = CUBIT_FALSE);
-  Curve* populate_topology_bridge(TopoDS_Edge aShape);
-  Point* populate_topology_bridge(TopoDS_Vertex aShape);
+  Curve* populate_topology_bridge(const TopoDS_Edge& aShape);
+  Point* populate_topology_bridge(const TopoDS_Vertex& aShape);
 
-  OCCShell* populate_topology_bridge(TopoDS_Shell aShape,
+  OCCShell* populate_topology_bridge(const TopoDS_Shell& aShape,
                                      CubitBoolean standalone = CUBIT_FALSE );
   DLIList<OCCBody*> *BodyList ;
   DLIList<OCCSurface*> *SurfaceList ;
@@ -378,7 +378,7 @@
   
 private:
 
-  OCCLoop* populate_topology_bridge(TopoDS_Wire aShape,
+  OCCLoop* populate_topology_bridge(const TopoDS_Wire& aShape,
 				    CubitBoolean standalone = CUBIT_FALSE);  
 
   CubitStatus write_topology( const char* file_name, 




More information about the cgma-dev mailing list