[cgma-dev] r1628 - cgm/trunk/geom/OCC
janehu at mcs.anl.gov
janehu at mcs.anl.gov
Fri Feb 29 15:01:17 CST 2008
Author: janehu
Date: 2008-02-29 15:01:17 -0600 (Fri, 29 Feb 2008)
New Revision: 1628
Modified:
cgm/trunk/geom/OCC/OCCCurve.hpp
cgm/trunk/geom/OCC/OCCLoop.cpp
cgm/trunk/geom/OCC/OCCLoop.hpp
cgm/trunk/geom/OCC/OCCQueryEngine.cpp
Log:
Added logic to delete OCCCoEdge and sheet body.
Modified: cgm/trunk/geom/OCC/OCCCurve.hpp
===================================================================
--- cgm/trunk/geom/OCC/OCCCurve.hpp 2008-02-29 18:47:12 UTC (rev 1627)
+++ cgm/trunk/geom/OCC/OCCCurve.hpp 2008-02-29 21:01:17 UTC (rev 1628)
@@ -55,6 +55,7 @@
void add_loop(OCCLoop* loop) { myLoopList.append_unique(loop);}
DLIList<OCCLoop*> loops() {return myLoopList;}
void remove_loop(OCCLoop* loop) {myLoopList.remove(loop);}
+ void clean_loops(){myLoopList.clean_out();}
virtual void append_simple_attribute_virt(CubitSimpleAttrib*);
//R void
Modified: cgm/trunk/geom/OCC/OCCLoop.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCLoop.cpp 2008-02-29 18:47:12 UTC (rev 1627)
+++ cgm/trunk/geom/OCC/OCCLoop.cpp 2008-02-29 21:01:17 UTC (rev 1628)
@@ -80,12 +80,15 @@
{
OCCCoEdge* coedge = myCoEdgeList.get_and_step();
assert(coedge->loop() == this);
- OCCCurve* curve = CAST_TO(coedge->curve(), OCCCurve);
- curve->remove_loop(this);
}
myCoEdgeList.clean_out();
}
+OCCCoEdge* OCCLoop::remove_coedge(OCCCoEdge *coedge)
+{
+ return myCoEdgeList.remove(coedge);
+}
+
//-------------------------------------------------------------------------
// Purpose : The purpose of this function is to append a
// attribute to the GE. The name is attached to the
Modified: cgm/trunk/geom/OCC/OCCLoop.hpp
===================================================================
--- cgm/trunk/geom/OCC/OCCLoop.hpp 2008-02-29 18:47:12 UTC (rev 1627)
+++ cgm/trunk/geom/OCC/OCCLoop.hpp 2008-02-29 21:01:17 UTC (rev 1628)
@@ -43,6 +43,8 @@
DLIList<OCCCoEdge*> coedges() {return myCoEdgeList;}
+ OCCCoEdge* remove_coedge(OCCCoEdge *coedge);
+
void disconnect_all_curves();
inline TopoDS_Wire* get_TopoDS_Wire() {return myTopoDSWire;}
Modified: cgm/trunk/geom/OCC/OCCQueryEngine.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCQueryEngine.cpp 2008-02-29 18:47:12 UTC (rev 1627)
+++ cgm/trunk/geom/OCC/OCCQueryEngine.cpp 2008-02-29 21:01:17 UTC (rev 1628)
@@ -1414,6 +1414,15 @@
if (!occ_body)
return CUBIT_FAILURE;
+ OCCSurface* occ_surface = occ_body->my_sheet_surface();
+ if(occ_surface)
+ {
+ delete occ_surface->my_body();
+ delete occ_surface->my_shell();
+ delete occ_surface->my_lump();
+ return delete_solid_model_entities(occ_surface);
+ }
+
for(int i =0; i < occ_body->lumps().size(); i++)
{
Lump* lump = occ_body->lumps().get_and_step();
@@ -1422,6 +1431,7 @@
occ_lump->remove_body();
unhook_Lump_from_OCC(lump);
}
+
return unhook_BodySM_from_OCC(bodysm);
}
@@ -1646,10 +1656,43 @@
return CUBIT_FAILURE;
DLIList<OCCCoEdge*> children;
- occ_loop->coedges(children);
- for(int i = 0; i < children.size(); i++)
+ children = occ_loop->coedges();
+ int size = children.size();
+ while(size > 0)
{
- Curve* curve = children.get_and_step()->curve();
+ OCCCoEdge* coedge = children.pop();
+ Curve* curve = coedge->curve();
+ OCCCurve *occ_curve = CAST_TO(curve, OCCCurve);
+ if (occ_curve == NULL)
+ continue;
+
+ DLIList<OCCLoop*> loops;
+
+ //remove all coedges corresponding to this curve from their loops.
+ loops = occ_curve->loops();
+ for(int j = 0; j < loops.size(); j++)
+ {
+ OCCLoop* occ_loop = loops.get_and_step();
+ OCCCoEdge* found_coedge = occ_loop->remove_coedge(coedge);
+
+ if (found_coedge)
+ delete found_coedge;
+
+ //there might be 2 coedges in the same loop that uses the same curve
+ //as in a scar curve situation
+ DLIList<OCCCoEdge*> coedges = occ_loop->coedges();
+ for(int k =0; k < coedges.size(); k++)
+ {
+ found_coedge = coedges.get_and_step();
+ if (CAST_TO(found_coedge->curve(), OCCCurve) == occ_curve)
+ {
+ occ_loop->remove_coedge(found_coedge);
+ children.remove(found_coedge);
+ delete found_coedge;
+ }
+ }
+ }
+ size = children.size();
delete_solid_model_entities(curve);
}
@@ -1739,6 +1782,7 @@
if (!fcurve )
return CUBIT_FAILURE;
+ fcurve->clean_loops();
TopoDS_Edge * edge = fcurve->get_TopoDS_Edge();
if (!edge)
return CUBIT_FAILURE;
More information about the cgma-dev
mailing list