Changeset 1509

Show
Ignore:
Timestamp:
01/07/08 12:40:57 (2 years ago)
Author:
janehu
Message:

for moving/reflecting etc. funtions, OCC operation gives a new
object, need to update for body/lump of their underling CompSolid?/solid. now crashs at lump->set_TopoDS_Solid(TopoDS::Solid(M(i))); need to investigate.

Location:
cgm/trunk/geom/OCC
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • cgm/trunk/geom/OCC/OCCBody.cpp

    r1466 r1509  
    6767void OCCBody::lumps(DLIList<Lump*>& my_lumps) 
    6868{ 
     69  myLumps.clean_out(); 
    6970  myLumps += my_lumps; 
    7071} 
     
    205206//---------------------------------------------------------------- 
    206207// Function: reflect 
    207 // Description: reflect the body about a exis 
     208// Description: reflect the body about an plane given the normal 
     209//              vector. 
    208210// 
    209211// Author: Jane Hu 
    210212//---------------------------------------------------------------- 
    211213CubitStatus OCCBody::reflect( double reflect_axis_x, 
    212                                 double reflect_axis_y, 
    213                                 double reflect_axis_z ) 
     214                              double reflect_axis_y, 
     215                              double reflect_axis_z ) 
    214216{ 
    215217  gp_Pnt aOrigin(0,0,0); 
     
    221223 
    222224  BRepBuilderAPI_Transform aBRepTrsf(*myTopoDSShape, aTrsf);  
    223   update_bounding_box(); 
    224   return CUBIT_SUCCESS; 
    225 } 
    226  
     225  TopoDS_Shape shape = aBRepTrsf.ModifiedShape(*myTopoDSShape); 
     226   
     227  update_OCC_entity(shape); 
     228  update_bounding_box(); 
     229  return CUBIT_SUCCESS; 
     230} 
     231 
     232//---------------------------------------------------------------- 
     233// Function: private function to update the core compsolid and       
     234//           for any movement of the body. 
     235// Note:     input shape must have the same number of CompSolids 
     236//           as the body's lumps number. 
     237// Author: Jane Hu 
     238//---------------------------------------------------------------- 
     239CubitStatus OCCBody::update_OCC_entity( TopoDS_Shape shape)  
     240{ 
     241  TopoDS_CompSolid compsolid = TopoDS::CompSolid(shape); 
     242  set_TopoDS_Shape(compsolid); 
     243 
     244  //set the lumps 
     245  DLIList<Lump *> lumps; 
     246  lumps = this->lumps(); 
     247  TopTools_IndexedMapOfShape M; 
     248  TopExp::MapShapes(*myTopoDSShape, TopAbs_SOLID, M); 
     249  for (int i = 0; i < lumps.size(); i++) 
     250  { 
     251     OCCLump *lump = CAST_TO(lumps.get_and_step(), OCCLump); 
     252     lump->set_TopoDS_Solid(TopoDS::Solid(M(i))); 
     253  } 
     254} 
    227255//---------------------------------------------------------------- 
    228256// Function: update_bounding_box 
  • cgm/trunk/geom/OCC/OCCBody.hpp

    r1466 r1509  
    6262   
    6363  TopoDS_CompSolid *get_TopoDS_Shape() {return myTopoDSShape; } 
    64   void set_TopoDS_Shape( TopoDS_CompSolid shape){*myTopoDSShape = shape;} 
     64  void set_TopoDS_Shape( TopoDS_CompSolid theshape){*myTopoDSShape = theshape;} 
    6565 
    6666  virtual CubitStatus get_transforms( CubitTransformMatrix &tfm ); 
     
    176176 
    177177  CubitBox boundingbox; 
     178  CubitStatus update_OCC_entity( TopoDS_Shape shape); //update the lumps 
    178179}; 
    179180