[cgma-dev] r1799 - cgm/trunk/geom/OCC
janehu at mcs.anl.gov
janehu at mcs.anl.gov
Wed May 7 14:18:58 CDT 2008
Author: janehu
Date: 2008-05-07 14:18:58 -0500 (Wed, 07 May 2008)
New Revision: 1799
Modified:
cgm/trunk/geom/OCC/OCCLump.cpp
cgm/trunk/geom/OCC/OCCModifyEngine.cpp
cgm/trunk/geom/OCC/OCCQueryEngine.cpp
cgm/trunk/geom/OCC/OCCSurface.cpp
Log:
When subtract a body from a body, the original body is deleted and new body will be created, this part is different than ACIS; unaffacted surface will remain unchanged, this part is the same in ACIS. Now still has bugs in subtracting which makes original surface becoming two surfaces.
Modified: cgm/trunk/geom/OCC/OCCLump.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCLump.cpp 2008-05-06 21:49:04 UTC (rev 1798)
+++ cgm/trunk/geom/OCC/OCCLump.cpp 2008-05-07 19:18:58 UTC (rev 1799)
@@ -343,7 +343,7 @@
// Author: Jane Hu
//----------------------------------------------------------------
CubitStatus OCCLump::update_OCC_entity(TopoDS_Solid& old_solid,
- TopoDS_Shape& new_solid,
+ TopoDS_Shape& new_shape,
BRepAlgoAPI_BooleanOperation *op)
{
//set the Shells
@@ -356,7 +356,7 @@
{
TopoDS_Shell shell = TopoDS::Shell(M(ii));
- if(!new_solid.IsNull())
+ if(!new_shape.IsNull())
{
TopTools_ListOfShape shapes;
shapes.Assign(op->Modified(shell));
@@ -366,5 +366,8 @@
if(shapes.Extent() > 0 || op->IsDeleted(shell))
OCCShell::update_OCC_entity(shell, shape, op);
}
+ TopoDS_Solid new_solid;
+ if(!op->IsDeleted(old_solid))
+ new_solid = TopoDS::Solid(new_shape);
OCCQueryEngine::instance()->update_OCC_map(old_solid, new_solid);
}
Modified: cgm/trunk/geom/OCC/OCCModifyEngine.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCModifyEngine.cpp 2008-05-06 21:49:04 UTC (rev 1798)
+++ cgm/trunk/geom/OCC/OCCModifyEngine.cpp 2008-05-07 19:18:58 UTC (rev 1799)
@@ -1824,7 +1824,7 @@
//got cut. Update the entities
if(after_mass > tol*tol*tol)
{
- TopoDS_Solid old_solid = TopoDS::Solid(*from_shape);
+ TopoDS_Solid old_solid = TopoDS::Solid(cutter.Shape1());
OCCLump::update_OCC_entity(old_solid , cut_shape, &cutter);
}
}
@@ -1902,12 +1902,6 @@
delete tool_boxes.pop();
while (tool_bodies_copy.size())
delete tool_bodies_copy.pop();
- if (!keep_old)
- {
- from_bodies.remove_all_with_value(NULL);
- OCCQueryEngine::instance()->delete_solid_model_entities(from_bodies);
- OCCQueryEngine::instance()->delete_solid_model_entities( tool_body_list);
- }
return CUBIT_SUCCESS;
}
Modified: cgm/trunk/geom/OCC/OCCQueryEngine.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCQueryEngine.cpp 2008-05-06 21:49:04 UTC (rev 1798)
+++ cgm/trunk/geom/OCC/OCCQueryEngine.cpp 2008-05-07 19:18:58 UTC (rev 1799)
@@ -1185,6 +1185,7 @@
{
OCCShell *shell ;
CubitBoolean build_body = CUBIT_FALSE;
+ DLIList<OCCCoFace*> cofaces_old, cofaces_new;
if (!OCCMap->IsBound(aShape))
{
if(PRINT_RESULT)
@@ -1210,6 +1211,7 @@
{
int k = OCCMap->Find(aShape);
shell = (OCCShell*)(OccToCGM->find(k))->second;
+ cofaces_old = shell->cofaces();
shell->set_TopoDS_Shell(aShape);
}
@@ -1222,15 +1224,32 @@
populate_topology_bridge(topo_face, build_body);
OCCSurface *occ_surface = CAST_TO(face, OCCSurface);
- OCCCoFace * coface = new OCCCoFace( occ_surface, shell,
+ CubitBoolean exist = CUBIT_FALSE;
+ OCCCoFace * coface = NULL;
+ int size = cofaces_old.size();
+ for(int i = 0; i < size; i++)
+ {
+ coface = cofaces_old.pop();
+ if(coface->surface() == occ_surface)
+ {
+ exist = CUBIT_TRUE;
+ coface->set_sense(topo_face.Orientation()== TopAbs_FORWARD ? CUBIT_FORWARD : CUBIT_REVERSED);
+ cofaces_new.append(coface);
+ break;
+ }
+ }
+ if(!exist)
+ {
+ OCCCoFace * coface = new OCCCoFace( occ_surface, shell,
( topo_face.Orientation()== TopAbs_FORWARD ? CUBIT_FORWARD : CUBIT_REVERSED));
- cofaces.append(coface);
+ cofaces_new.append(coface);
+ }
occ_surface->add_shell(shell);
if(standalone)
occ_surface->set_shell(shell);
}
- shell->cofaces(cofaces);
+ shell->cofaces(cofaces_new);
return shell;
}
@@ -1437,11 +1456,12 @@
if (remove_lower_entities)
return delete_solid_model_entities(body);
+ DLIList<TopologyBridge*> children;
+ CAST_TO(lump, OCCLump)->get_children_virt(children);
+
CubitStatus stat = this->unhook_BodySM_from_OCC(body);
if(stat)
{
- DLIList<TopologyBridge*> children;
- CAST_TO(lump, OCCLump)->get_children_virt(children);
while (children.size())
delete children.pop();
delete lump;
@@ -2504,7 +2524,7 @@
int OCCQueryEngine::update_OCC_map(TopoDS_Shape old_shape,
TopoDS_Shape new_shape)
{
- if (!OCCMap->IsBound(old_shape))
+ if (!OCCMap->IsBound(old_shape) || old_shape.IsEqual(new_shape))
return -1;
int k = OCCMap->Find(old_shape);
@@ -2532,7 +2552,7 @@
else
{
ShellSM * shell = CAST_TO(tb, ShellSM);
- if(shell)
+ if(shell && CAST_TO(shell, OCCShell)->my_lump())
{
unhook_ShellSM_from_OCC(shell);
delete shell;
Modified: cgm/trunk/geom/OCC/OCCSurface.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCSurface.cpp 2008-05-06 21:49:04 UTC (rev 1798)
+++ cgm/trunk/geom/OCC/OCCSurface.cpp 2008-05-07 19:18:58 UTC (rev 1799)
@@ -863,16 +863,14 @@
else if (op->IsDeleted(edge))
;
else
- {
shape_edge = edge;
- continue;
- }
+/*
if(wire.Orientation() == TopAbs_REVERSED && !shape_edge.IsNull())
{
shape_edge.Orientation(
shape_edge.Orientation()==TopAbs_FORWARD? TopAbs_REVERSED:TopAbs_FORWARD);
}
-
+*/
//update vertex
TopoDS_Vertex vertex = Ex.CurrentVertex();
shapes.Assign(op->Modified(vertex));
More information about the cgma-dev
mailing list