[cgma-dev] r2525 - in cgm/trunk/geom: . ACIS_SRC OCC facet
janehu at mcs.anl.gov
janehu at mcs.anl.gov
Fri Jan 9 14:51:43 CST 2009
Author: janehu
Date: 2009-01-09 14:51:43 -0600 (Fri, 09 Jan 2009)
New Revision: 2525
Modified:
cgm/trunk/geom/ACIS_SRC/AcisModifyEngine.cpp
cgm/trunk/geom/ACIS_SRC/AcisModifyEngine.hpp
cgm/trunk/geom/GeometryModifyEngine.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:
Added webcut function to use a tool_body to webcut, since this function is not going to change any memeber of OCCModifyEngine, and the internal operation intersect and subtract are both non-const, change the const signature to non.
Modified: cgm/trunk/geom/ACIS_SRC/AcisModifyEngine.cpp
===================================================================
--- cgm/trunk/geom/ACIS_SRC/AcisModifyEngine.cpp 2009-01-09 19:49:30 UTC (rev 2524)
+++ cgm/trunk/geom/ACIS_SRC/AcisModifyEngine.cpp 2009-01-09 20:51:43 UTC (rev 2525)
@@ -9925,7 +9925,7 @@
DLIList<BodySM*>& webcut_body_list,
BodySM const* tool_body,
DLIList<BodySM*>& results_list,
- bool imprint)const
+ bool imprint)
{
// check the tool body if it is made of AcisModifyEngine
if( !is_modify_engine(tool_body))
Modified: cgm/trunk/geom/ACIS_SRC/AcisModifyEngine.hpp
===================================================================
--- cgm/trunk/geom/ACIS_SRC/AcisModifyEngine.hpp 2009-01-09 19:49:30 UTC (rev 2524)
+++ cgm/trunk/geom/ACIS_SRC/AcisModifyEngine.hpp 2009-01-09 20:51:43 UTC (rev 2525)
@@ -482,7 +482,7 @@
DLIList<BodySM*>& webcut_body_list,
BodySM const* tool_body,
DLIList<BodySM*>& results_list,
- bool imprint = false) const;
+ bool imprint = false) ;
//R int
//R- Number of bodies that were webcut ( >= 0 )
//I webcut_body_list
Modified: cgm/trunk/geom/GeometryModifyEngine.hpp
===================================================================
--- cgm/trunk/geom/GeometryModifyEngine.hpp 2009-01-09 19:49:30 UTC (rev 2524)
+++ cgm/trunk/geom/GeometryModifyEngine.hpp 2009-01-09 20:51:43 UTC (rev 2525)
@@ -556,7 +556,7 @@
BodySM const* tool_body,
DLIList<BodySM*>& results_list,
bool imprint = false
- ) const = 0 ;
+ ) = 0 ;
//R int
//R- Number of bodies that were webcut ( >= 0 )
//I webcut_body_list
Modified: cgm/trunk/geom/OCC/OCCModifyEngine.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCModifyEngine.cpp 2009-01-09 19:49:30 UTC (rev 2524)
+++ cgm/trunk/geom/OCC/OCCModifyEngine.cpp 2009-01-09 20:51:43 UTC (rev 2525)
@@ -1835,13 +1835,15 @@
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++;
+ if(!stat)
+ {
+ PRINT_ERROR("Can't do imprint operation on the body. \n");
+ count++;
+ }
+ continue;
}
- continue;
}
}
@@ -3389,7 +3391,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();
+ 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,
@@ -3398,7 +3400,7 @@
if(from_shape->IsNull())
{
PRINT_INFO("The %d body did not have common part with the tool_body.\n", i+1);
- continue;
+ new_bodies.append(from_body);
}
else
tbs += OCCQueryEngine::instance()->populate_topology_bridge(*from_shape);
@@ -4494,19 +4496,45 @@
}
//===============================================================================
-// Function : webcut
+// Function : webcuts a list of bodies using another Body as the tool.
// Member Type: PUBLIC
// Description:
-// Author : John Fowler
-// Date : 10/02
+// Author : Jane Hu
+// Date : 01/09
//===============================================================================
-CubitStatus OCCModifyEngine::webcut(DLIList<BodySM*>& /*webcut_body_list*/,
- BodySM const* /*tool_body*/,
- DLIList<BodySM*>& /*results_list*/,
- bool /*imprint*/ ) const
+CubitStatus OCCModifyEngine::webcut(DLIList<BodySM*>& webcut_body_list,
+ BodySM const* tool_body,
+ DLIList<BodySM*>& results_list,
+ bool imprint )
{
- PRINT_ERROR("Option not supported for mesh based geometry.\n");
- return CUBIT_FAILURE;
+ //do intersect and subtract separately and with imprint option and keep_old
+ // is true.
+ //tool_body is a const pointer points to varible BodySM object
+ //here trying to create a non-const pointer points to the same BodySM object.
+
+ BodySM *body, *body2;
+ body = brick(1,1,1);
+ body2 = body;
+ *body = *tool_body;
+
+ CubitStatus stat = intersect(body, webcut_body_list, results_list,
+ CUBIT_TRUE);
+
+ if(stat)
+ {
+ PRINT_ERROR("Failed to webcut the bodies.\n");
+ return CUBIT_FAILURE;
+ }
+
+ DLIList<BodySM*> tool_bodies;
+ tool_bodies.append(body);
+
+ stat = subtract(tool_bodies, webcut_body_list, results_list, imprint,
+ CUBIT_TRUE);
+
+ OCCQueryEngine::instance()->delete_solid_model_entities(body2);
+
+ return stat;
}
//===============================================================================
Modified: cgm/trunk/geom/OCC/OCCModifyEngine.hpp
===================================================================
--- cgm/trunk/geom/OCC/OCCModifyEngine.hpp 2009-01-09 19:49:30 UTC (rev 2524)
+++ cgm/trunk/geom/OCC/OCCModifyEngine.hpp 2009-01-09 20:51:43 UTC (rev 2525)
@@ -317,7 +317,7 @@
virtual CubitStatus webcut(DLIList<BodySM*>& webcut_body_list,
BodySM const* tool_body,
DLIList<BodySM*>& results_list,
- bool imprint = false ) const;
+ bool imprint = false ) ;
virtual CubitStatus webcut_across_translate( DLIList<BodySM*>& body_list,
Surface* plane_surf1,
Modified: cgm/trunk/geom/facet/FacetModifyEngine.cpp
===================================================================
--- cgm/trunk/geom/facet/FacetModifyEngine.cpp 2009-01-09 19:49:30 UTC (rev 2524)
+++ cgm/trunk/geom/facet/FacetModifyEngine.cpp 2009-01-09 20:51:43 UTC (rev 2525)
@@ -2007,7 +2007,7 @@
DLIList<BodySM*>& /*webcut_body_list*/,
BodySM const* /*tool_body*/,
DLIList<BodySM*>& /*results_list*/,
- bool /*imprint*/ )const
+ bool /*imprint*/ )
{
PRINT_ERROR("Option not supported for mesh based geometry.\n");
return CUBIT_FAILURE;
Modified: cgm/trunk/geom/facet/FacetModifyEngine.hpp
===================================================================
--- cgm/trunk/geom/facet/FacetModifyEngine.hpp 2009-01-09 19:49:30 UTC (rev 2524)
+++ cgm/trunk/geom/facet/FacetModifyEngine.hpp 2009-01-09 20:51:43 UTC (rev 2525)
@@ -330,7 +330,7 @@
virtual CubitStatus webcut(DLIList<BodySM*>& webcut_body_list,
BodySM const* tool_body,
DLIList<BodySM*>& results_list,
- bool imprint = false)const;
+ bool imprint = false);
virtual CubitStatus webcut_across_translate( DLIList<BodySM*>& body_list,
Surface* plane_surf1,
More information about the cgma-dev
mailing list