cgma-dev
Threads by month
- ----- 2026 -----
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
June 2008
- 2 participants
- 19 discussions
Author: janehu
Date: 2008-06-25 13:34:20 -0500 (Wed, 25 Jun 2008)
New Revision: 1927
Modified:
cgm/trunk/geom/ACIS_SRC/AcisModifyEngine.cpp
cgm/trunk/geom/ACIS_SRC/AcisModifyEngine.hpp
cgm/trunk/geom/GeometryModifyEngine.hpp
cgm/trunk/geom/GeometryModifyTool.cpp
cgm/trunk/geom/GeometryModifyTool.hpp
cgm/trunk/geom/OCC/OCCModifyEngine.cpp
cgm/trunk/geom/OCC/OCCModifyEngine.hpp
cgm/trunk/geom/facet/FacetModifyEngine.cpp
cgm/trunk/geom/facet/FacetModifyEngine.hpp
Log:
change back the thicken interface for making thick solid, and added a hollow method of making thick solid.
Modified: cgm/trunk/geom/ACIS_SRC/AcisModifyEngine.cpp
===================================================================
--- cgm/trunk/geom/ACIS_SRC/AcisModifyEngine.cpp 2008-06-25 17:34:56 UTC (rev 1926)
+++ cgm/trunk/geom/ACIS_SRC/AcisModifyEngine.cpp 2008-06-25 18:34:20 UTC (rev 1927)
@@ -5922,6 +5922,16 @@
return CUBIT_SUCCESS;
}
+
+CubitStatus AcisModifyEngine::hollow( DLIList<BodySM*>& bodies,
+ DLIList<Surface*>& surfs_to_remove,
+ DLIList<BodySM*>& new_body_list,
+ double depth) const
+{
+ PRINT_ERROR( "This function is not available in ACIS engine.\n");
+ return CUBIT_FAILURE;
+}
+
//-------------------------------------------------------------------------
// Purpose : To thicken sheet bodies
//
@@ -5941,7 +5951,6 @@
return CUBIT_FAILURE;
#else
CubitStatus AcisModifyEngine::thicken( DLIList<BodySM*>& bodies,
- DLIList<Surface*>& surfs_to_remove,
DLIList<BodySM*>& new_body_list,
double depth,
bool both) const
Modified: cgm/trunk/geom/ACIS_SRC/AcisModifyEngine.hpp
===================================================================
--- cgm/trunk/geom/ACIS_SRC/AcisModifyEngine.hpp 2008-06-25 17:34:56 UTC (rev 1926)
+++ cgm/trunk/geom/ACIS_SRC/AcisModifyEngine.hpp 2008-06-25 18:34:20 UTC (rev 1927)
@@ -382,16 +382,23 @@
virtual CubitStatus thicken( DLIList<BodySM*>& bodies,
- DLIList<Surface*>& surfs_to_remove,
DLIList<BodySM*>& new_bodies,
double depth,
bool both = false) const;
//- Thicken a sheet body into a solid
- //- surfs_to_remove is a dummy input
//R CubitStatus
//R-the result of the thicken operation: Success or Failure
+ virtual CubitStatus hollow( DLIList<BodySM*>& bodies,
+ DLIList<Surface*>& surfs_to_remove,
+ DLIList<BodySM*>& new_bodies,
+ double depth) const;
+
+ //- Hollow a solid body into a thick body
+ //R CubitStatus
+ //R-the result of the hollow operation: Failure
+
virtual CubitStatus flip_normals( DLIList<Surface*>& face_list ) const;
//R CubitStatus
//R-the result of the flip_normals operation: Success or Failure
Modified: cgm/trunk/geom/GeometryModifyEngine.hpp
===================================================================
--- cgm/trunk/geom/GeometryModifyEngine.hpp 2008-06-25 17:34:56 UTC (rev 1926)
+++ cgm/trunk/geom/GeometryModifyEngine.hpp 2008-06-25 18:34:20 UTC (rev 1927)
@@ -412,7 +412,6 @@
virtual CubitStatus thicken( DLIList<BodySM*>& bodies,
- DLIList<Surface*>& surfs_to_remove,
DLIList<BodySM*>& new_body_list,
double depth,
bool both = false) const = 0;
@@ -420,9 +419,6 @@
//R-the result of the thicken operation: Success or Failure
//I bodies
//I-DLIList<Body*>: a list of Body pointers that will be thicken
- //I- or for OCC: a list of solid BodySM's that will be hollowed into a
- //I- thick solid.
- //I- surfs_to_remove: the faces to be removed from the original solid (OCC).
//O- new Bodies build by thicken operation on the list of Body pointers.
//- This function performs a thicken of sheet bodies and returns
//- the result through the output argument in_out_body. If the thicken
@@ -431,6 +427,23 @@
//- argument is assigned a NULL value and the function returns
//- CUBIT_FAILURE.
+ virtual CubitStatus hollow(DLIList<BodySM*>& bodies,
+ DLIList<Surface*>& surfs_to_remove,
+ DLIList<BodySM*>& new_bodies,
+ double depth) const = 0;
+ //R CubitStatus
+ //R-the result of the hollow operation: Success or Failure
+ //I body
+ //I- for OCC: a list of solid BodySM's that will be hollowed into a list of
+ //I- thick solids.
+ //I- surfs_to_remove: the faces to be removed from the original solid (OCC).
+ //O- new Bodies build by hollow operation on the body pointers.
+ //- This function performs a hollow of solid body and returns
+ //- the result through the output argument in_out_body. If the hollow
+ //- operation went through OK, the function returns CUBIT_SUCCESS. If,
+ //- for some reason, the hollow operation did not go well, the output
+ //- argument is assigned a NULL value and the function returns
+ //- CUBIT_FAILURE.
virtual CubitStatus flip_normals( DLIList<Surface*>& face_list ) const = 0;
//R CubitStatus
Modified: cgm/trunk/geom/GeometryModifyTool.cpp
===================================================================
--- cgm/trunk/geom/GeometryModifyTool.cpp 2008-06-25 17:34:56 UTC (rev 1926)
+++ cgm/trunk/geom/GeometryModifyTool.cpp 2008-06-25 18:34:20 UTC (rev 1927)
@@ -4155,12 +4155,10 @@
return CUBIT_SUCCESS;
}
-CubitStatus GeometryModifyTool::
- make_thick_solid( DLIList<Body*>& bodies,
- DLIList<RefFace*>& faces_to_remove,
- DLIList<Body*>& new_bodies,
- double depth,
- bool both )
+CubitStatus GeometryModifyTool::thicken( DLIList<Body*>& bodies,
+ DLIList<Body*>& new_bodies,
+ double depth,
+ bool both )
{
if (bodies.size() <= 0)
{
@@ -4188,24 +4186,11 @@
return CUBIT_FAILURE;
}
- DLIList<Surface*> surfs_to_remove;
- if(faces_to_remove.size() > 0)
- {
- GeometryModifyEngine* gme2 = common_modify_engine(faces_to_remove,
- surfs_to_remove);
- if(gme2 != gme)
- {
- PRINT_ERROR("Performing THICKEN with volumes containing geometry\n"
- " from different modeling engines is not allowed.\n"
- "Delete uncommon geometry on these volumes before operation.\n\n");
- return CUBIT_FAILURE;
- }
- }
DLIList<BodySM*> new_sms(count);
DLIList<BodySM*> body_sms(count);
CAST_LIST(bridge_list, body_sms, BodySM);
- CubitStatus result = gme->thicken( body_sms, surfs_to_remove, new_sms, depth, both);
+ CubitStatus result = gme->thicken( body_sms, new_sms, depth, both);
// check for resued entities, they have been moved and we need to notify observers
DLIList<RefEntity*> entities_to_update;
Modified: cgm/trunk/geom/GeometryModifyTool.hpp
===================================================================
--- cgm/trunk/geom/GeometryModifyTool.hpp 2008-06-25 17:34:56 UTC (rev 1926)
+++ cgm/trunk/geom/GeometryModifyTool.hpp 2008-06-25 18:34:20 UTC (rev 1927)
@@ -225,8 +225,7 @@
bool keep_old = false,
bool nonreg = false );
- CubitStatus make_thick_solid( DLIList<Body*>& bodies,
- DLIList<RefFace*>& faces_to_remove,
+ CubitStatus thicken( DLIList<Body*>& bodies,
DLIList<Body*>& new_bodies,
double depth,
bool both = false );
Modified: cgm/trunk/geom/OCC/OCCModifyEngine.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCModifyEngine.cpp 2008-06-25 17:34:56 UTC (rev 1926)
+++ cgm/trunk/geom/OCC/OCCModifyEngine.cpp 2008-06-25 18:34:20 UTC (rev 1927)
@@ -3580,23 +3580,29 @@
return CUBIT_SUCCESS;
}
+CubitStatus OCCModifyEngine::thicken( DLIList<BodySM*>& bodies,
+ DLIList<BodySM*>& new_bodies,
+ double depth,
+ CubitBoolean both) const
+{
+ PRINT_ERROR("Option not supported for OCC based geometry.\n");
+ return CUBIT_FAILURE;
+}
//===============================================================================
-// Function : thicken
+// Function : hollow
// Member Type: PUBLIC
// Description: Hollow existing solid body by remove one or several surfaces
// Can only take one body at a time.
-// No both (side) option.
// depth > 0, thick body going outside bodies
// depth < 0, thick body going inside bodies
// Author : Jane Hu
// Date : 06/08
//===============================================================================
-CubitStatus OCCModifyEngine::thicken(DLIList<BodySM*>& bodies,
+CubitStatus OCCModifyEngine::hollow( DLIList<BodySM*>& bodies,
DLIList<Surface*>& surfs_to_remove,
DLIList<BodySM*>& new_bodies,
- double depth,
- bool /*both*/) const
+ double depth) const
{
if(bodies.size() != 1 || surfs_to_remove.size() < 1)
{
Modified: cgm/trunk/geom/OCC/OCCModifyEngine.hpp
===================================================================
--- cgm/trunk/geom/OCC/OCCModifyEngine.hpp 2008-06-25 17:34:56 UTC (rev 1926)
+++ cgm/trunk/geom/OCC/OCCModifyEngine.hpp 2008-06-25 18:34:20 UTC (rev 1927)
@@ -201,11 +201,15 @@
bool keep_old = CUBIT_FALSE) const;
virtual CubitStatus thicken(DLIList<BodySM*>& bodies,
- DLIList<Surface*>& surfs_to_remove,
DLIList<BodySM*>& new_bodies,
double depth,
bool both = CUBIT_FALSE) const ;
+ virtual CubitStatus hollow( DLIList<BodySM*>& bodies,
+ DLIList<Surface*>& surfs_to_remove,
+ DLIList<BodySM*>& new_bodies,
+ double depth) const ;
+
virtual CubitStatus flip_normals( DLIList<Surface*>& face_list ) const;
virtual CubitStatus sweep_translational(
Modified: cgm/trunk/geom/facet/FacetModifyEngine.cpp
===================================================================
--- cgm/trunk/geom/facet/FacetModifyEngine.cpp 2008-06-25 17:34:56 UTC (rev 1926)
+++ cgm/trunk/geom/facet/FacetModifyEngine.cpp 2008-06-25 18:34:20 UTC (rev 1927)
@@ -1737,6 +1737,15 @@
}
+CubitStatus FacetModifyEngine::hollow( DLIList<BodySM*>& /*bodies*/,
+ DLIList<Surface*> & /*surfs*/,
+ DLIList<BodySM*>& /*new_bodies*/,
+ double /*depth*/) const
+{
+ PRINT_ERROR("Option not supported for mesh based geometry.\n");
+ return CUBIT_FAILURE;
+}
+
//===============================================================================
// Function : thicken
// Member Type: PUBLIC
@@ -1745,7 +1754,6 @@
// Date : 10/02
//===============================================================================
CubitStatus FacetModifyEngine::thicken(DLIList<BodySM*>& /*bodies*/,
- DLIList<Surface*> & /*surfs*/,
DLIList<BodySM*>& /*new_bodies*/,
double /*depth*/,
bool /*both*/) const
Modified: cgm/trunk/geom/facet/FacetModifyEngine.hpp
===================================================================
--- cgm/trunk/geom/facet/FacetModifyEngine.hpp 2008-06-25 17:34:56 UTC (rev 1926)
+++ cgm/trunk/geom/facet/FacetModifyEngine.hpp 2008-06-25 18:34:20 UTC (rev 1927)
@@ -216,11 +216,15 @@
bool keep_old = CUBIT_FALSE) const;
virtual CubitStatus thicken(DLIList<BodySM*>& bodies,
- DLIList<Surface*>& surfs_to_remove,
DLIList<BodySM*>& new_bodies,
double depth,
bool both = CUBIT_FALSE) const ;
+ virtual CubitStatus hollow(DLIList<BodySM*>& bodies,
+ DLIList<Surface*>& surfs_to_remove,
+ DLIList<BodySM*>& new_bodies,
+ double depth) const ;
+
virtual CubitStatus flip_normals( DLIList<Surface*>& face_list ) const;
virtual CubitStatus sweep_translational(
1
0
Author: janehu
Date: 2008-06-25 12:34:56 -0500 (Wed, 25 Jun 2008)
New Revision: 1926
Modified:
cgm/trunk/geom/Cholla/CubitFacet.hpp
cgm/trunk/geom/Cholla/CubitPoint.hpp
cgm/trunk/geom/Curve.hpp
cgm/trunk/geom/DagType.hpp
cgm/trunk/geom/IntermediateGeomEngine.hpp
cgm/trunk/geom/RefEntity.hpp
cgm/trunk/geom/TBOwner.hpp
cgm/trunk/util/CubitFileIOWrapper.hpp
cgm/trunk/util/CubitString.hpp
cgm/trunk/util/CubitUtil.hpp
cgm/trunk/util/CubitVector.hpp
cgm/trunk/util/DLIList.cpp
cgm/trunk/util/DLIList.hpp
cgm/trunk/util/KDDTree.cpp
cgm/trunk/util/KDDTree.hpp
cgm/trunk/util/PriorityQueue.cpp
cgm/trunk/util/RTreeNode.cpp
cgm/trunk/util/RTreeNode.hpp
Log:
Check in for Serge Gosselin to remove compiling warnings we see in CGM.
Modified: cgm/trunk/geom/Cholla/CubitFacet.hpp
===================================================================
--- cgm/trunk/geom/Cholla/CubitFacet.hpp 2008-06-25 14:31:10 UTC (rev 1925)
+++ cgm/trunk/geom/Cholla/CubitFacet.hpp 2008-06-25 17:34:56 UTC (rev 1926)
@@ -134,7 +134,7 @@
virtual int id() = 0;
virtual void set_id( int ii ) = 0;
int tool_id(){return toolID;}
- void set_tool_id(int tool_id){toolID = tool_id;}
+ void set_tool_id(int my_tool_id){toolID = my_tool_id;}
virtual CubitFacetEdge *edge( int index ) = 0;
virtual void edge( CubitFacetEdge *the_edge, int index ) = 0;
@@ -261,7 +261,7 @@
//- Returns all adjacent facets to this edge (not including
//- this facet)
- CubitFacet *adjacent( int &index, int *tool_data )
+ CubitFacet *adjacent( int &index, int *my_tool_data )
//- Returns all adjacent facets to this edge index(not including
//- this facet)
{
@@ -270,7 +270,7 @@
CubitPoint *p1, *p2;
get_edge_pts( index, p1, p2 );
- return shared_facet_on_surf( p1, p2, *tool_data );
+ return shared_facet_on_surf( p1, p2, *my_tool_data );
}
CubitPoint* next_node(CubitPoint *current_point)
Modified: cgm/trunk/geom/Cholla/CubitPoint.hpp
===================================================================
--- cgm/trunk/geom/Cholla/CubitPoint.hpp 2008-06-25 14:31:10 UTC (rev 1925)
+++ cgm/trunk/geom/Cholla/CubitPoint.hpp 2008-06-25 17:34:56 UTC (rev 1926)
@@ -85,7 +85,7 @@
virtual double z() = 0;
virtual void set( const CubitVector &pos ) = 0;
- virtual void marked(int marked) {markedFlag = marked;};
+ virtual void marked(int is_marked) {markedFlag = is_marked;};
virtual int marked() {return markedFlag;};
virtual CubitVector coordinates() const = 0;
@@ -111,8 +111,9 @@
virtual double u() { return uVal; };
virtual double v() { return vVal; };
virtual double size() {return sizeVal; };
- virtual void set_uv( double u, double v ) { uVal = u; vVal = v; };
- virtual void set_uvs(double u, double v, double s) {uVal = u; vVal = v; sizeVal = s; }
+ virtual void set_uv( double u_new, double v_new ) { uVal = u_new; vVal = v_new; };
+ virtual void set_uvs(double u_new, double v_new, double s_new)
+ {uVal = u_new; vVal = v_new; sizeVal = s_new; }
//- get and set the u-v coordinates (careful with internal boundaries - see TDFacetBoundarPoint)
virtual CubitStatus get_uv( CubitFacet *facet, double &u, double &v );
virtual CubitStatus get_uvs( CubitFacet *facet, double &u, double &v, double &s);
Modified: cgm/trunk/geom/Curve.hpp
===================================================================
--- cgm/trunk/geom/Curve.hpp 2008-06-25 14:31:10 UTC (rev 1925)
+++ cgm/trunk/geom/Curve.hpp 2008-06-25 17:34:56 UTC (rev 1926)
@@ -109,7 +109,7 @@
virtual CubitStatus mid_point(const CubitVector &point1,
const CubitVector &point2,
- CubitVector& mid_point );
+ CubitVector& my_mid_point );
//R CubitStatus
//I CubitVector, CubitVector
//I- points between which the mid_point is needed
@@ -118,7 +118,7 @@
//- This function returns the mid point between two points on this
//-edge, by parameter
- virtual CubitStatus mid_point(CubitVector& mid_point);
+ virtual CubitStatus mid_point(CubitVector& my_mid_point);
//R CubitStatus
//O CubitVector
//O- mid point on this edge
@@ -397,11 +397,11 @@
}
inline
-CubitStatus Curve::mid_point(CubitVector &mid_point)
+CubitStatus Curve::mid_point(CubitVector &my_mid_point)
{
double param1 = 0.5 * (start_param() + end_param());
- return position_from_u(param1, mid_point);
+ return position_from_u(param1, my_mid_point);
}
inline
@@ -418,12 +418,12 @@
inline
CubitStatus Curve::mid_point(const CubitVector &point1,
const CubitVector &point2,
- CubitVector& mid_point )
+ CubitVector& my_mid_point )
{
double param1 = u_from_position(point1);
double param2 = u_from_position(point2);
param1 = 0.5 * (param1 + param2);
- return position_from_u(param1, mid_point);
+ return position_from_u(param1, my_mid_point);
}
//R CubitStatus
Modified: cgm/trunk/geom/DagType.hpp
===================================================================
--- cgm/trunk/geom/DagType.hpp 2008-06-25 14:31:10 UTC (rev 1925)
+++ cgm/trunk/geom/DagType.hpp 2008-06-25 17:34:56 UTC (rev 1926)
@@ -27,8 +27,8 @@
// Dimension may be outside the range [0,3], but
// if so is_valid() will return false. (i.e. it is
// possible to construct invalid DagType objects.)
- inline DagType( int dimension, FunctionalType func )
- : intType( 3 * dimension + func )
+ inline DagType( int my_dimension, FunctionalType func )
+ : intType( 3 * my_dimension + func )
{ }
@@ -44,7 +44,7 @@
// Return values are one of GroupingEntity_TYPE,
// SenseEntity_TYPE, or BasicTopologyEntity_TYPE.
inline FunctionalType functional_type() const
- { return (FunctionalType)(intType % 3); }
+ { return static_cast<FunctionalType> (intType % 3); }
// Is this a valid DagType?
@@ -55,8 +55,8 @@
// move above a Body or below a RefVertex in the DAG.
inline bool is_valid() const
{
- const unsigned body_type = 11;
- return (unsigned)intType <= body_type;
+ const unsigned my_body_type = 11;
+ return static_cast<unsigned>(intType) <= my_body_type;
}
// get parent of this type
Modified: cgm/trunk/geom/IntermediateGeomEngine.hpp
===================================================================
--- cgm/trunk/geom/IntermediateGeomEngine.hpp 2008-06-25 14:31:10 UTC (rev 1925)
+++ cgm/trunk/geom/IntermediateGeomEngine.hpp 2008-06-25 17:34:56 UTC (rev 1926)
@@ -12,6 +12,9 @@
{
public:
+
+ virtual ~IntermediateGeomEngine() {}
+
virtual bool is_composite(TBOwner *bridge_owner) = 0;
virtual bool is_partition(TBOwner *bridge_owner) = 0;
Modified: cgm/trunk/geom/RefEntity.hpp
===================================================================
--- cgm/trunk/geom/RefEntity.hpp 2008-06-25 14:31:10 UTC (rev 1925)
+++ cgm/trunk/geom/RefEntity.hpp 2008-06-25 17:34:56 UTC (rev 1926)
@@ -304,7 +304,7 @@
inline int
RefEntity::marked()
-{return (int) markedFlag;}
+{return static_cast<int>(markedFlag);}
inline void
RefEntity::list_mark(int value)
Modified: cgm/trunk/geom/TBOwner.hpp
===================================================================
--- cgm/trunk/geom/TBOwner.hpp 2008-06-25 14:31:10 UTC (rev 1925)
+++ cgm/trunk/geom/TBOwner.hpp 2008-06-25 17:34:56 UTC (rev 1926)
@@ -22,6 +22,8 @@
{
public:
+
+ virtual ~TBOwner() {}
virtual CubitStatus remove_bridge( TopologyBridge* bridge ) = 0;
@@ -33,7 +35,7 @@
bool reversed ) = 0;
virtual CubitBoolean contains_bridge( TopologyBridge* bridge ) const
- { return (CubitBoolean)(bridge->owner() == this); }
+ { return static_cast<CubitBoolean>(bridge->owner() == this); }
virtual void notify_reversed( TopologyBridge* ) = 0;
Modified: cgm/trunk/util/CubitFileIOWrapper.hpp
===================================================================
--- cgm/trunk/util/CubitFileIOWrapper.hpp 2008-06-25 14:31:10 UTC (rev 1925)
+++ cgm/trunk/util/CubitFileIOWrapper.hpp 2008-06-25 17:34:56 UTC (rev 1926)
@@ -77,7 +77,7 @@
unsigned char* lpCurFromByte;
unsigned char lachrBuffer[sizeof(T)];
- unsigned char* lpCurAtom = (unsigned char*)xpT;
+ unsigned char* lpCurAtom = reinterpret_cast<unsigned char*>(xpT);
int lintAtom = xintCount;
while(lintAtom) {
lintAtom--;
Modified: cgm/trunk/util/CubitString.hpp
===================================================================
--- cgm/trunk/util/CubitString.hpp 2008-06-25 14:31:10 UTC (rev 1925)
+++ cgm/trunk/util/CubitString.hpp 2008-06-25 17:34:56 UTC (rev 1926)
@@ -27,7 +27,7 @@
class CubitStringRep;
-const size_t MAX_POS = (size_t) -1; // "SIZE_T_MAX"
+const size_t MAX_POS = static_cast<size_t>(-1); // "SIZE_T_MAX"
class CUBIT_UTIL_EXPORT CubitString
{
Modified: cgm/trunk/util/CubitUtil.hpp
===================================================================
--- cgm/trunk/util/CubitUtil.hpp 2008-06-25 14:31:10 UTC (rev 1925)
+++ cgm/trunk/util/CubitUtil.hpp 2008-06-25 17:34:56 UTC (rev 1926)
@@ -130,7 +130,7 @@
sense == CUBIT_REVERSED );
if ( sense == CUBIT_UNKNOWN ) return CUBIT_UNKNOWN;
else {
- CubitSense opp_sense = (CubitSense) (1 - sense);
+ CubitSense opp_sense = static_cast<CubitSense>(1 - sense);
return opp_sense;
}
}
Modified: cgm/trunk/util/CubitVector.hpp
===================================================================
--- cgm/trunk/util/CubitVector.hpp 2008-06-25 14:31:10 UTC (rev 1925)
+++ cgm/trunk/util/CubitVector.hpp 2008-06-25 17:34:56 UTC (rev 1926)
@@ -44,7 +44,7 @@
CubitVector(const CubitVectorStruct& from);
//- Heading: Set and Inquire Functions
- void set(const double x, const double y, const double z);
+ void set(const double x_coord, const double y_coord, const double z_coord);
//- Change vector components to {x}, {y}, and {z}
void set( const double xyz[3] );
@@ -66,22 +66,22 @@
double& y();
double& z();
- void get_xyz( double &x, double &y, double &z ) const; //- Get x, y, z components
+ void get_xyz( double &x_coord, double &y_coord, double &z_coord ) const; //- Get x, y, z components
void get_xyz( double xyz[3] ) const; //- Get xyz tuple
double &r(); //- Return r component of vector, if (r,theta) format
double &theta(); //- Return theta component of vector, if (r,theta) format
- void x( const double x ); //- Set x component of vector
+ void x( const double x_coord ); //- Set x component of vector
- void y( const double y ); //- Set y component of vector
+ void y( const double y_coord ); //- Set y component of vector
- void z( const double z ); //- Set z component of vector
+ void z( const double z_coord ); //- Set z component of vector
- void r( const double x ); //- Set r component of vector, if (r,theta) format
+ void r( const double radius ); //- Set r component of vector, if (r,theta) format
- void theta( const double y ); //- Set theta component of vector, if (r,theta) format
+ void theta( const double angle ); //- Set theta component of vector, if (r,theta) format
void xy_to_rtheta();
//- convert from cartesian to polar coordinates, just 2d for now
@@ -303,26 +303,26 @@
xyz[1] = yVal;
xyz[2] = zVal;
}
-inline void CubitVector::get_xyz(double &x, double &y, double &z) const
+inline void CubitVector::get_xyz(double &x_coord, double &y_coord, double &z_coord) const
{
- x = xVal;
- y = yVal;
- z = zVal;
+ x_coord = xVal;
+ y_coord = yVal;
+ z_coord = zVal;
}
inline double &CubitVector::r()
{ return xVal; }
inline double &CubitVector::theta()
{ return yVal; }
-inline void CubitVector::x( const double x )
-{ xVal = x; }
-inline void CubitVector::y( const double y )
-{ yVal = y; }
-inline void CubitVector::z( const double z )
-{ zVal = z; }
-inline void CubitVector::r( const double x )
-{ xVal = x; }
-inline void CubitVector::theta( const double y )
-{ yVal = y; }
+inline void CubitVector::x( const double x_coord )
+{ xVal = x_coord; }
+inline void CubitVector::y( const double y_coord )
+{ yVal = y_coord; }
+inline void CubitVector::z( const double z_coord )
+{ zVal = z_coord; }
+inline void CubitVector::r( const double radius )
+{ xVal = radius; }
+inline void CubitVector::theta( const double angle )
+{ yVal = angle; }
inline CubitVector& CubitVector::operator+=(const CubitVector &v)
{
xVal += v.xVal;
@@ -386,13 +386,13 @@
y( -temp );
}
-inline void CubitVector::set(const double x,
- const double y,
- const double z)
+inline void CubitVector::set(const double x_coord,
+ const double y_coord,
+ const double z_coord)
{
- xVal = x;
- yVal = y;
- zVal = z;
+ xVal = x_coord;
+ yVal = y_coord;
+ zVal = z_coord;
}
inline void CubitVector::set(const double xyz[3])
Modified: cgm/trunk/util/DLIList.cpp
===================================================================
--- cgm/trunk/util/DLIList.cpp 2008-06-25 14:31:10 UTC (rev 1925)
+++ cgm/trunk/util/DLIList.cpp 2008-06-25 17:34:56 UTC (rev 1926)
@@ -27,16 +27,16 @@
//- will be grown by {increment} each time it is filled. Memory for the
//- list is not allocated until the first element is inserted using
//- {insertLink}.
-template <class X> MY_INLINE DLIList<X>::DLIList (int size)
+template <class X> MY_INLINE DLIList<X>::DLIList (int list_size)
{
index = 0;
itemCount = 0;
listLength = 0;
listArray = NULL;
- if (size)
+ if (list_size)
{
- listArray = new X [size];
- listLength = size;
+ listArray = new X [list_size];
+ listLength = list_size;
}
}
@@ -76,7 +76,7 @@
{
// Make a new array
int new_size =
- (int) ((double)listLength * by_what_factor)
+ static_cast<int>( static_cast<double>(listLength) * by_what_factor )
+ by_how_much;
X* temp_list = new X [new_size];
@@ -173,7 +173,7 @@
X* end1 = iter1 + itemCount; // end of this array
X* iter2 = intersect_list.listArray; // iterstor for other array
X* end2 = iter2 + intersect_list.itemCount;// end of other array
- X* insert = iter1 - 1; // location of last insert
+ X* last_insert = iter1 - 1; // location of last insert
for ( ; iter1 < end1; ++iter1 )
{
@@ -183,13 +183,13 @@
if (iter2 == end2)
break;
- if ((*iter2 == *iter1) && // items are the same and ...
- (insert < listArray || // is the first item or ...
- *iter1 != *insert)) // is not the same as the previous item
- *++insert = *iter1;
+ if ((*iter2 == *iter1) && // items are the same and ...
+ (last_insert < listArray || // is the first item or ...
+ *iter1 != *last_insert)) // is not the same as the previous item
+ *++last_insert = *iter1;
}
- itemCount = insert - listArray + 1;
+ itemCount = last_insert - listArray + 1;
reset();
}
@@ -218,7 +218,7 @@
template <class X> MY_INLINE void DLIList<X>::intersect ( void* merge_list )
{
- intersect( *(DLIList<X>*)merge_list );
+ intersect( *static_cast< DLIList<X>* >(merge_list) );
}
@@ -230,7 +230,7 @@
if ( !itemCount )
{
PRINT_WARNING("Attempted link removal from empty DLIList\n");
- return (X)0;
+ return X(0);
}
// save the current value
@@ -267,7 +267,7 @@
if ( !itemCount )
{
PRINT_WARNING("Attempted link removal from empty DLIList\n");
- return (X)0;
+ return X(0);
}
// save the current value
@@ -334,7 +334,7 @@
if ( !itemCount )
{
PRINT_WARNING("Attempted step_and_get from empty DLIList\n");
- return (X)0;
+ return X(0);
}
if (++index == itemCount)
@@ -400,7 +400,7 @@
template <class X> MY_INLINE DLIList<X>& DLIList<X>::
operator+=(void* from)
{
- DLIList<X>* cast_from = (DLIList<X>*)from;
+ DLIList<X>* cast_from = static_cast< DLIList<X>* >(from);
// Don't do anything if the list being appended is empty.
if (cast_from->itemCount == 0)
@@ -594,14 +594,14 @@
{
// report amount of memory allocated
- int size = listLength * sizeof(X);
+ int my_size = listLength * sizeof(X);
if (verbose_boolean)
{
- PRINT_INFO(" DLIList: %d bytes\n",size);
+ PRINT_INFO(" DLIList: %d bytes\n", my_size);
}
- return size;
+ return my_size;
}
template <class X> MY_INLINE void DLIList<X>::copy_to(X *other_array)
Modified: cgm/trunk/util/DLIList.hpp
===================================================================
--- cgm/trunk/util/DLIList.hpp 2008-06-25 14:31:10 UTC (rev 1925)
+++ cgm/trunk/util/DLIList.hpp 2008-06-25 17:34:56 UTC (rev 1926)
@@ -37,7 +37,7 @@
public:
friend class DLIListIterator<X>;
- explicit DLIList (int size = 0);
+ explicit DLIList (int list_size = 0);
//- Constructor: Create a list with initial size 'size'. Memory for the
//- list is not allocated until the first element is added to the list.
@@ -109,7 +109,7 @@
int operator==(const DLIList<X>& from);
int operator!=(const DLIList<X>& from);
- X & operator[](int index) const;
+ X & operator[](int my_index) const;
void merge_unique(const DLIList<X>& merge_list,
bool merge_list_unique = false);
//- Merges the contents of the list, merge_list, with those of "this"
@@ -264,10 +264,10 @@
}
template <class X> inline
-X & DLIList<X>::operator[](int index) const
+X & DLIList<X>::operator[](int my_index) const
{
- assert( index >= 0 && index < itemCount );
- return listArray[index];
+ assert( my_index >= 0 && my_index < itemCount );
+ return listArray[my_index];
}
template <class X> inline void DLIList<X>::step()
@@ -379,7 +379,7 @@
if ( !itemCount )
{
PRINT_WARNING("Attempted get of empty DLIList\n");
- return (X)0;
+ return X(0);
}
else
{
@@ -393,7 +393,7 @@
if ( !itemCount )
{
PRINT_WARNING("Attempted get_and_step from empty DLIList\n");
- return (X)0;
+ return X(0);
}
else
#endif
@@ -410,7 +410,7 @@
if ( !itemCount )
{
PRINT_WARNING("Attempted get_and_back from empty DLIList\n");
- return (X)0;
+ return X(0);
}
X temp = listArray[index--];
if (index < 0)
@@ -423,7 +423,7 @@
if (!itemCount)
{
PRINT_WARNING("Attempted next of empty DLIList\n");
- return (X)0;
+ return X(0);
}
else if (index == itemCount-1)
return listArray[0];
@@ -436,7 +436,7 @@
if ( !itemCount )
{
PRINT_WARNING("Attempted next of empty DLIList\n");
- return (X)0;
+ return X(0);
}
else
{
@@ -484,7 +484,7 @@
template <class X> inline X DLIList<X>::change_to (X new_value)
{
- X temp = (X)0;
+ X temp = X(0);
if ( !itemCount )
{
PRINT_WARNING("DLIList: Attempted update of empty list\n");
@@ -516,7 +516,7 @@
// If the item was found and removed it is returned, else 0 is returned.
template <class X> inline X DLIList<X>::remove (X item)
{
- X temp = (X)0;
+ X temp = X(0);
if (move_to(item))
temp = remove();
return temp;
Modified: cgm/trunk/util/KDDTree.cpp
===================================================================
--- cgm/trunk/util/KDDTree.cpp 2008-06-25 14:31:10 UTC (rev 1925)
+++ cgm/trunk/util/KDDTree.cpp 2008-06-25 17:34:56 UTC (rev 1926)
@@ -60,7 +60,7 @@
if (myRandomOn)
{
//// seed the random number generator
- srand( (unsigned)time( NULL ) );
+ srand( static_cast<unsigned>(time(NULL)) );
}
}
@@ -375,17 +375,17 @@
//- Find the depth of the tree
template <class Z> void KDDTree<Z>::recursive_find_max_height
- (KDDTreeNode<Z> *root, int depth, int *maxdepth)
+ (KDDTreeNode<Z> *the_root, int depth, int *maxdepth)
{
- if (root)
+ if (the_root)
{
depth++;
if (depth > *maxdepth)
{
*maxdepth = depth;
}
- recursive_find_max_height (root->left, depth, maxdepth);
- recursive_find_max_height (root->right, depth, maxdepth);
+ recursive_find_max_height (the_root->left, depth, maxdepth);
+ recursive_find_max_height (the_root->right, depth, maxdepth);
}
}
@@ -495,7 +495,7 @@
myMarkedNodes++;
if (myDeletionTolerance != 0)
{
- if ( (((double)myMarkedNodes / myNodeList.size()) > myDeletionTolerance) &&
+ if ( (( static_cast<double>(myMarkedNodes) / myNodeList.size()) > myDeletionTolerance) &&
(myMarkedNodes > 1)
)
{
Modified: cgm/trunk/util/KDDTree.hpp
===================================================================
--- cgm/trunk/util/KDDTree.hpp 2008-06-25 14:31:10 UTC (rev 1925)
+++ cgm/trunk/util/KDDTree.hpp 2008-06-25 17:34:56 UTC (rev 1926)
@@ -49,7 +49,7 @@
double min_dist_sq (CubitVector &q, CubitBox &b_box);
//- Find the depth of the tree recursively
- void recursive_find_max_height (KDDTreeNode<Z> *root, int depth, int *maxdepth);
+ void recursive_find_max_height (KDDTreeNode<Z> *the_root, int depth, int *maxdepth);
//- Balance the tree recursively
KDDTreeNode<Z> *recursive_balance (DIMENSION dim, int left, int right,
Modified: cgm/trunk/util/PriorityQueue.cpp
===================================================================
--- cgm/trunk/util/PriorityQueue.cpp 2008-06-25 14:31:10 UTC (rev 1925)
+++ cgm/trunk/util/PriorityQueue.cpp 2008-06-25 17:34:56 UTC (rev 1926)
@@ -35,7 +35,7 @@
{
PRINT_ERROR("Empty priority queue had top request.\n");
assert(!empty());
- return (Object)0;
+ return static_cast<Object>(0);
}
return theItems[1];
}
Modified: cgm/trunk/util/RTreeNode.cpp
===================================================================
--- cgm/trunk/util/RTreeNode.cpp 2008-06-25 14:31:10 UTC (rev 1925)
+++ cgm/trunk/util/RTreeNode.cpp 2008-06-25 17:34:56 UTC (rev 1926)
@@ -35,7 +35,7 @@
myChildrenNodes = new RTreeNode<Y>* [maxChildren];
int ii;
for ( ii = 0; ii < maxChildren; ii++ )
- myChildrenNodes[ii] = (RTreeNode<Y>*) NULL;
+ myChildrenNodes[ii] = static_cast< RTreeNode<Y>* >(NULL);
if ( data == NULL )
{
PRINT_ERROR("Building RTree with null data is not allowed!\n");
@@ -70,17 +70,17 @@
distIsBox = 1;
myDist = CUBIT_DBL_MAX;
}
-template <class Y> MY_INLINE RTreeNode<Y>::RTreeNode (CubitBox &bounding_box,
+template <class Y> MY_INLINE RTreeNode<Y>::RTreeNode (CubitBox &bound_box,
int max_children,
int min_children)
{
maxChildren = max_children;
minChildren = min_children;
- myBoundingBox = new CubitBox(bounding_box);
+ myBoundingBox = new CubitBox(bound_box);
myChildrenNodes = new RTreeNode<Y>* [maxChildren];
int ii;
for ( ii = 0; ii < maxChildren; ii++ )
- myChildrenNodes[ii] = (RTreeNode<Y>*) NULL;
+ myChildrenNodes[ii] = static_cast< RTreeNode<Y>* >(NULL);
myData = NULL;
myLevel = UNSET_RNODE;
myParent = NULL;
@@ -199,7 +199,7 @@
}
//do error checking...
if ( child_index == -1 || child_index >= maxChildren )
- return (RTreeNode<Y>*)NULL;
+ return static_cast< RTreeNode<Y>* >(NULL);
RTreeNode<Y> *f = n->myChildrenNodes[child_index];
//Now continue on...
curr_node = choose_leaf(f,e);
@@ -420,12 +420,12 @@
myBoundingBox = new CubitBox(new_box);
}
template <class Y> MY_INLINE void RTreeNode<Y>::add_child(RTreeNode<Y> *child_node,
- CubitBoolean recalc_b_box)
+ CubitBoolean recalc_bound_box)
{
assert(nextChildIndex < maxChildren && child_node != NULL );
myChildrenNodes[nextChildIndex] = child_node;
//update the bounding box. by uniting with child node...
- if ( recalc_b_box )
+ if ( recalc_bound_box )
{
CubitBox *old_box = myBoundingBox;
myBoundingBox = new CubitBox( *old_box |= child_node->bounding_box());
@@ -464,8 +464,8 @@
RTreeNode<Y> *e_1, *e_2;
CubitBox e_box_1, e_box_2, j;
double d, max_d = -CUBIT_DBL_MAX;
- seed_1 = (RTreeNode<Y>*)NULL;
- seed_2 = (RTreeNode<Y>*)NULL;
+ seed_1 = static_cast< RTreeNode<Y>* >(NULL);
+ seed_2 = static_cast< RTreeNode<Y>* >(NULL);
for(ii = 0; ii < input_list_size; ii++ )
{
@@ -509,7 +509,7 @@
int ii, next_index = 0;
double d1, d2, max_diff = -CUBIT_DBL_MAX;
add_to_group_1 = CUBIT_TRUE;
- RTreeNode<Y> *max_diff_node = (RTreeNode<Y>*)NULL;
+ RTreeNode<Y> *max_diff_node = static_cast< RTreeNode<Y>* >(NULL);
RTreeNode<Y> *curr_node;
CubitBox group_1_box = group_1->bounding_box();
CubitBox group_2_box = group_2->bounding_box();
@@ -659,7 +659,7 @@
if ( root->num_children() == 1 )
{
new_root = root->get_child(0);
- new_root->set_parent((RTreeNode<Y>*)NULL);
+ new_root->set_parent(static_cast< RTreeNode<Y>* >(NULL));
delete_root = CUBIT_TRUE;
}
return CUBIT_TRUE;
Modified: cgm/trunk/util/RTreeNode.hpp
===================================================================
--- cgm/trunk/util/RTreeNode.hpp 2008-06-25 14:31:10 UTC (rev 1925)
+++ cgm/trunk/util/RTreeNode.hpp 2008-06-25 17:34:56 UTC (rev 1926)
@@ -110,7 +110,7 @@
public:
RTreeNode(Y data, double tol, int max_children, int min_children );
- RTreeNode(CubitBox &bounding_box, int max_children, int min_children);
+ RTreeNode(CubitBox &bound_box, int max_children, int min_children);
~RTreeNode();
//- Constructor/Destructor
@@ -140,7 +140,7 @@
{return myData;}
//- Determine if the RTreeNode is a leaf node.
- void add_child(RTreeNode<Y>* child_node, CubitBoolean recalc_b_box);
+ void add_child(RTreeNode<Y>* child_node, CubitBoolean recalc_bound_box);
//- Add the child to the myChildrenNodes' list. Adds
//- it to the next availabel spot. Won't add if overflow will
//- occur.
@@ -156,7 +156,7 @@
//- Returns the number of children in the myChildrenNode's array.
RTreeNode<Y>* get_child(int i)
- {return ((i < nextChildIndex) ? myChildrenNodes[i] : (RTreeNode<Y>*)NULL) ;}
+ {return ( (i < nextChildIndex) ? myChildrenNodes[i] : static_cast< RTreeNode<Y>* >(NULL) );}
void flush(CubitBox &new_box);
1
0
Author: janehu
Date: 2008-06-24 13:48:52 -0500 (Tue, 24 Jun 2008)
New Revision: 1921
Modified:
cgm/trunk/geom/OCC/OCCModifyEngine.cpp
Log:
Didn't find any support files for flip-normal operation for surfaces, preparing working on sweep.
Modified: cgm/trunk/geom/OCC/OCCModifyEngine.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCModifyEngine.cpp 2008-06-24 18:47:27 UTC (rev 1920)
+++ cgm/trunk/geom/OCC/OCCModifyEngine.cpp 2008-06-24 18:48:52 UTC (rev 1921)
@@ -3674,12 +3674,12 @@
// Function : flip_normals
// Member Type: PUBLIC
// Description:
-// Author : John Fowler
-// Date : 10/02
+// Author : Jane Hu
+// Date : 06/08
//===============================================================================
CubitStatus OCCModifyEngine :: flip_normals( DLIList<Surface*>& face_list ) const
{
- PRINT_ERROR("Option not supported for mesh based geometry.\n");
+ PRINT_ERROR("Option not supported for OCC based geometry.\n");
return CUBIT_FAILURE;
}
@@ -3688,8 +3688,8 @@
// Function : sweep_translational
// Member Type: PUBLIC
// Description:
-// Author : John Fowler
-// Date : 10/02
+// Author : Jane Hu
+// Date : 06/08
//===============================================================================
CubitStatus OCCModifyEngine:: sweep_translational(
DLIList<GeometryEntity*>& /*ref_ent_list*/,
1
0
Author: janehu
Date: 2008-06-24 13:47:27 -0500 (Tue, 24 Jun 2008)
New Revision: 1920
Modified:
cgm/trunk/test/modify.cpp
Log:
test passed thick body generation except for the ref_face's number seems not composited at inside the neck. Would be the same face recognition issue as in unite operation.
Modified: cgm/trunk/test/modify.cpp
===================================================================
--- cgm/trunk/test/modify.cpp 2008-06-24 03:07:22 UTC (rev 1919)
+++ cgm/trunk/test/modify.cpp 2008-06-24 18:47:27 UTC (rev 1920)
@@ -642,8 +642,9 @@
stat = gmti->unite(from_bodies, new_bodies, CUBIT_FALSE);
//Updated volume(s): 51
//Destroyed volume(s): 50
- d = new_bodies.get()->measure(); //d = 65
- n = new_bodies.get()->num_ref_faces(); //d = 11
+ d = new_bodies.get()->measure(); //d = 64.5
+ n = new_bodies.get()->num_ref_faces();
+ //d = 13. because fusion keeps the imprintings.
bodies.clean_out();
gti->bodies(bodies); //bodies.size() = 1
@@ -654,5 +655,36 @@
free_entities.clean_out();
gti->get_free_ref_entities(free_entities); //free_entities.size() = 0
+ //test making thick body.
+ from_body = gmti->cylinder(10, 4, 4, 4);
+ tool_body = gmti->cylinder(5,1,1,1);
+ // v = from_body->center_point();
+ //v = tool_body->center_point();
+ CubitVector v_move8(0,0,10);
+ gti->translate(tool_body,v_move8);
+ from_bodies.clean_out();
+ from_bodies.append(from_body);
+ from_bodies.append(tool_body);
+ new_bodies.clean_out();
+ stat = gmti->unite(from_bodies, new_bodies, CUBIT_FALSE);
+ d = new_bodies.get()->measure(); //d = 518.3627
+ n = new_bodies.get()->num_ref_faces(); //n = 5
+ //find the top most surface as the opening of the thick body.
+ ref_faces.clean_out();
+ new_bodies.get()->ref_faces(ref_faces);
+ CubitVector center(0,0,15);
+ for(int i = 0; i < n; i++)
+ {
+ if(ref_faces.step_and_get()->is_planar() &&
+ ref_faces.get()->center_point() == center )
+ break;
+ }
+ DLIList<RefFace*> faces_to_remove;
+ faces_to_remove.append(ref_faces.get());
+ from_bodies = new_bodies;
+ new_bodies.clean_out();
+ stat = gmti->make_thick_solid(from_bodies, faces_to_remove, new_bodies, -.2);
+ n = new_bodies.get()->num_ref_faces(); //n = 10
+ d = new_bodies.get()->measure(); //d = 72.3618
return CUBIT_SUCCESS;
}
1
0
Author: janehu
Date: 2008-06-20 13:33:15 -0500 (Fri, 20 Jun 2008)
New Revision: 1915
Modified:
cgm/trunk/geom/OCC/OCCModifyEngine.cpp
cgm/trunk/geom/OCC/OCCQueryEngine.cpp
Log:
Added function to make thick solid.
Modified: cgm/trunk/geom/OCC/OCCModifyEngine.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCModifyEngine.cpp 2008-06-19 17:33:03 UTC (rev 1914)
+++ cgm/trunk/geom/OCC/OCCModifyEngine.cpp 2008-06-20 18:33:15 UTC (rev 1915)
@@ -52,6 +52,7 @@
#include "BRepBuilderAPI_MakeEdge.hxx"
#include "BRepAdaptor_Surface.hxx"
#include "BRepBuilderAPI_MakeFace.hxx"
+#include "BRepOffsetAPI_MakeThickSolid.hxx"
#include "BRepBuilderAPI_Sewing.hxx"
#include "BRepBuilderAPI_Copy.hxx"
#include "LocOpe_SplitShape.hxx"
@@ -3583,18 +3584,89 @@
//===============================================================================
// Function : thicken
// Member Type: PUBLIC
-// Description:
-// Author : John Fowler
-// Date : 10/02
+// Description: Hollow existing solid body by remove one or several surfaces
+// Can only take one body at a time.
+// No both (side) option.
+// depth > 0, thick body going outside bodies
+// depth < 0, thick body going inside bodies
+// Author : Jane Hu
+// Date : 06/08
//===============================================================================
-CubitStatus OCCModifyEngine::thicken(DLIList<BodySM*>& /*bodies*/,
+CubitStatus OCCModifyEngine::thicken(DLIList<BodySM*>& bodies,
DLIList<Surface*>& surfs_to_remove,
- DLIList<BodySM*>& /*new_bodies*/,
- double /*depth*/,
- bool /*both*/) const
+ DLIList<BodySM*>& new_bodies,
+ double depth,
+ bool /*both*/) const
{
- PRINT_ERROR("Option not supported for mesh based geometry.\n");
- return CUBIT_FAILURE;
+ if(bodies.size() != 1 || surfs_to_remove.size() < 1)
+ {
+ PRINT_ERROR("Making thick solid in OCC will take one body and at least one surface at a time.\n");
+ return CUBIT_FAILURE;
+ }
+
+ DLIList<TopoDS_Shape*> shape_list;
+ DLIList<CubitBoolean> is_volume;
+ CubitStatus stat = get_shape_list(bodies, shape_list, is_volume, CUBIT_FALSE);
+
+ if(!stat)
+ return stat;
+
+ if(!is_volume.get())//sheet body
+ {
+ PRINT_ERROR("Making thick solid in OCC needs an initial solid body to hollow with.\n");
+ return CUBIT_FAILURE;
+ }
+
+ //make sure the body to be hollowed has only one lump
+ OCCBody* occ_body = CAST_TO(bodies.get(), OCCBody);
+ DLIList<Lump*> lumps;
+ lumps = occ_body->lumps();
+ if(lumps.size()!=1)
+ {
+ PRINT_ERROR("bodies with more than one lump can't be hollowed to make a thick body.\n");
+ return CUBIT_FAILURE;
+ }
+
+ //make sure surfs_to_remove are all in bodies
+ DLIList<OCCSurface*> surfaces;
+ TopTools_ListOfShape face_shapes;
+ occ_body->get_all_surfaces(surfaces);
+ for(int i = 0; i < surfs_to_remove.size(); i++)
+ {
+ OCCSurface* occ_surf = CAST_TO(surfs_to_remove.get(), OCCSurface);
+ if(!occ_surf)
+ continue;
+ if(!surfaces.is_in_list(occ_surf))
+ continue;
+ TopoDS_Face * face = occ_surf->get_TopoDS_Face();
+ face_shapes.Append(*face);
+ }
+
+ if(face_shapes.IsEmpty())
+ {
+ PRINT_ERROR("The surfaces provided should be from the body to be hollowed.\n");
+ return CUBIT_FAILURE;
+ }
+
+ double tol = 1.e-3; //hard coded for now, can be changed by application
+ TopoDS_Shape* solid = shape_list.get();
+ BRepOffsetAPI_MakeThickSolid hollower(*solid, face_shapes, depth, tol);
+ TopoDS_Shape new_shape = hollower.Shape();
+ TopoDS_Solid old_solid = TopoDS::Solid(*solid);
+ OCCLump::update_OCC_entity(old_solid , new_shape, &hollower);
+
+ //ok, we're done with all hollowing, construct new Body'
+ DLIList<TopologyBridge*> tbs;
+ tbs += OCCQueryEngine::instance()->populate_topology_bridge(new_shape);
+
+ for (int i = 0; i< tbs.size(); i++)
+ {
+ BodySM* bodysm = CAST_TO(tbs.get_and_step(), BodySM);
+ if (bodysm)
+ new_bodies.append(bodysm);
+ }
+
+ return CUBIT_SUCCESS;
}
Modified: cgm/trunk/geom/OCC/OCCQueryEngine.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCQueryEngine.cpp 2008-06-19 17:33:03 UTC (rev 1914)
+++ cgm/trunk/geom/OCC/OCCQueryEngine.cpp 2008-06-20 18:33:15 UTC (rev 1915)
@@ -2,7 +2,7 @@
// Filename : OCCQueryEngine.cpp
//
// Purpose : Implementation of the OCCQueryEngine class.
-// This class provides facet-based implementations
+// This class provides OCC-based implementations
// of various virtual functions in the GeometryQueryEngine
// hierarchy.
//
@@ -2310,8 +2310,6 @@
return status;
}
-const char* fqe_xform_err = "Transform not implemented for OCC geometry.\n";
-
CubitStatus OCCQueryEngine::restore_transform( BodySM* body )
{
return CUBIT_FAILURE;
1
0
Author: janehu
Date: 2008-06-19 12:33:03 -0500 (Thu, 19 Jun 2008)
New Revision: 1914
Modified:
cgm/trunk/geom/ACIS_SRC/AcisModifyEngine.cpp
cgm/trunk/geom/ACIS_SRC/AcisModifyEngine.hpp
cgm/trunk/geom/GeometryModifyEngine.hpp
cgm/trunk/geom/GeometryModifyTool.cpp
cgm/trunk/geom/GeometryModifyTool.hpp
cgm/trunk/geom/OCC/OCCModifyEngine.cpp
cgm/trunk/geom/OCC/OCCModifyEngine.hpp
cgm/trunk/geom/facet/FacetModifyEngine.cpp
cgm/trunk/geom/facet/FacetModifyEngine.hpp
Log:
OCC has a different method of making thick solids, namingly, by hollowing an existing solid. So added an argument on 'thicken' method as a virtual function for all engines.
Modified: cgm/trunk/geom/ACIS_SRC/AcisModifyEngine.cpp
===================================================================
--- cgm/trunk/geom/ACIS_SRC/AcisModifyEngine.cpp 2008-06-19 01:46:26 UTC (rev 1913)
+++ cgm/trunk/geom/ACIS_SRC/AcisModifyEngine.cpp 2008-06-19 17:33:03 UTC (rev 1914)
@@ -5941,6 +5941,7 @@
return CUBIT_FAILURE;
#else
CubitStatus AcisModifyEngine::thicken( DLIList<BodySM*>& bodies,
+ DLIList<Surface*>& surfs_to_remove,
DLIList<BodySM*>& new_body_list,
double depth,
bool both) const
Modified: cgm/trunk/geom/ACIS_SRC/AcisModifyEngine.hpp
===================================================================
--- cgm/trunk/geom/ACIS_SRC/AcisModifyEngine.hpp 2008-06-19 01:46:26 UTC (rev 1913)
+++ cgm/trunk/geom/ACIS_SRC/AcisModifyEngine.hpp 2008-06-19 17:33:03 UTC (rev 1914)
@@ -382,11 +382,13 @@
virtual CubitStatus thicken( DLIList<BodySM*>& bodies,
+ DLIList<Surface*>& surfs_to_remove,
DLIList<BodySM*>& new_bodies,
double depth,
bool both = false) const;
//- Thicken a sheet body into a solid
+ //- surfs_to_remove is a dummy input
//R CubitStatus
//R-the result of the thicken operation: Success or Failure
Modified: cgm/trunk/geom/GeometryModifyEngine.hpp
===================================================================
--- cgm/trunk/geom/GeometryModifyEngine.hpp 2008-06-19 01:46:26 UTC (rev 1913)
+++ cgm/trunk/geom/GeometryModifyEngine.hpp 2008-06-19 17:33:03 UTC (rev 1914)
@@ -412,6 +412,7 @@
virtual CubitStatus thicken( DLIList<BodySM*>& bodies,
+ DLIList<Surface*>& surfs_to_remove,
DLIList<BodySM*>& new_body_list,
double depth,
bool both = false) const = 0;
@@ -419,7 +420,9 @@
//R-the result of the thicken operation: Success or Failure
//I bodies
//I-DLIList<Body*>: a list of Body pointers that will be thicken
- //O intersectBody, outsideBody, leftoversBody
+ //I- or for OCC: a list of solid BodySM's that will be hollowed into a
+ //I- thick solid.
+ //I- surfs_to_remove: the faces to be removed from the original solid (OCC).
//O- new Bodies build by thicken operation on the list of Body pointers.
//- This function performs a thicken of sheet bodies and returns
//- the result through the output argument in_out_body. If the thicken
Modified: cgm/trunk/geom/GeometryModifyTool.cpp
===================================================================
--- cgm/trunk/geom/GeometryModifyTool.cpp 2008-06-19 01:46:26 UTC (rev 1913)
+++ cgm/trunk/geom/GeometryModifyTool.cpp 2008-06-19 17:33:03 UTC (rev 1914)
@@ -4155,10 +4155,12 @@
return CUBIT_SUCCESS;
}
-CubitStatus GeometryModifyTool::thicken( DLIList<Body*>& bodies,
- DLIList<Body*>& new_bodies,
- double depth,
- bool both )
+CubitStatus GeometryModifyTool::
+ make_thick_solid( DLIList<Body*>& bodies,
+ DLIList<RefFace*>& faces_to_remove,
+ DLIList<Body*>& new_bodies,
+ double depth,
+ bool both )
{
if (bodies.size() <= 0)
{
@@ -4186,10 +4188,24 @@
return CUBIT_FAILURE;
}
+ DLIList<Surface*> surfs_to_remove;
+ if(faces_to_remove.size() > 0)
+ {
+ GeometryModifyEngine* gme2 = common_modify_engine(faces_to_remove,
+ surfs_to_remove);
+ if(gme2 != gme)
+ {
+ PRINT_ERROR("Performing THICKEN with volumes containing geometry\n"
+ " from different modeling engines is not allowed.\n"
+ "Delete uncommon geometry on these volumes before operation.\n\n");
+ return CUBIT_FAILURE;
+ }
+ }
DLIList<BodySM*> new_sms(count);
DLIList<BodySM*> body_sms(count);
CAST_LIST(bridge_list, body_sms, BodySM);
- CubitStatus result = gme->thicken( body_sms, new_sms, depth, both);
+
+ CubitStatus result = gme->thicken( body_sms, surfs_to_remove, new_sms, depth, both);
// check for resued entities, they have been moved and we need to notify observers
DLIList<RefEntity*> entities_to_update;
Modified: cgm/trunk/geom/GeometryModifyTool.hpp
===================================================================
--- cgm/trunk/geom/GeometryModifyTool.hpp 2008-06-19 01:46:26 UTC (rev 1913)
+++ cgm/trunk/geom/GeometryModifyTool.hpp 2008-06-19 17:33:03 UTC (rev 1914)
@@ -225,7 +225,8 @@
bool keep_old = false,
bool nonreg = false );
- CubitStatus thicken( DLIList<Body*>& bodies,
+ CubitStatus make_thick_solid( DLIList<Body*>& bodies,
+ DLIList<RefFace*>& faces_to_remove,
DLIList<Body*>& new_bodies,
double depth,
bool both = false );
Modified: cgm/trunk/geom/OCC/OCCModifyEngine.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCModifyEngine.cpp 2008-06-19 01:46:26 UTC (rev 1913)
+++ cgm/trunk/geom/OCC/OCCModifyEngine.cpp 2008-06-19 17:33:03 UTC (rev 1914)
@@ -3550,43 +3550,9 @@
check_operation(new_shape, first_shape, first_is_volume, has_changed, &fuser);
check_operation(new_shape,second_shape, is_volume[i], has_changed, &fuser);
-/*
- BodySM* second_body = bodies.get_and_step();
- if(second_body)
- {
- deleted_body = CAST_TO(second_body, OCCBody);
- //delete the second body, keep lower entities.
- DLIList<Lump*> lumps = deleted_body->lumps();
- OCCQueryEngine::instance()->delete_solid_model_entities(lumps.get(),
- CUBIT_FALSE);
- second_body = NULL;
- }
-
- TopExp_Explorer Ex;
- TopTools_ListOfShape shapes;
- for (Ex.Init(*second_shape, TopAbs_FACE);Ex.More(); Ex.Next())
- {
- TopoDS_Face face = TopoDS::Face(Ex.Current());
- TopoDS_Shape nullshape;
- if(fuser.IsDeleted(face))
- OCCSurface::update_OCC_entity(face,nullshape, &fuser);
- else
- {
- shapes.Assign(fuser.Modified(face));
- if(shapes.Extent() > 1)
- {
- restore_first_shape = CUBIT_TRUE;
- PRINT_WARNING("The unite boolean didn't work in opencascade.\n");
- break;
- }
- else if(shapes.Extent() == 1)
- OCCSurface::update_OCC_entity(face, shapes.First(), &fuser);
- }
- }
-*/
}
- //ok, we're done wih all unites, construct new Body'
+ //ok, we're done with all unites, construct new Body'
DLIList<TopologyBridge*> tbs;
tbs += OCCQueryEngine::instance()->populate_topology_bridge(*first_shape);
@@ -3622,6 +3588,7 @@
// Date : 10/02
//===============================================================================
CubitStatus OCCModifyEngine::thicken(DLIList<BodySM*>& /*bodies*/,
+ DLIList<Surface*>& surfs_to_remove,
DLIList<BodySM*>& /*new_bodies*/,
double /*depth*/,
bool /*both*/) const
Modified: cgm/trunk/geom/OCC/OCCModifyEngine.hpp
===================================================================
--- cgm/trunk/geom/OCC/OCCModifyEngine.hpp 2008-06-19 01:46:26 UTC (rev 1913)
+++ cgm/trunk/geom/OCC/OCCModifyEngine.hpp 2008-06-19 17:33:03 UTC (rev 1914)
@@ -201,6 +201,7 @@
bool keep_old = CUBIT_FALSE) const;
virtual CubitStatus thicken(DLIList<BodySM*>& bodies,
+ DLIList<Surface*>& surfs_to_remove,
DLIList<BodySM*>& new_bodies,
double depth,
bool both = CUBIT_FALSE) const ;
Modified: cgm/trunk/geom/facet/FacetModifyEngine.cpp
===================================================================
--- cgm/trunk/geom/facet/FacetModifyEngine.cpp 2008-06-19 01:46:26 UTC (rev 1913)
+++ cgm/trunk/geom/facet/FacetModifyEngine.cpp 2008-06-19 17:33:03 UTC (rev 1914)
@@ -1745,6 +1745,7 @@
// Date : 10/02
//===============================================================================
CubitStatus FacetModifyEngine::thicken(DLIList<BodySM*>& /*bodies*/,
+ DLIList<Surface*> & /*surfs*/,
DLIList<BodySM*>& /*new_bodies*/,
double /*depth*/,
bool /*both*/) const
Modified: cgm/trunk/geom/facet/FacetModifyEngine.hpp
===================================================================
--- cgm/trunk/geom/facet/FacetModifyEngine.hpp 2008-06-19 01:46:26 UTC (rev 1913)
+++ cgm/trunk/geom/facet/FacetModifyEngine.hpp 2008-06-19 17:33:03 UTC (rev 1914)
@@ -216,6 +216,7 @@
bool keep_old = CUBIT_FALSE) const;
virtual CubitStatus thicken(DLIList<BodySM*>& bodies,
+ DLIList<Surface*>& surfs_to_remove,
DLIList<BodySM*>& new_bodies,
double depth,
bool both = CUBIT_FALSE) const ;
1
0
Author: janehu
Date: 2008-06-18 14:17:45 -0500 (Wed, 18 Jun 2008)
New Revision: 1911
Modified:
cgm/trunk/geom/OCC/OCCModifyEngine.cpp
cgm/trunk/geom/OCC/OCCQueryEngine.cpp
cgm/trunk/test/modify.cpp
Log:
Tested on unite operation, BRepAlgoAPI_Fuse seems to have problems with coplanar face fusion which left seam lines in between, looking into opencascade forum for solutions.
Modified: cgm/trunk/geom/OCC/OCCModifyEngine.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCModifyEngine.cpp 2008-06-18 01:02:48 UTC (rev 1910)
+++ cgm/trunk/geom/OCC/OCCModifyEngine.cpp 2008-06-18 19:17:45 UTC (rev 1911)
@@ -3392,7 +3392,9 @@
if(after_mass < tol) //no common section
cut_shape.Nullify();
has_changed = CUBIT_TRUE;
- TopoDS_Solid old_solid = TopoDS::Solid(op->Shape1());
+ TopExp_Explorer Ex;
+ Ex.Init(*from_shape, TopAbs_SOLID);
+ TopoDS_Solid old_solid = TopoDS::Solid(Ex.Current());
OCCLump::update_OCC_entity(old_solid , cut_shape, op);
}
else
@@ -3508,46 +3510,47 @@
if(!stat)
return stat;
- TopoDS_Shape* first_shape = shape_list.pop();
-
+ //find a non-sheet body to be the first shape
+ TopoDS_Shape* first_shape;
+ CubitBoolean first_is_volume;
+ if(first_is_volume = is_volume.move_to(CUBIT_TRUE))
+ {
+ int index = is_volume.get_index();
+ first_shape = shape_list[index];
+ shape_list.remove(first_shape);
+ is_volume.step(index);
+ is_volume.remove();
+ bodies.step(index);
+ bodies.remove();
+ }
+
+ else
+ {
+ first_shape = shape_list.pop();
+ bodies.pop();
+ }
+
int size = shape_list.size();
OCCBody* deleted_body = NULL;
CubitBoolean restore_first_shape = CUBIT_FALSE;
for(int i = 0; i < size; i++)
{
TopoDS_Shape* second_shape = shape_list.get_and_step();
-
+
BRepAlgoAPI_Fuse fuser(*first_shape, *second_shape);
- TopTools_ListOfShape shapes;
- shapes.Assign(fuser.Modified(*first_shape));
- if(shapes.Extent() != 1)
- {
- restore_first_shape = CUBIT_TRUE;
- PRINT_WARNING("The unite boolean didn't work in opencascade.\n");
- break;
- }
+ TopoDS_Shape new_shape = fuser.Shape();
+ //Debug:: check how many faces are there in new_shape.
+ TopExp_Explorer Ex;
+ int count = 0;
+ for (Ex.Init(new_shape, TopAbs_FACE);Ex.More(); Ex.Next())
+ count++;
+
CubitBoolean has_changed;
- if(is_volume[size] == CUBIT_TRUE || is_volume[i] == CUBIT_TRUE)
- {
- if(is_volume[size] == CUBIT_FALSE)
- {
- //exchange the first and second bodies.
- TopoDS_Shape* temp_shape = first_shape;
- first_shape = second_shape;
- second_shape = temp_shape;
- OCCBody temp_body1 = *CAST_TO(bodies[size], OCCBody);
- OCCBody temp_body2 = *CAST_TO(bodies.get(), OCCBody);
- BodySM* first_body = bodies.get();
- first_body = &temp_body1;
- BodySM* second_body = bodies[size];
- second_body = &temp_body2;
- }
- check_operation(shapes.First(), first_shape, CUBIT_TRUE, has_changed, &fuser);
- }
- else
- check_operation(shapes.First(), first_shape, CUBIT_FALSE,has_changed, &fuser);
+ check_operation(new_shape, first_shape, first_is_volume, has_changed, &fuser);
+ check_operation(new_shape,second_shape, is_volume[i], has_changed, &fuser);
+/*
BodySM* second_body = bodies.get_and_step();
if(second_body)
{
@@ -3558,7 +3561,9 @@
CUBIT_FALSE);
second_body = NULL;
}
+
TopExp_Explorer Ex;
+ TopTools_ListOfShape shapes;
for (Ex.Init(*second_shape, TopAbs_FACE);Ex.More(); Ex.Next())
{
TopoDS_Face face = TopoDS::Face(Ex.Current());
@@ -3574,9 +3579,11 @@
PRINT_WARNING("The unite boolean didn't work in opencascade.\n");
break;
}
- OCCSurface::update_OCC_entity(face, shapes.First(), &fuser);
+ else if(shapes.Extent() == 1)
+ OCCSurface::update_OCC_entity(face, shapes.First(), &fuser);
}
}
+*/
}
//ok, we're done wih all unites, construct new Body'
@@ -3590,9 +3597,10 @@
newBodies.append(bodysm);
}
- //ok, we're done wih all unites, delete unnecessaries.
+ //ok, we're done with all unites, delete unnecessaries.
if(keep_old)
{
+ shape_list.append(first_shape);
int size = shape_list.size();
for (int i = 0; i < size; i++)
{
Modified: cgm/trunk/geom/OCC/OCCQueryEngine.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCQueryEngine.cpp 2008-06-18 01:02:48 UTC (rev 1910)
+++ cgm/trunk/geom/OCC/OCCQueryEngine.cpp 2008-06-18 19:17:45 UTC (rev 1911)
@@ -1495,19 +1495,25 @@
if(lump != NULL)
{
BodySM* body = CAST_TO(lump, OCCLump)->get_body();
-
+ DLIList<Lump*> lumps = CAST_TO(body, OCCBody)->lumps();
+
if (remove_lower_entities)
return delete_solid_model_entities(body);
DLIList<TopologyBridge*> children;
+ for(int i = 0; i < lumps.size(); i++)
+ {
+ lump = lumps.get_and_step();
CAST_TO(lump, OCCLump)->get_children_virt(children);
+ }
CubitStatus stat = this->unhook_BodySM_from_OCC(body);
if(stat)
{
while (children.size())
delete children.pop();
- delete lump;
+ while(lumps.size())
+ delete lumps.pop();
delete body;
}
return stat;
Modified: cgm/trunk/test/modify.cpp
===================================================================
--- cgm/trunk/test/modify.cpp 2008-06-18 01:02:48 UTC (rev 1910)
+++ cgm/trunk/test/modify.cpp 2008-06-18 19:17:45 UTC (rev 1911)
@@ -607,5 +607,52 @@
free_entities.clean_out();
gti->get_free_ref_entities(free_entities);
+
+ //test unite 1
+ tool_body = gmti->brick(1,1,1);
+ gti->translate(tool_body,v_move7);
+ gti->translate(tool_body,v_move7);
+ from_body = gmti->brick(1,1,1);
+ from_bodies.append(from_body);
+ from_bodies.append(tool_body);
+ new_bodies.clean_out();
+ stat = gmti->unite(from_bodies, new_bodies, CUBIT_FALSE);
+ //Updated volume(s): 49
+ //Destroyed volume(s): 48
+ d = new_bodies.get()->measure(); //d = 2
+ n = new_bodies.get()->num_ref_faces(); //d = 10
+
+ bodies.clean_out();
+ gti->bodies(bodies); //bodies.size() = 1
+ free_entities.clean_out();
+ gti->get_free_ref_entities(free_entities); //free_entities.size() = 0
+ //delete all entities
+ gti->delete_Body(bodies);
+ free_entities.clean_out();
+ gti->get_free_ref_entities(free_entities); //free_entities.size() = 0
+
+ //test unite 2
+ tool_body = gmti->brick(4, 4,4);
+ gti->translate(tool_body,v_move7);
+ from_body = gmti->brick(1,1,1);
+ from_bodies.clean_out();
+ from_bodies.append(from_body);
+ from_bodies.append(tool_body);
+ new_bodies.clean_out();
+ stat = gmti->unite(from_bodies, new_bodies, CUBIT_FALSE);
+ //Updated volume(s): 51
+ //Destroyed volume(s): 50
+ d = new_bodies.get()->measure(); //d = 65
+ n = new_bodies.get()->num_ref_faces(); //d = 11
+
+ bodies.clean_out();
+ gti->bodies(bodies); //bodies.size() = 1
+ free_entities.clean_out();
+ gti->get_free_ref_entities(free_entities); //free_entities.size() = 0
+ //delete all entities
+ gti->delete_Body(bodies);
+ free_entities.clean_out();
+ gti->get_free_ref_entities(free_entities); //free_entities.size() = 0
+
return CUBIT_SUCCESS;
}
1
0
Author: janehu
Date: 2008-06-17 15:27:58 -0500 (Tue, 17 Jun 2008)
New Revision: 1906
Modified:
cgm/trunk/geom/OCC/OCCModifyEngine.cpp
cgm/trunk/test/modify.cpp
Log:
Tested chop operation and added Unite operation.
Modified: cgm/trunk/geom/OCC/OCCModifyEngine.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCModifyEngine.cpp 2008-06-17 19:18:45 UTC (rev 1905)
+++ cgm/trunk/geom/OCC/OCCModifyEngine.cpp 2008-06-17 20:27:58 UTC (rev 1906)
@@ -3292,7 +3292,7 @@
tool_bodies.append(tool_body_ptr);
//get tool_body's underlying shape, copy it, so boolean wouldn't touch it.
CubitStatus stat =
- get_shape_list(tool_bodies, tool_shapes, is_tool_volume, keep_old);
+ get_shape_list(tool_bodies, tool_shapes, is_tool_volume, CUBIT_TRUE);
if(!stat)
return stat;
@@ -3324,8 +3324,6 @@
if(from_shape->IsNull())
{
PRINT_INFO("The %d body did not have common part with the tool_body.\n", i+1);
- if (!keep_old)
- OCCQueryEngine::instance()->delete_solid_model_entities(from_body);
continue;
}
else
@@ -3342,6 +3340,13 @@
if(!keep_old)
OCCQueryEngine::instance()->delete_solid_model_entities(tool_body_ptr);
+ for(int i = 0; i < tool_shapes.size(); i++)
+ {
+ TopoDS_Shape* shape = tool_shapes.get_and_step();
+ shape->Nullify();
+ delete shape;
+ }
+
if(keep_old)
{
int size = shape_list.size();
@@ -3377,7 +3382,7 @@
double orig_mass = myProps.Mass();
BRepGProp::VolumeProperties(cut_shape, myProps);
double after_mass = myProps.Mass();
- if((-after_mass + orig_mass) <= tol)
+ if(fabs(-after_mass + orig_mass) <= tol)
{
has_changed= CUBIT_FALSE; //common is itself
return;
@@ -3397,7 +3402,7 @@
double orig_mass = myProps.Mass();
BRepGProp::SurfaceProperties(cut_shape, myProps);
double after_mass = myProps.Mass();
- if((-after_mass + orig_mass) <= tol)
+ if(fabs(-after_mass + orig_mass) <= tol)
{
has_changed= CUBIT_FALSE; //common is itself, or not cut
return;
@@ -3451,10 +3456,9 @@
//outsideBodies keeps the surface, curve ids if keep_old is false.
BodySM* blank_body = bodies.get();
- BodySM* blank_copy = copy_body(blank_body);
DLIList<BodySM*> tool_bodies, from_bodies;
- from_bodies.append(blank_copy);
+ from_bodies.append(blank_body);
BodySM* tool_body = bodies.step_and_get();
tool_bodies.append(tool_body);
@@ -3464,28 +3468,141 @@
if(!stat)
return CUBIT_FAILURE;
- from_bodies.clean_out();
- from_bodies.append(blank_body);
stat = subtract(tool_bodies, from_bodies, outsideBodies,
CUBIT_FALSE, keep_old);
- OCCQueryEngine::instance()->delete_solid_model_entities(blank_copy);
return stat;
}
//===============================================================================
// Function : unite
// Member Type: PUBLIC
-// Description: unite boolean operation between facet-based bodies
-// Author : John Fowler
-// Date : 10/02
+// Description: unite boolean operation between OCC-based bodies
+// Author : Jane Hu
+// Date : 06/08
//===============================================================================
CubitStatus OCCModifyEngine::unite(DLIList<BodySM*> &bodies,
- DLIList<BodySM*> &newBodies,
- bool keep_old) const
+ DLIList<BodySM*> &newBodies,
+ bool keep_old) const
{
- PRINT_ERROR("Option not supported for mesh based geometry.\n");
- return CUBIT_FAILURE;
+ if(bodies.size() < 2)
+ return CUBIT_SUCCESS;
+
+ //all bodies must have only one lump in order for boolean operation to work.
+ DLIList<Lump*> lumps;
+ for (int i = 0; i < bodies.size(); i++)
+ {
+ lumps = CAST_TO(bodies.get_and_step(), OCCBody)->lumps();
+ if (lumps.size() > 1)
+ {
+ PRINT_WARNING("All bodies must have only one lump for boolean operations to work.\n");
+ return CUBIT_FAILURE;
+ }
+ }
+
+ DLIList<TopoDS_Shape*> shape_list;
+ DLIList<CubitBoolean> is_volume;
+ CubitStatus stat =
+ get_shape_list(bodies, shape_list, is_volume, keep_old);
+
+ if(!stat)
+ return stat;
+
+ TopoDS_Shape* first_shape = shape_list.pop();
+
+ int size = shape_list.size();
+ OCCBody* deleted_body = NULL;
+ CubitBoolean restore_first_shape = CUBIT_FALSE;
+ for(int i = 0; i < size; i++)
+ {
+ TopoDS_Shape* second_shape = shape_list.get_and_step();
+
+ BRepAlgoAPI_Fuse fuser(*first_shape, *second_shape);
+ TopTools_ListOfShape shapes;
+ shapes.Assign(fuser.Modified(*first_shape));
+ if(shapes.Extent() != 1)
+ {
+ restore_first_shape = CUBIT_TRUE;
+ PRINT_WARNING("The unite boolean didn't work in opencascade.\n");
+ break;
+ }
+
+ CubitBoolean has_changed;
+ if(is_volume[size] == CUBIT_TRUE || is_volume[i] == CUBIT_TRUE)
+ {
+ if(is_volume[size] == CUBIT_FALSE)
+ {
+ //exchange the first and second bodies.
+ TopoDS_Shape* temp_shape = first_shape;
+ first_shape = second_shape;
+ second_shape = temp_shape;
+ OCCBody temp_body1 = *CAST_TO(bodies[size], OCCBody);
+ OCCBody temp_body2 = *CAST_TO(bodies.get(), OCCBody);
+ BodySM* first_body = bodies.get();
+ first_body = &temp_body1;
+ BodySM* second_body = bodies[size];
+ second_body = &temp_body2;
+ }
+ check_operation(shapes.First(), first_shape, CUBIT_TRUE, has_changed, &fuser);
+ }
+ else
+ check_operation(shapes.First(), first_shape, CUBIT_FALSE,has_changed, &fuser);
+
+ BodySM* second_body = bodies.get_and_step();
+ if(second_body)
+ {
+ deleted_body = CAST_TO(second_body, OCCBody);
+ //delete the second body, keep lower entities.
+ DLIList<Lump*> lumps = deleted_body->lumps();
+ OCCQueryEngine::instance()->delete_solid_model_entities(lumps.get(),
+ CUBIT_FALSE);
+ second_body = NULL;
+ }
+ TopExp_Explorer Ex;
+ for (Ex.Init(*second_shape, TopAbs_FACE);Ex.More(); Ex.Next())
+ {
+ TopoDS_Face face = TopoDS::Face(Ex.Current());
+ TopoDS_Shape nullshape;
+ if(fuser.IsDeleted(face))
+ OCCSurface::update_OCC_entity(face,nullshape, &fuser);
+ else
+ {
+ shapes.Assign(fuser.Modified(face));
+ if(shapes.Extent() > 1)
+ {
+ restore_first_shape = CUBIT_TRUE;
+ PRINT_WARNING("The unite boolean didn't work in opencascade.\n");
+ break;
+ }
+ OCCSurface::update_OCC_entity(face, shapes.First(), &fuser);
+ }
+ }
+ }
+
+ //ok, we're done wih all unites, construct new Body'
+ DLIList<TopologyBridge*> tbs;
+ tbs += OCCQueryEngine::instance()->populate_topology_bridge(*first_shape);
+
+ for (int i = 0; i< tbs.size(); i++)
+ {
+ BodySM* bodysm = CAST_TO(tbs.get_and_step(), BodySM);
+ if (bodysm)
+ newBodies.append(bodysm);
+ }
+
+ //ok, we're done wih all unites, delete unnecessaries.
+ if(keep_old)
+ {
+ int size = shape_list.size();
+ for (int i = 0; i < size; i++)
+ {
+ TopoDS_Shape* shape = shape_list.pop();
+ shape->Nullify();
+ delete shape;
+ }
+ }
+
+ return CUBIT_SUCCESS;
}
Modified: cgm/trunk/test/modify.cpp
===================================================================
--- cgm/trunk/test/modify.cpp 2008-06-17 19:18:45 UTC (rev 1905)
+++ cgm/trunk/test/modify.cpp 2008-06-17 20:27:58 UTC (rev 1906)
@@ -167,6 +167,8 @@
BodySM* stitched_body = NULL;
DLIList<Body*> new_bodies;
gmti->create_solid_bodies_from_surfs(face_list, new_bodies);
+ //Created volume(s): 8
+ //Destroyed volume(s): 2 to 7
CubitStatus rsl = CUBIT_SUCCESS;
DLIList<RefEntity*> ref_entity_list;
@@ -194,6 +196,7 @@
char *argv = "stitch.occ";
CubitStatus status = read_geometry(1, &argv, true);
if (status == CUBIT_FAILURE) exit(1);
+ //Read in 1 volume.
bodies.clean_out();
free_entities.clean_out();
@@ -260,12 +263,17 @@
new_bodies.clean_out();
rsl = gmti->subtract(from_body2, from_bodies, new_bodies,
CUBIT_TRUE, CUBIT_FALSE);
+ //Updated volume(s): 18
+ //Destroyed volume(s): 19
//new bodies has one body, new body has 10 ref-faces, 5 of them are remaining
//with old id, 5 of them are new faces.
+
from_bodies=new_bodies;
new_bodies.clean_out();
rsl = gmti->subtract(tool_body,from_bodies, new_bodies,
CUBIT_TRUE, CUBIT_FALSE);
+ //Created volume(s): 21, 22
+ //Destroyed volume(s): 18, 20
d = new_bodies.step_and_get()->measure();
v = new_bodies.get()->center_point();
int n = new_bodies.get()->num_ref_faces();
@@ -297,6 +305,7 @@
from_bodies.append(cp_from_body);
new_bodies.clean_out();
CubitStatus stat = gmti->imprint(from_bodies, ref_edges, new_bodies, CUBIT_FALSE, CUBIT_TRUE );
+ //Updated volume(s): 25
//test edge imprint on surface
CubitVector vv(5,1,4.0);
@@ -315,6 +324,7 @@
assert(face_list.size() == 1);
ref_edges.step_and_get()->ref_vertices(vertices);
stat = gmti->imprint(unimprint_faces, ref_edges, new_bodies, CUBIT_FALSE);
+ //Updated volume(s): 26
new_bodies.clean_out();
face_list.clean_out();
@@ -340,18 +350,24 @@
from_bodies.append(cp_from_body2);
new_bodies.clean_out();
stat = gmti->imprint(from_bodies, vectors, new_bodies, CUBIT_FALSE);
+ //Updated volume(s): 26
n = new_bodies.get()->num_ref_edges();//n = 17
new_bodies.clean_out();
stat = gmti->imprint(face_list, ref_edges, new_bodies, CUBIT_FALSE);
+ //Updated volume(s): 26
+ n = new_bodies.get()->num_ref_edges();//n = 21
+
//test for multi-cut imprint for subtract.
from_bodies.clean_out();
from_bodies.append(from_body);
new_bodies.clean_out();
rsl = gmti->subtract(tool_body, from_bodies, new_bodies,
CUBIT_TRUE, CUBIT_FALSE);
+ //Updated volume(s): 23
+
n = new_bodies.get()->num_ref_faces();
//n = 8
n = new_bodies.get()->num_ref_edges();
@@ -411,6 +427,7 @@
from_bodies.append(copy_tool_body);
from_bodies.append(from_body2);
stat = gmti->imprint(from_bodies, new_bodies, CUBIT_FALSE);
+ //Updated volume(s): 30 one body gets cut once with 7 faces, the other is not
//test body imprinted by curves.
ref_edges.clean_out();
@@ -419,6 +436,7 @@
new_bodies.clean_out();
from_bodies.append(copy_tool_body2);
stat = gmti->imprint(from_bodies, ref_edges, new_bodies, CUBIT_FALSE, CUBIT_TRUE );
+ //Updated volume(s): 31, no cuts performed
//test body cutting a shell, one surface got cut as the result.
CubitVector v_move6(1,-1,0);
@@ -428,6 +446,8 @@
new_bodies.clean_out();
rsl = gmti->subtract(tool_body, from_bodies, new_bodies,
CUBIT_TRUE, CUBIT_TRUE);
+ //Created volume(s): 32
+
d = new_bodies.step_and_get()->measure();
v = new_bodies.get()->center_point();
n = new_bodies.get()->num_ref_faces();
@@ -439,6 +459,8 @@
//test a shell cutting a body, failed operation with an Error message.
rsl = gmti->subtract(from_body2, from_bodies, new_bodies,
CUBIT_TRUE, CUBIT_TRUE);
+ //WARNING: Surfaces or Shells can't be used to cut a body.
+ //ERROR: Subtract FAILED
//test solid solid imprint
tool_body = gmti->brick(4, 4, 4);
@@ -450,6 +472,9 @@
from_bodies.append(from_body);
from_bodies.append(tool_body);
stat = gmti->imprint(from_bodies, new_bodies, CUBIT_FALSE);
+ //Updated volume(s): 33, 34
+ //one body gets 4 cuts, the other 3.
+ //one body gets 10 faces, the other 9.
//test imprint projected edges
bodies.clean_out();
@@ -474,8 +499,113 @@
new_bodies.clean_out();
gmti->imprint_projected_edges(ref_faces,ref_edges, new_bodies, CUBIT_TRUE,
CUBIT_FALSE);
+ //Created volume(s): 37
if(new_bodies.size())
- n = new_bodies.get()->num_ref_faces();
+ n = new_bodies.get()->num_ref_faces();//n = 8, new_bodies.size() == 1
+
+ //delete all bodies.
+ bodies.clean_out();
+ gti->bodies(bodies);
+ //delete all entities
+ gti->delete_Body(bodies);
+
+ free_entities.clean_out();
+ gti->get_free_ref_entities(free_entities);
+
+ //test body-body intersect.
+ //1. from body is the commom body, no update
+ tool_body = gmti->brick(4, 4, 4);
+ from_body = gmti->brick(1,1,1);
+ from_bodies.clean_out();
+ new_bodies.clean_out();
+ from_bodies.append(from_body);
+ stat = gmti->intersect(tool_body, from_bodies, new_bodies, CUBIT_FALSE);
+ //Updated volume(s): 39
+ //Destroyed volume(s): 38
+ d = new_bodies.get()->measure(); //d = 1
+
+ //2. common body is part of from body, update the correponding face
+ tool_body = gmti->brick(4, 4, 4);
+ CubitVector v_move7(0,0.5,0);
+ gti->translate(tool_body,v_move7);
+ from_bodies.clean_out();
+ from_bodies.append(from_body);
+ new_bodies.clean_out();
+ stat = gmti->intersect(tool_body, from_bodies, new_bodies, CUBIT_FALSE);
+ d = new_bodies.get()->measure(); //d = 0.5
+ //Updated volume(s): 39
+ //Destroyed volume(s): 40
+
+ //3. there's no common body, from body is deleted or kept depending on
+ //keep-old flag.
+ tool_body = gmti->brick(4, 4, 4);
+ gti->translate(tool_body,v_move7);
+ gti->translate(tool_body,v_move7);
+ from_bodies.clean_out();
+ new_bodies.clean_out();
+ from_bodies.append(from_body);
+ //nothing changed
+ stat = gmti->intersect(tool_body, from_bodies, new_bodies, CUBIT_TRUE);
+ //"The 1 body did not have common part with the tool_body."
+
+ //from_body get deleted
+ stat = gmti->intersect(tool_body, from_bodies, new_bodies, CUBIT_FALSE);
+ //"The 1 body did not have common part with the tool_body."
+ //Destroyed volume(s): 39, 41
+
+ bodies.clean_out();
+ gti->bodies(bodies);
+ //delete all entities
+ gti->delete_Body(bodies);
+
+ free_entities.clean_out();
+ gti->get_free_ref_entities(free_entities);
+
+ //test chop operation
+ tool_body = gmti->brick(4, 4, 4);
+ from_body = gmti->brick(1,1,1);
+ gti->translate(tool_body,v_move7);
+ from_bodies.clean_out();
+ from_bodies.append(from_body);
+ from_bodies.append(tool_body);
+ new_bodies.clean_out();
+
+ //new_bodies = intersect bodies;bodies = outside bodies; body is dummy
+ stat = gmti->chop(from_bodies, new_bodies, bodies, body, CUBIT_FALSE);
+ d = new_bodies.get()->measure(); //d = 0.5
+ //Created volume(s): 44
+ //Destroyed volume(s): 42
+ //Updated volume(s): 43
+
+ bodies.clean_out();
+ gti->bodies(bodies);
+ //delete all entities
+ gti->delete_Body(bodies);
+
+ free_entities.clean_out();
+ gti->get_free_ref_entities(free_entities);
+
+ //test chop 2
+ from_body = gmti->brick(4, 4, 4);
+ tool_body = gmti->brick(1,1,1);
+ gti->translate(tool_body,v_move7);
+ from_bodies.clean_out();
+ from_bodies.append(from_body);
+ from_bodies.append(tool_body);
+ new_bodies.clean_out();
+ bodies.clean_out();
+ stat = gmti->chop(from_bodies, new_bodies, bodies, body, CUBIT_FALSE);
+ //Created volume(s): 47
+ //Destroyed volume(s): 46
+ //Updated volume(s): 45
+ d = bodies.get()->measure();//d = 63
+
+ bodies.clean_out();
+ gti->bodies(bodies);
+ //delete all entities
+ gti->delete_Body(bodies);
+
+ free_entities.clean_out();
+ gti->get_free_ref_entities(free_entities);
return CUBIT_SUCCESS;
-
}
1
0
Author: janehu
Date: 2008-06-16 14:31:25 -0500 (Mon, 16 Jun 2008)
New Revision: 1900
Modified:
cgm/trunk/geom/OCC/OCCModifyEngine.cpp
Log:
Added boolean chop which is subtract+intersect.
Modified: cgm/trunk/geom/OCC/OCCModifyEngine.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCModifyEngine.cpp 2008-06-16 16:27:02 UTC (rev 1899)
+++ cgm/trunk/geom/OCC/OCCModifyEngine.cpp 2008-06-16 19:31:25 UTC (rev 1900)
@@ -1677,15 +1677,7 @@
get_shape_list(tool_body_list, tool_bodies_copy, is_tool_volume, CUBIT_TRUE, tool_boxes);
if(!stat)
- {
- PRINT_WARNING("Surfaces or Shells can't be used to cut a body.\n");
- while (tool_boxes->size())
- delete tool_boxes->pop();
- delete tool_boxes;
- while (tool_bodies_copy.size())
- delete tool_bodies_copy.pop();
- return CUBIT_FAILURE;
- }
+ return stat;
//check that tool_bodies are all solid, shell and surface body can't be used
//for subtracting purpose.
@@ -1701,7 +1693,17 @@
}
//get the from_bodies underling shapes
- get_shape_list(from_bodies, from_bodies_copy, is_volume, keep_old);
+ stat = get_shape_list(from_bodies, from_bodies_copy, is_volume, keep_old);
+ if(!stat)
+ {
+ for (int i = 0; i < tool_bodies_copy.size(); i++)
+ {
+ TopoDS_Shape* shape = tool_bodies_copy.get_and_step();
+ delete shape;
+ }
+ tool_bodies_copy.clean_out();
+ return CUBIT_FAILURE;
+ }
double tol = OCCQueryEngine::instance()->get_sme_resabs_tolerance();
int fraction_remaining = 100;
@@ -1808,6 +1810,8 @@
delete shape;
}
}
+ if(!keep_old) //delete tool_bodies
+ OCCQueryEngine::instance()->delete_solid_model_entities(tool_body_list);
return CUBIT_SUCCESS;
}
@@ -2517,6 +2521,8 @@
{
OCCBody* occ_body = NULL;
shape_list.clean_out();
+ is_volume.clean_out();
+ CubitStatus stat = CUBIT_SUCCESS;
for(int i = 0; i <BodySM_list.size(); i++)
{
occ_body = CAST_TO(BodySM_list.get_and_step(), OCCBody);
@@ -2536,6 +2542,11 @@
if(surface)
{
TopoDS_Face* topo_face = surface->get_TopoDS_Face();
+ if(!topo_face)
+ {
+ stat = CUBIT_FAILURE;
+ break;
+ }
if(keep_old)
{
BRepBuilderAPI_Copy api_copy(*topo_face);
@@ -2550,6 +2561,11 @@
else if(shell)
{
TopoDS_Shell* topo_shell = shell->get_TopoDS_Shell();
+ if(!topo_shell)
+ {
+ stat = CUBIT_FAILURE;
+ break;
+ }
if(keep_old)
{
BRepBuilderAPI_Copy api_copy(*topo_shell);
@@ -2568,10 +2584,16 @@
if (lumps.size() > 1)
{
PRINT_ERROR("Can't do boolean operation on CompSolid types. \n");
- return CUBIT_FAILURE;
+ stat = CUBIT_FAILURE;
+ break;
}
TopoDS_Solid* solid = CAST_TO(lumps.get(), OCCLump)->get_TopoDS_Solid();
+ if(!solid)
+ {
+ stat = CUBIT_FAILURE;
+ break;
+ }
if(keep_old)
{
BRepBuilderAPI_Copy api_copy(*solid);
@@ -2583,6 +2605,16 @@
shape_list.append(solid);
}
}
+ if(!stat)
+ {
+ for (int i = 0; keep_old && i < shape_list.size(); i++)
+ {
+ TopoDS_Shape* shape = shape_list.get_and_step();
+ delete shape;
+ }
+ shape_list.clean_out();
+ return CUBIT_FAILURE;
+ }
return CUBIT_SUCCESS;
}
//===============================================================================
@@ -2994,7 +3026,6 @@
DLIList<TopoDS_Shape*> shape_list;
DLIList<CubitBoolean> is_vo;
CubitStatus stat = get_shape_list(body_list, shape_list, is_vo, keep_old);
-
if(!stat)
return stat;
@@ -3260,10 +3291,23 @@
tool_bodies.append(tool_body_ptr);
//get tool_body's underlying shape, copy it, so boolean wouldn't touch it.
- get_shape_list(tool_bodies, tool_shapes, is_tool_volume, CUBIT_TRUE);
+ CubitStatus stat =
+ get_shape_list(tool_bodies, tool_shapes, is_tool_volume, keep_old);
+ if(!stat)
+ return stat;
DLIList<TopoDS_Shape*> shape_list;
- get_shape_list(from_bodies, shape_list, is_volume, keep_old);
+ stat = get_shape_list(from_bodies, shape_list, is_volume, keep_old);
+ if(!stat)
+ {
+ for (int i = 0; i < tool_shapes.size(); i++)
+ {
+ TopoDS_Shape* shape = tool_shapes.get_and_step();
+ delete shape;
+ }
+ tool_shapes.clean_out();
+ return CUBIT_FAILURE;
+ }
TopoDS_Shape* tool_shape = tool_shapes.get();
CubitBoolean has_changed;
@@ -3271,6 +3315,7 @@
for (int i = 0; i < shape_list.size(); i++)
{
TopoDS_Shape* from_shape = shape_list.get_and_step();
+ BodySM* from_body = from_bodies.get_and_step();
BRepAlgoAPI_Common intersector(*from_shape, *tool_shape);
TopoDS_Shape common_shape = intersector.Shape();
check_operation(common_shape, from_shape, is_volume[i], has_changed,
@@ -3278,7 +3323,9 @@
if(from_shape->IsNull())
{
- PRINT_INFO("The %d body did not change because cutting tools are not interscting with it.\n", i+1);
+ PRINT_INFO("The %d body did not have common part with the tool_body.\n", i+1);
+ if (!keep_old)
+ OCCQueryEngine::instance()->delete_solid_model_entities(from_body);
continue;
}
else
@@ -3292,8 +3339,9 @@
}
//ok, we're done wih all cuts, delete unnecessaries.
- while (tool_shapes.size())
- tool_shapes.pop();
+ if(!keep_old)
+ OCCQueryEngine::instance()->delete_solid_model_entities(tool_body_ptr);
+
if(keep_old)
{
int size = shape_list.size();
@@ -3334,19 +3382,13 @@
has_changed= CUBIT_FALSE; //common is itself
return;
}
+
//got cut. Update the entities
- if(after_mass > tol)
- {
- has_changed = CUBIT_TRUE;
- TopoDS_Solid old_solid = TopoDS::Solid(op->Shape1());
- OCCLump::update_OCC_entity(old_solid , cut_shape, op);
- }
- else //no common section
- {
- from_shape->Nullify();
- has_changed = CUBIT_FALSE;
- return;
- }
+ if(after_mass < tol) //no common section
+ cut_shape.Nullify();
+ has_changed = CUBIT_TRUE;
+ TopoDS_Solid old_solid = TopoDS::Solid(op->Shape1());
+ OCCLump::update_OCC_entity(old_solid , cut_shape, op);
}
else
{
@@ -3361,46 +3403,74 @@
return;
}
//got cut. Update the entities
- if(after_mass > tol)
+ if(after_mass < tol)//no common section
+ cut_shape.Nullify();
+ has_changed = CUBIT_TRUE;
+ if(from_shape->TShape()->ShapeType() == TopAbs_SHELL)
{
- has_changed = CUBIT_TRUE;
- if(from_shape->TShape()->ShapeType() == TopAbs_SHELL)
- {
- TopoDS_Shell old_shell = TopoDS::Shell(*from_shape);
- OCCShell::update_OCC_entity(old_shell,cut_shape, op);
- }
- else
- {
- TopoDS_Face old_face = TopoDS::Face(*from_shape);
- OCCSurface::update_OCC_entity(old_face,cut_shape, op);
- }
+ TopoDS_Shell old_shell = TopoDS::Shell(*from_shape);
+ OCCShell::update_OCC_entity(old_shell,cut_shape, op);
}
- else //no common section
+ else
{
- from_shape->Nullify();
- has_changed = CUBIT_FALSE;
- return;
+ TopoDS_Face old_face = TopoDS::Face(*from_shape);
+ OCCSurface::update_OCC_entity(old_face,cut_shape, op);
}
}
delete from_shape;
from_shape = new TopoDS_Shape(cut_shape);
}
+
//===============================================================================
// Function : chop
// Member Type: PUBLIC
-// Description: chop boolean operation between facet-based bodies
-// Author : John Fowler
-// Date : 10/02
+// Description: chop boolean operation between OCC-based bodies
+// bodies has a size() = 2, a blank body and a tool body.
+// chops the blank with the tool, returing the body formed
+// by subtracting the tool from the blank, and the body formed
+// by intersecting the tool with the blank, simultaneously.
+// Author : Jane Hu
+// Date : 06/08
//===============================================================================
-CubitStatus OCCModifyEngine::chop(DLIList<BodySM*>& bodies,
- DLIList<BodySM*> &intersectBodies,
- DLIList<BodySM*> &outsideBodies,
- BodySM*& leftoversBody,
- bool keep_old ,
- bool nonreg) const
+CubitStatus OCCModifyEngine::chop(DLIList<BodySM*>& bodies,
+ DLIList<BodySM*> &intersectBodies,
+ DLIList<BodySM*> &outsideBodies,
+ BodySM*& leftoversBody,
+ bool keep_old ,
+ bool nonreg) const
{
- PRINT_ERROR("Option not supported for mesh based geometry.\n");
- return CUBIT_FAILURE;
+ //according to Acis chop function, leftoverBody = 0;
+ leftoversBody = 0;
+
+ //there's no effect of nonreg. keep_old mean if to keep the tool_body
+ if(bodies.size() < 2)
+ {
+ PRINT_WARNING("There is only one volume in the list. Nothing modified\n");
+ return CUBIT_FAILURE;
+ }
+
+ //outsideBodies keeps the surface, curve ids if keep_old is false.
+ BodySM* blank_body = bodies.get();
+ BodySM* blank_copy = copy_body(blank_body);
+
+ DLIList<BodySM*> tool_bodies, from_bodies;
+ from_bodies.append(blank_copy);
+ BodySM* tool_body = bodies.step_and_get();
+ tool_bodies.append(tool_body);
+
+ CubitStatus stat = intersect(tool_body, from_bodies,
+ intersectBodies, CUBIT_TRUE);
+
+ if(!stat)
+ return CUBIT_FAILURE;
+
+ from_bodies.clean_out();
+ from_bodies.append(blank_body);
+ stat = subtract(tool_bodies, from_bodies, outsideBodies,
+ CUBIT_FALSE, keep_old);
+
+ OCCQueryEngine::instance()->delete_solid_model_entities(blank_copy);
+ return stat;
}
//===============================================================================
1
0
Author: janehu
Date: 2008-06-13 14:16:47 -0500 (Fri, 13 Jun 2008)
New Revision: 1896
Modified:
cgm/trunk/geom/OCC/OCCModifyEngine.cpp
cgm/trunk/geom/OCC/OCCModifyEngine.hpp
Log:
implemented boolean intersect operation.
Modified: cgm/trunk/geom/OCC/OCCModifyEngine.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCModifyEngine.cpp 2008-06-13 17:43:16 UTC (rev 1895)
+++ cgm/trunk/geom/OCC/OCCModifyEngine.cpp 2008-06-13 19:16:47 UTC (rev 1896)
@@ -1667,96 +1667,42 @@
DLIList<TopoDS_Shape*> tool_bodies_copy;
DLIList<TopoDS_Shape*> from_bodies_copy;
DLIList<CubitBoolean> is_volume;
- for (int i = 0; i < from_bodies.size(); i++)
- {
- BodySM* body = from_bodies.get_and_step();
- OCCBody* occ_body = CAST_TO(body, OCCBody);
- OCCSurface* surface = occ_body->my_sheet_surface();
- OCCShell* shell = occ_body->shell();
- is_volume.append( CUBIT_TRUE);
- if(surface)
- {
- TopoDS_Face* topo_face = surface->get_TopoDS_Face();
- if(keep_old)
- {
- BRepBuilderAPI_Copy api_copy(*topo_face);
- TopoDS_Shape newShape = api_copy.ModifiedShape(*topo_face);
- TopoDS_Shape* newShape_ptr = new TopoDS_Shape(newShape);
- from_bodies_copy.append(newShape_ptr);
- }
- else
- from_bodies_copy.append(topo_face);
- is_volume.change_to( CUBIT_FALSE);
- }
- else if(shell)
- {
- TopoDS_Shell* topo_shell = shell->get_TopoDS_Shell();
- if(keep_old)
- {
- BRepBuilderAPI_Copy api_copy(*topo_shell);
- TopoDS_Shape newShape = api_copy.ModifiedShape(*topo_shell);
- TopoDS_Shape* newShape_ptr = new TopoDS_Shape(newShape);
- from_bodies_copy.append(newShape_ptr);
- }
- else
- from_bodies_copy.append(topo_shell);
- is_volume.change_to( CUBIT_FALSE);
- }
- else
- {
- DLIList<Lump*> lumps = occ_body->lumps();
- if (lumps.size() > 1)
- {
- PRINT_ERROR("Can't do boolean operation on CompSolid types. \n");
- return CUBIT_FAILURE;
- }
-
- TopoDS_Solid* solid = CAST_TO(lumps.get(), OCCLump)->get_TopoDS_Solid();
- if(keep_old)
- {
- BRepBuilderAPI_Copy api_copy(*solid);
- TopoDS_Shape newShape = api_copy.ModifiedShape(*solid);
- TopoDS_Shape* newShape_ptr = new TopoDS_Shape(newShape);
- from_bodies_copy.append(newShape_ptr);
- }
- else
- from_bodies_copy.append(solid);
- }
- }
//for subtract function, tool-body has to be solid,
//otherwise it's just imprint
- DLIList<CubitBox*> tool_boxes;
- for (int i = 0; i < tool_body_list.size(); i++)
+ DLIList<CubitBox*>* tool_boxes = new DLIList<CubitBox*>();
+ DLIList<CubitBoolean> is_tool_volume;
+ //keep the tool_body untouched
+ CubitStatus stat =
+ get_shape_list(tool_body_list, tool_bodies_copy, is_tool_volume, CUBIT_TRUE, tool_boxes);
+
+ if(!stat)
{
- BodySM* body = tool_body_list.get_and_step();
- OCCBody* occ_body = CAST_TO(body, OCCBody);
- OCCSurface* surface = occ_body->my_sheet_surface();
- OCCShell* shell = occ_body->shell();
- if(surface || shell)
- {
- PRINT_WARNING("Surfaces or Shells can't be used to cut a body.\n");
- return CUBIT_FAILURE;
- }
- else
- {
- DLIList<Lump*> lumps = occ_body->lumps();
- if (lumps.size() > 1)
- {
- PRINT_ERROR("Can't do boolean operation on CompSolid types. \n");
- return CUBIT_FAILURE;
- }
+ PRINT_WARNING("Surfaces or Shells can't be used to cut a body.\n");
+ while (tool_boxes->size())
+ delete tool_boxes->pop();
+ delete tool_boxes;
+ while (tool_bodies_copy.size())
+ delete tool_bodies_copy.pop();
+ return CUBIT_FAILURE;
+ }
- TopoDS_Solid* solid = CAST_TO(lumps.get(), OCCLump)->get_TopoDS_Solid();
- BRepBuilderAPI_Copy api_copy(*solid);
- TopoDS_Shape newShape = api_copy.ModifiedShape(*solid);
- TopoDS_Shape* newShape_ptr = new TopoDS_Shape(newShape);
- tool_bodies_copy.append(newShape_ptr);
- }
- CubitBox *tool_box = new CubitBox(occ_body->get_bounding_box());
- tool_boxes.append(tool_box);
+ //check that tool_bodies are all solid, shell and surface body can't be used
+ //for subtracting purpose.
+ if(is_tool_volume.is_in_list(CUBIT_FALSE))
+ {
+ PRINT_WARNING("Surfaces or Shells can't be used to cut a body.\n");
+ while (tool_boxes->size())
+ delete tool_boxes->pop();
+ delete tool_boxes;
+ while (tool_bodies_copy.size())
+ delete tool_bodies_copy.pop();
+ return CUBIT_FAILURE;
}
+ //get the from_bodies underling shapes
+ get_shape_list(from_bodies, from_bodies_copy, is_volume, keep_old);
+
double tol = OCCQueryEngine::instance()->get_sme_resabs_tolerance();
int fraction_remaining = 100;
@@ -1775,15 +1721,16 @@
if (cmi->Interrupt())
{
PRINT_ERROR("Subtraction interrupted. Aborting...\n");
- while (tool_boxes.size())
- delete tool_boxes.pop();
+ while (tool_boxes->size())
+ delete tool_boxes->pop();
+ delete tool_boxes;
while (tool_bodies_copy.size())
delete tool_bodies_copy.pop();
while (from_bodies_copy.size())
delete from_bodies_copy.pop();
return CUBIT_FAILURE;
}
- CubitBox tool_box = *tool_boxes.get_and_step();
+ CubitBox tool_box = *tool_boxes->get_and_step();
if(!tool_box.overlap(tol,box1))
{
count++;
@@ -1796,71 +1743,23 @@
TopoDS_Shape cut_shape = cutter.Shape();
//compare to see if the from_shape has gotten cut.
+ CubitBoolean has_changed;
+ check_operation(cut_shape, from_shape, is_volume[i], has_changed, &cutter);
+
CubitStatus stat;
- if(is_volume[i])
+ if(!has_changed && !from_shape->IsNull())
{
- GProp_GProps myProps;
- BRepGProp::VolumeProperties(*from_shape, myProps);
- double orig_mass = myProps.Mass();
- BRepGProp::VolumeProperties(cut_shape, myProps);
- double after_mass = myProps.Mass();
- if((-after_mass + orig_mass) <= tol)
+ stat = CUBIT_FAILURE;
+ //Add imprint code here
+ if(imprint)
+ stat = imprint_toposhapes(from_shape, tool_shape);
+ if(!stat)
{
- stat = CUBIT_FAILURE;
- //Add imprint code here
- if(imprint)
- stat = imprint_toposhapes(from_shape, tool_shape);
- if(!stat)
- {
- PRINT_ERROR("Can't do imprint operation on the body. \n");
- count++;
- }
- continue;
+ PRINT_ERROR("Can't do imprint operation on the body. \n");
+ count++;
}
- //got cut. Update the entities
- if(after_mass > tol)
- {
- TopoDS_Solid old_solid = TopoDS::Solid(cutter.Shape1());
- OCCLump::update_OCC_entity(old_solid , cut_shape, &cutter);
- }
+ continue;
}
- else
- {
- GProp_GProps myProps;
- BRepGProp::SurfaceProperties(*from_shape, myProps);
- double orig_mass = myProps.Mass();
- BRepGProp::SurfaceProperties(cut_shape, myProps);
- double after_mass = myProps.Mass();
- if((-after_mass + orig_mass) <= tol)
- {
- stat = CUBIT_FAILURE;
- //Add imprint code here
- if(imprint)
- stat = imprint_toposhapes(from_shape, tool_shape);
- if(!stat)
- {
- PRINT_ERROR("Can't do imprint operation on the body. \n");
- count++;
- }
- continue;
- }
- //got cut. Update the entities
- if(after_mass > tol)
- {
- if(from_shape->TShape()->ShapeType() == TopAbs_SHELL)
- {
- TopoDS_Shell old_shell = TopoDS::Shell(*from_shape);
- OCCShell::update_OCC_entity(old_shell,cut_shape, &cutter);
- }
- else
- {
- TopoDS_Face old_face = TopoDS::Face(*from_shape);
- OCCSurface::update_OCC_entity(old_face,cut_shape, &cutter);
- }
- }
- }
- delete from_shape;
- from_shape = new TopoDS_Shape(cut_shape);
}
//ok, we're done wih all cuts, construct new Body'
@@ -1894,8 +1793,9 @@
}
//ok, we're done wih all cuts, delete unnecessaries.
- while (tool_boxes.size())
- delete tool_boxes.pop();
+ while (tool_boxes->size())
+ delete tool_boxes->pop();
+ delete tool_boxes;
while (tool_bodies_copy.size())
delete tool_bodies_copy.pop();
if(keep_old)
@@ -2557,12 +2457,13 @@
newBody1 = NULL;
newBody2 = NULL;
DLIList<TopoDS_Shape*> shape_list;
+ DLIList<CubitBoolean> is_volume;
DLIList<BodySM*> bodysm_list;
bodysm_list.append(BodyPtr1);
bodysm_list.append(BodyPtr2);
- CubitStatus stat = get_shape_list(bodysm_list, shape_list, keep_old);
+ CubitStatus stat = get_shape_list(bodysm_list,shape_list,is_volume,keep_old);
if(!stat)
return stat;
@@ -2608,9 +2509,11 @@
// Author : Jane Hu
// Date : 05/08
//===============================================================================
-CubitStatus OCCModifyEngine::get_shape_list(DLIList<BodySM*> BodySM_list,
+CubitStatus OCCModifyEngine::get_shape_list(DLIList<BodySM*>& BodySM_list,
DLIList<TopoDS_Shape*>& shape_list,
- bool keep_old) const
+ DLIList<CubitBoolean>& is_volume,
+ bool keep_old,
+ DLIList<CubitBox*>* b_boxes) const
{
OCCBody* occ_body = NULL;
shape_list.clean_out();
@@ -2622,6 +2525,14 @@
OCCSurface* surface = occ_body->my_sheet_surface();
OCCShell* shell = occ_body->shell();
+ is_volume.append( CUBIT_TRUE);
+
+ if(b_boxes)
+ {
+ CubitBox *tool_box = new CubitBox(occ_body->get_bounding_box());
+ b_boxes->append(tool_box);
+ }
+
if(surface)
{
TopoDS_Face* topo_face = surface->get_TopoDS_Face();
@@ -2634,6 +2545,7 @@
}
else
shape_list.append(topo_face);
+ is_volume.change_to( CUBIT_FALSE);
}
else if(shell)
{
@@ -2647,6 +2559,7 @@
}
else
shape_list.append(topo_shell);
+ is_volume.change_to( CUBIT_FALSE);
}
else
@@ -2687,9 +2600,9 @@
{
CubitStatus success = CUBIT_SUCCESS;
DLIList<TopoDS_Shape*> shape_list;
+ DLIList<CubitBoolean> is_vo;
+ CubitStatus stat = get_shape_list(from_body_list, shape_list, is_vo,keep_old);
- CubitStatus stat = get_shape_list(from_body_list, shape_list, keep_old);
-
if(!stat)
return stat;
@@ -2757,8 +2670,8 @@
{
CubitStatus success = CUBIT_SUCCESS;
DLIList<TopoDS_Shape*> shape_list, tool_shapes;
-
- CubitStatus stat = get_shape_list(body_list, shape_list, keep_old);
+ DLIList<CubitBoolean> is_vo;
+ CubitStatus stat = get_shape_list(body_list, shape_list, is_vo, keep_old);
if (!stat)
return stat;
@@ -3079,7 +2992,8 @@
DLIList<TopologyBridge*>* ) const
{
DLIList<TopoDS_Shape*> shape_list;
- CubitStatus stat = get_shape_list(body_list, shape_list, keep_old);
+ DLIList<CubitBoolean> is_vo;
+ CubitStatus stat = get_shape_list(body_list, shape_list, is_vo, keep_old);
if(!stat)
return stat;
@@ -3208,7 +3122,7 @@
{
DLIList<Curve*> projected_curves;
CubitStatus
- stat = project_curves(ref_face_list, ref_edge_list, projected_curves);
+ stat = project_edges(ref_face_list, ref_edge_list, projected_curves);
if(!stat)
return stat;
@@ -3236,16 +3150,16 @@
return stat;
}
//===============================================================================
-// Function : project_curves
-// Member Type: PRIVATE
+// Function : project_edges
+// Member Type: PUBLIC
// Description: Projects a list of Curves on to a list of Surfaces
// Author : Jane Hu
// Date : 06/08
//===============================================================================
-CubitStatus
- OCCModifyEngine::project_curves( DLIList<Surface*> &ref_face_list,
- DLIList<Curve*> &ref_edge_list,
- DLIList<Curve*> &projected_curves)const
+CubitStatus OCCModifyEngine::project_edges( DLIList<Surface*> &ref_face_list,
+ DLIList<Curve*> &ref_edge_list,
+ DLIList<Curve*> &projected_curves,
+ bool print_error ) const
{
CubitVector* v = NULL;
@@ -3265,7 +3179,8 @@
continue;
if(surface->is_closed_in_U() || surface->is_closed_in_V())
{
- PRINT_ERROR("This function can't project curves on closed surfaces.\n");
+ if(print_error)
+ PRINT_ERROR("This function can't project curves on closed surfaces.\n");
return CUBIT_FAILURE;
}
@@ -3283,55 +3198,193 @@
//===============================================================================
// Function : imprint_projected_edges
// Member Type: PUBLIC
-// Description:
-// Author : John Fowler
-// Date : 10/02
+// Description: Projects a list of curves on to a list of surfaces
+// and imprint the bodies with the new curves
+// Author : Jane Hu
+// Date : 06/08
//===============================================================================
-CubitStatus OCCModifyEngine::imprint_projected_edges(DLIList<Surface*> &/*ref_face_list*/,
- DLIList<BodySM*> &/*body_list*/,
- DLIList<Curve*> &/*ref_edge_list*/,
- DLIList<BodySM*>& /*new_body_list*/,
- bool /*keep_old_body*/,
- bool /*keep_free_edges*/) const
+CubitStatus
+OCCModifyEngine::imprint_projected_edges(DLIList<Surface*> &ref_face_list,
+ DLIList<BodySM*> &body_list,
+ DLIList<Curve*> &ref_edge_list,
+ DLIList<BodySM*>& new_body_list,
+ bool keep_old,
+ bool keep_free_edges) const
{
- PRINT_ERROR("Option not supported for mesh based geometry.\n");
+ DLIList<Curve*> projected_curves;
+ CubitStatus
+ stat = project_edges(ref_face_list, ref_edge_list, projected_curves);
+ if(!stat)
+ return stat;
return CUBIT_FAILURE;
+
+ // imprint bodies with curves
+ stat = imprint(body_list,projected_curves, new_body_list, keep_old);
+
+ if (keep_free_edges)
+ return stat;
+
+ PRINT_INFO( "Removing projected curves \n");
+ for(int i=0; i< projected_curves.size();i++)
+ {
+ // Now delete this Curve
+ Curve* curve = projected_curves.get_and_step();
+ stat = OCCQueryEngine::instance()->
+ delete_solid_model_entities( curve );
+ if (stat == CUBIT_FAILURE)
+ {
+ PRINT_ERROR("In OCCModifyEngine::delete_geometry\n"
+ " Could not delete Curve.\n"
+ " The Model database is likely corrupted "
+ "due to\n this unsuccessful deletion.\n" );
+ }
+ }
+ return stat;
}
//===============================================================================
-// Function : project_edges
+// Function : intersect
// Member Type: PUBLIC
-// Description:
-// Author : John Fowler
-// Date : 10/02
+// Description: intersect boolean operation of body with list of bodies.
+// Author : Jane Hu
+// Date : 06/08
//===============================================================================
-CubitStatus OCCModifyEngine::project_edges( DLIList<Surface*> &/*ref_face_list*/,
- DLIList<Curve*> &/*ref_edge_list_in*/,
- DLIList<Curve*> &/*ref_edge_list_new*/,
- bool /*print_error*/ ) const
+CubitStatus OCCModifyEngine::intersect(BodySM* tool_body_ptr,
+ DLIList<BodySM*> &from_bodies,
+ DLIList<BodySM*> &new_bodies,
+ bool keep_old) const
{
- PRINT_ERROR("Option not supported for mesh based geometry.\n");
- return CUBIT_FAILURE;
+ DLIList<BodySM*> tool_bodies;
+ DLIList<TopoDS_Shape*> tool_shapes;
+ DLIList<CubitBoolean> is_tool_volume, is_volume;
+
+ tool_bodies.append(tool_body_ptr);
+ //get tool_body's underlying shape, copy it, so boolean wouldn't touch it.
+ get_shape_list(tool_bodies, tool_shapes, is_tool_volume, CUBIT_TRUE);
+
+ DLIList<TopoDS_Shape*> shape_list;
+ get_shape_list(from_bodies, shape_list, is_volume, keep_old);
+
+ TopoDS_Shape* tool_shape = tool_shapes.get();
+ CubitBoolean has_changed;
+ DLIList<TopologyBridge*> tbs;
+ for (int i = 0; i < shape_list.size(); i++)
+ {
+ TopoDS_Shape* from_shape = shape_list.get_and_step();
+ BRepAlgoAPI_Common intersector(*from_shape, *tool_shape);
+ TopoDS_Shape common_shape = intersector.Shape();
+ check_operation(common_shape, from_shape, is_volume[i], has_changed,
+ &intersector);
+
+ if(from_shape->IsNull())
+ {
+ PRINT_INFO("The %d body did not change because cutting tools are not interscting with it.\n", i+1);
+ continue;
+ }
+ else
+ tbs += OCCQueryEngine::instance()->populate_topology_bridge(*from_shape);
+ }
+ for (int i = 0; i< tbs.size(); i++)
+ {
+ BodySM* bodysm = CAST_TO(tbs.get_and_step(), BodySM);
+ if (bodysm)
+ new_bodies.append(bodysm);
+ }
+
+ //ok, we're done wih all cuts, delete unnecessaries.
+ while (tool_shapes.size())
+ tool_shapes.pop();
+ if(keep_old)
+ {
+ int size = shape_list.size();
+ for (int i = 0; i < size; i++)
+ {
+ TopoDS_Shape* shape = shape_list.pop();
+ shape->Nullify();
+ delete shape;
+ }
+ }
+ return CUBIT_SUCCESS;
}
-
//===============================================================================
-// Function : intersect
-// Member Type: PUBLIC
-// Description: intersect boolean operation between facet-based bodies
-// Author : John Fowler
-// Date : 10/02
+// Function : check_operation
+// Member Type: PRIVATE
+// Description: check and update the from_shape according to type of the body.
+// Author : Jane Hu
+// Date : 06/08
//===============================================================================
-CubitStatus OCCModifyEngine::intersect(BodySM* tool_body_ptr,
- DLIList<BodySM*> &from_bodies,
- DLIList<BodySM*> &new_bodies,
- bool keep_old) const
+void OCCModifyEngine::check_operation(TopoDS_Shape& cut_shape,
+ TopoDS_Shape*& from_shape, //output
+ CubitBoolean is_volume,
+ CubitBoolean& has_changed, //output
+ BRepAlgoAPI_BooleanOperation* op) const
{
-
- PRINT_ERROR("Option not supported for mesh based geometry.\n");
- return CUBIT_FAILURE;
+ //compare to see if the from_shape has gotten cut.
+ double tol = OCCQueryEngine::instance()->get_sme_resabs_tolerance();
+ if(is_volume)
+ {
+ GProp_GProps myProps;
+ BRepGProp::VolumeProperties(*from_shape, myProps);
+ double orig_mass = myProps.Mass();
+ BRepGProp::VolumeProperties(cut_shape, myProps);
+ double after_mass = myProps.Mass();
+ if((-after_mass + orig_mass) <= tol)
+ {
+ has_changed= CUBIT_FALSE; //common is itself
+ return;
+ }
+ //got cut. Update the entities
+ if(after_mass > tol)
+ {
+ has_changed = CUBIT_TRUE;
+ TopoDS_Solid old_solid = TopoDS::Solid(op->Shape1());
+ OCCLump::update_OCC_entity(old_solid , cut_shape, op);
+ }
+ else //no common section
+ {
+ from_shape->Nullify();
+ has_changed = CUBIT_FALSE;
+ return;
+ }
+ }
+ else
+ {
+ GProp_GProps myProps;
+ BRepGProp::SurfaceProperties(*from_shape, myProps);
+ double orig_mass = myProps.Mass();
+ BRepGProp::SurfaceProperties(cut_shape, myProps);
+ double after_mass = myProps.Mass();
+ if((-after_mass + orig_mass) <= tol)
+ {
+ has_changed= CUBIT_FALSE; //common is itself, or not cut
+ return;
+ }
+ //got cut. Update the entities
+ if(after_mass > tol)
+ {
+ has_changed = CUBIT_TRUE;
+ if(from_shape->TShape()->ShapeType() == TopAbs_SHELL)
+ {
+ TopoDS_Shell old_shell = TopoDS::Shell(*from_shape);
+ OCCShell::update_OCC_entity(old_shell,cut_shape, op);
+ }
+ else
+ {
+ TopoDS_Face old_face = TopoDS::Face(*from_shape);
+ OCCSurface::update_OCC_entity(old_face,cut_shape, op);
+ }
+ }
+ else //no common section
+ {
+ from_shape->Nullify();
+ has_changed = CUBIT_FALSE;
+ return;
+ }
+ }
+ delete from_shape;
+ from_shape = new TopoDS_Shape(cut_shape);
}
-
//===============================================================================
// Function : chop
// Member Type: PUBLIC
Modified: cgm/trunk/geom/OCC/OCCModifyEngine.hpp
===================================================================
--- cgm/trunk/geom/OCC/OCCModifyEngine.hpp 2008-06-13 17:43:16 UTC (rev 1895)
+++ cgm/trunk/geom/OCC/OCCModifyEngine.hpp 2008-06-13 19:16:47 UTC (rev 1896)
@@ -27,6 +27,7 @@
class TopoDS_Shape;
class TopoDS_Edge;
class TopoDS_Face;
+class CubitBox;
class OCCModifyEngine : public GeometryModifyEngine
{
@@ -673,9 +674,12 @@
private:
int check_intersection(DLIList<TopoDS_Edge*>* edge_list,
TopoDS_Face from_face)const;
- CubitStatus get_shape_list(DLIList<BodySM*> BodySM_list,
+ CubitStatus get_shape_list(DLIList<BodySM*>& BodySM_list,
DLIList<TopoDS_Shape*>& shape_list,
- bool keep_old) const;
+ DLIList<CubitBoolean>& is_volume,
+ bool keep_old,
+ DLIList<CubitBox*>* b_boxes = NULL) const;
+
CubitStatus face_edge_imprint( DLIList<Surface*> &ref_face_list,
DLIList<Curve*> &edge_list,
DLIList<TopoDS_Face*>& face_list,
@@ -684,9 +688,12 @@
void shape_to_bodySM( DLIList<TopoDS_Shape*> shape_list,
DLIList<BodySM*>& new_body_list)const;
- CubitStatus project_curves( DLIList<Surface*> &ref_face_list,
- DLIList<Curve*> &ref_edge_list,
- DLIList<Curve*> &projected_curves)const;
+ void check_operation(TopoDS_Shape& cut_shape,
+ TopoDS_Shape*& from_shape, //output
+ CubitBoolean is_volume,
+ CubitBoolean& has_changed, //output
+ BRepAlgoAPI_BooleanOperation* op) const;
+
} ;
#endif
1
0