cgma
OCCBody.hpp
Go to the documentation of this file.
00001 //-------------------------------------------------------------------------
00002 // Filename      : OCCBody.hpp
00003 //
00004 // Purpose       : 
00005 //
00006 // Special Notes :
00007 //
00008 // Creator       : David White
00009 //
00010 // Creation Date : 7/18/00
00011 //
00012 //-------------------------------------------------------------------------
00013 
00014 #ifndef OCC_BODY_HPP
00015 #define OCC_BODY_HPP
00016 
00017 // ********** BEGIN STANDARD INCLUDES      **********
00018 // ********** END STANDARD INCLUDES        **********
00019 
00020 // ********** BEGIN CUBIT INCLUDES         **********
00021 #include "CubitDefines.h"
00022 #include "BodySM.hpp"
00023 #include "CubitTransformMatrix.hpp"
00024 #include "CubitSimpleAttrib.hpp"
00025 #include "CubitBox.hpp"
00026 #include <TopAbs_ShapeEnum.hxx>
00027 // ********** END CUBIT INCLUDES           **********
00028 
00029 // ********** BEGIN FORWARD DECLARATIONS   **********
00030 class Body;
00031 class TopologyEntity;
00032 class CubitString;
00033 class OCCLump;
00034 class OCCShell;
00035 class OCCSurface;
00036 class OCCLoop;
00037 class OCCCurve;
00038 class OCCPoint;
00039 class BRepBuilderAPI_Transform;
00040 class BRepBuilderAPI_ModifyShape;
00041 class BRepAlgoAPI_BooleanOperation;
00042 class BRepBuilderAPI_MakeShape;
00043 class LocOpe_SplitShape;
00044 class TopoDS_Shape;
00045 class TopoDS_Compound;
00046 // ********** END FORWARD DECLARATIONS     **********
00047 
00048 class OCCBody : public BodySM
00049 {
00050 public:
00051   
00052   // Currently, the compound should only consists solids.
00053   OCCBody(TopoDS_Compound *theShape, 
00054           OCCSurface* surface = NULL, OCCShell* shell = NULL, Lump* lump = NULL);
00055 
00056   OCCBody(DLIList<Lump*>& my_lumps, DLIList<OCCShell*>& shells, DLIList<OCCSurface*>& surfaces);
00057   void lumps(DLIList<Lump*>& my_lumps); //add lump list to myLumps
00058   DLIList<Lump*> lumps(){return myLumps;} 
00059   
00060   void shells(DLIList<OCCShell*> shells) {myShells = shells;}
00061   void shells(OCCShell* shell) {myShells.append(shell);}
00062   DLIList<OCCShell*> shells() {return myShells;}
00063 
00064   virtual ~OCCBody() ;
00065     //- The destructor.
00066 
00067   virtual GeometryQueryEngine* get_geometry_query_engine() const;
00068     //R GeometryQueryEngine*
00069     //R- A pointer to the geometric modeling engine associated with
00070     //R- the object.
00071     //- This function returns a pointer to the geometric modeling engine
00072     //- associated with the object.
00073   
00074   TopoDS_Compound *get_TopoDS_Shape(); 
00075   void get_TopoDS_Shape(TopoDS_Shape *& shape);
00076   void set_TopoDS_Shape( TopoDS_Compound& theshape);
00077 
00078   virtual CubitStatus get_transforms( CubitTransformMatrix &tfm );
00079   //R CubitStatus
00080   //R- CUBIT_SUCCESS/CUBIT_FAILURE
00081   //I BODYPtr
00082   //- return the transformation matrix for this body
00083 
00084   virtual void append_simple_attribute_virt(const CubitSimpleAttrib&);
00085     //R void
00086     //I 
00087     //I- 
00088     //I- that is to be appended to this OSME object.
00089     //- The purpose of this function is to append a 
00090     //- attribute to the OSME. The  is attached to each of the 
00091     //- underlying solid model entities this one points to.
00092   
00093   virtual void remove_simple_attribute_virt(const CubitSimpleAttrib&);
00094     //R void
00095     //I CubitSimpleAttrib*
00096     //I- A reference to a CubitSimpleAttrib object which is the object
00097     //I- that is to be removed to this OSME object.
00098     //- The purpose of this function is to remove a simple
00099     //- attribute from the OSME. The attribute is attached to each of the
00100     //- underlying solid model entities this one points to.
00101   
00102   virtual void remove_all_simple_attribute_virt();
00103     //R void
00104     //I-
00105     //- The purpose of this function is to remove all simple
00106     //- attributes from the OSME.
00107   
00108   virtual CubitStatus get_simple_attribute(DLIList<CubitSimpleAttrib>&);
00109   virtual CubitStatus get_simple_attribute(const CubitString& name,
00110                                            DLIList<CubitSimpleAttrib>&);
00111     //R CubitSimpleAttrib*
00112     //R- the returned cubit simple attribute.
00113     //- The purpose of this function is to get the attributes
00114     //- of the geometry entity. The name is attached to the underlying solid
00115     //- model entity(ies) this one points to.
00116     //- MJP Note:
00117     //- This is the code that implements the requirement that names
00118     //- of VGI Entities propagate across solid model boolean
00119     //- operations.  The success of this relies, of course, on the underlying
00120     //- solid modeler being able to propagate attributes across
00121     //- such operations on its entities. If it cannot, then "names"
00122     //- of VGI entities will not propagate.
00123   
00124   virtual BodySM* copy();
00125     //R OCCBody*
00126     //R- Pointer to a OCCBody object
00127     //- Copies this OCCBody object (including the BODY that it
00128     //- contains) and returns a pointer to a new OCCBody object.
00129   
00130   void update_bounding_box();
00131     // calculate bounding box.
00132 
00133   CubitBox get_bounding_box();
00134     // return bounding box.
00135 
00136   virtual CubitStatus move(double , double , double );
00137     //R CubitStatus
00138     //R- CUBIT_SUCCESS/FAILURE
00139     //I dx, dy, dz
00140     //I- Offset values in each of the 3 Cartesian coordinate directions
00141     //- Move the  BODY by dx, dy and dz
00142   
00143   virtual CubitStatus rotate( double , double , double , 
00144                               double );
00145     //R CubitStatus
00146     //R- CUBIT_SUCCESS/FAILURE
00147     //I x, y, z
00148     //I- Axis of rotation
00149     //I angle_in_degrees
00150     //I- Angle of rotation in degrees
00151     //- Rotate the  BODY angle degrees about a vector defined by
00152     //- x, y and z
00153   
00154   virtual CubitStatus scale(double, double, double);
00155   
00156   virtual CubitStatus scale(double);
00157     //R CubitStatus
00158     //R- CUBIT_SUCCESS/FAILURE
00159     //I scaling_factor
00160     //I- Scaling factor
00161     //- Scale the  BODY by the factor, scaling_factor
00162 
00163   CubitStatus reflect(double,double,double);
00164     //- reflect about an axis
00165 
00166   virtual void get_parents_virt( DLIList<TopologyBridge*>& parents );
00167   virtual void get_children_virt( DLIList<TopologyBridge*>& children );
00168   
00169   void get_all_surfaces(DLIList<OCCSurface*> &surfaces);
00170   void get_all_curves(DLIList<OCCCurve*> &curves);
00171   void get_all_points(DLIList<OCCPoint*> &points);
00172 
00173   virtual CubitStatus mass_properties( CubitVector& result, double& volume );
00174   
00175   virtual CubitPointContainment point_containment( const CubitVector& pos, double tolerance );
00176 
00177   //update the underlining CompSolid, BRepBuilderAPI_ModifyShape now is 
00178   //referring to only BRepBuilderAPI_Transform or BRepBuilderAPI_GTransform.
00179   CubitStatus update_OCC_entity( BRepBuilderAPI_ModifyShape *aBRepTrsf,
00180                                  BRepAlgoAPI_BooleanOperation *op = NULL);
00181 
00182   static CubitStatus update_OCC_entity(TopoDS_Shape& old_shape,
00183                                        TopoDS_Shape& new_shape,
00184                                        BRepBuilderAPI_MakeShape *op,
00185                                        LocOpe_SplitShape* sp = NULL );
00186 
00187   DLIList<OCCSurface*> my_sheet_surfaces() {return mySheetSurfaces;}
00188 
00189   void set_sheet_surfaces(DLIList<OCCSurface*> surfaces); 
00190 
00191   void set_sheet_surfaces(OCCSurface* surf) {mySheetSurfaces.append(surf);}
00192   virtual CubitBoolean is_sheet_body();
00193 
00194   static TopoDS_Compound* make_Compound(DLIList<Lump*>& my_lumps,
00195                                         DLIList<OCCShell*>& shells,
00196                                         DLIList<OCCSurface*>& surfaces);
00197 
00198   CubitStatus transform(BRepBuilderAPI_Transform& aBRepTrsf); 
00199 protected: 
00200 private:
00201 
00202   DLIList<Lump*> myLumps;
00203     //List of the attached lumps for the traversal functions.
00204   DLIList<CubitSimpleAttrib> csa_list;
00205     //List of CubitSimpleAttribs 
00206   TopoDS_Compound *myTopoDSShape;
00207 
00208   CubitBox boundingbox;
00209 
00210   DLIList<OCCSurface*> mySheetSurfaces;
00211 
00212   DLIList<OCCShell*>  myShells; 
00213 };
00214 
00215 
00216 #endif
00217 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines