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

jiangtao_ma at yahoo.com jiangtao_ma at yahoo.com
Tue Jun 14 10:45:47 CDT 2011


Author: janehu
Date: 2011-06-14 10:45:46 -0500 (Tue, 14 Jun 2011)
New Revision: 4999

Modified:
   cgm/trunk/geom/OCC/OCCQueryEngine.cpp
   cgm/trunk/geom/OCC/OCCQueryEngine.hpp
Log:
function to support exporting single lump body's attributes to buffer. Testcases are following.

Modified: cgm/trunk/geom/OCC/OCCQueryEngine.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCQueryEngine.cpp	2011-06-14 15:19:01 UTC (rev 4998)
+++ cgm/trunk/geom/OCC/OCCQueryEngine.cpp	2011-06-14 15:45:46 UTC (rev 4999)
@@ -1081,6 +1081,66 @@
   return CUBIT_SUCCESS;
 }
 
+void OCCQueryEngine::body_attributes_for_writing(DLIList<OCCBody*> &OCC_bodies,
+                                  BRep_Builder &B,
+                                  TopoDS_Compound &Co,
+                                  DLIList<OCCLump*> &single_lumps,
+                                  DLIList< DLIList<CubitSimpleAttrib*>*> &lists)
+{
+  //Add every shape to the compound
+  OCCLump* lump = NULL;
+  CubitSimpleAttrib* body_csa = NULL;
+  DLIList<CubitSimpleAttrib*> body_csa_list;
+
+  for (int i = 0; i < OCC_bodies.size(); i++)
+  {
+    OCCBody* body = OCC_bodies.get_and_step();
+    TopoDS_Compound *shape = body->get_TopoDS_Shape();
+    if (shape == NULL || shape->IsNull()) //single lump or sheet or shell body
+    {
+       DLIList<OCCSurface*> surfaces = body->my_sheet_surfaces();
+       DLIList<OCCShell*> shells = body->shells();
+       DLIList<Lump*> lumps = body->lumps();
+       if(surfaces.size() == 1)
+         B.Add(Co,*(surfaces.get()->get_TopoDS_Face()));
+       else if (shells.size() == 1)
+         B.Add(Co,*(shells.get()->get_TopoDS_Shell()));
+       else
+       {
+         lump = CAST_TO(lumps.get(), OCCLump);
+         B.Add(Co, *(lump->get_TopoDS_Solid()));
+         //if body has attributes, add them to the solid.
+         DLIList<CubitSimpleAttrib*> csa_list;
+         body->get_simple_attribute(csa_list);
+         body_csa_list.clean_out();
+         for(int i = 0; i < csa_list.size(); i++)
+         {
+           CubitSimpleAttrib* csa = csa_list.get_and_step();
+           CubitString num_string(i);
+           CubitString* pre_fix = new CubitString("#SINGLELUMP%"+
+                                                  num_string);
+
+           DLIList<CubitString*> *string_list = csa->string_data_list();
+           DLIList<double*> *doubles = csa->double_data_list();
+           DLIList<int*> *ints = csa->int_data_list();
+           body_csa = new CubitSimpleAttrib;


More information about the cgma-dev mailing list