[cgma-dev] r2746 - cgm/trunk/geom/OCC
jiangtao_ma at yahoo.com
jiangtao_ma at yahoo.com
Wed Mar 25 14:05:40 CDT 2009
Author: janehu
Date: 2009-03-25 14:05:39 -0500 (Wed, 25 Mar 2009)
New Revision: 2746
Modified:
cgm/trunk/geom/OCC/OCCModifyEngine.cpp
cgm/trunk/geom/OCC/OCCPoint.cpp
cgm/trunk/geom/OCC/OCCSurface.cpp
Log:
Fixed bugs in fillet/chamfer on vertices.
Modified: cgm/trunk/geom/OCC/OCCModifyEngine.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCModifyEngine.cpp 2009-03-25 16:40:44 UTC (rev 2745)
+++ cgm/trunk/geom/OCC/OCCModifyEngine.cpp 2009-03-25 19:05:39 UTC (rev 2746)
@@ -6594,17 +6594,55 @@
{
TopTools_IndexedDataMapOfShapeListOfShape M;
- if(ref_vertex_list.size() != faces.size())
- return CUBIT_FAILURE;
-
for(int i = 0; i < ref_vertex_list.size(); i ++)
{
Point* pnt = ref_vertex_list.get_and_step();
OCCPoint* occ_pnt = CAST_TO(pnt, OCCPoint);
TopoDS_Vertex* vertex = occ_pnt->get_TopoDS_Vertex();
+ OCCSurface* face = NULL;
- OCCSurface* face = faces.get_and_step();
+ if( faces.size() == 0)
+ {
+ OCCQueryEngine* oqe = OCCQueryEngine::instance();
+ //make sure the vertex is on sheet body, not on a volume.
+ DLIList <OCCBody*> *bodies = oqe->BodyList;
+ for(int k =0 ; k < bodies->size(); k++)
+ {
+ OCCBody* occ_body = bodies->get_and_step();
+ TopExp_Explorer Ex;
+ TopoDS_Shape ashape = *(occ_body->get_TopoDS_Shape());
+ M.Clear();
+ TopExp::MapShapesAndAncestors(ashape, TopAbs_VERTEX, TopAbs_COMPSOLID, M);
+ if(M.Contains(*vertex))
+ {
+ PRINT_ERROR("Fillet on vertex can only be done on sheet body.\n");
+ return CUBIT_FAILURE;
+ }
+ }
+ //find corresponding faces.
+ DLIList <OCCSurface* > *surfaces = oqe->SurfaceList;
+ for(int k =0 ; k < surfaces->size(); k++)
+ {
+ OCCSurface* occ_face = surfaces->get_and_step();
+ TopoDS_Face* topo_face = occ_face->get_TopoDS_Face();
+ TopExp_Explorer Ex;
+ M.Clear();
+ TopExp::MapShapesAndAncestors(*topo_face, TopAbs_VERTEX, TopAbs_FACE, M);
+ if(!M.Contains(*vertex))
+ continue;
+ face = occ_face;
+ break;
+ }
+ }
+ else
+ face = faces.get_and_step();
+ if(face == NULL)
+ {
+ PRINT_ERROR("Can't find corresponding surface for the vertex.\n");
+ return CUBIT_FAILURE;
+ }
+
if(!is_fillet)
{
//find the two edges sharing the vertex.
Modified: cgm/trunk/geom/OCC/OCCPoint.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCPoint.cpp 2009-03-25 16:40:44 UTC (rev 2745)
+++ cgm/trunk/geom/OCC/OCCPoint.cpp 2009-03-25 19:05:39 UTC (rev 2746)
@@ -247,7 +247,7 @@
{
TopoDS_Edge Edge = TopoDS::Edge(it.Value());
int k = oqe->OCCMap->Find(Edge);
- parents.append((OCCPoint*)(oqe->OccToCGM->find(k))->second);
+ parents.append_unique((OCCPoint*)(oqe->OccToCGM->find(k))->second);
}
}
}
Modified: cgm/trunk/geom/OCC/OCCSurface.cpp
===================================================================
--- cgm/trunk/geom/OCC/OCCSurface.cpp 2009-03-25 16:40:44 UTC (rev 2745)
+++ cgm/trunk/geom/OCC/OCCSurface.cpp 2009-03-25 19:05:39 UTC (rev 2746)
@@ -43,6 +43,7 @@
#include "CubitPointData.hpp"
#include "BRepAlgoAPI_BooleanOperation.hxx"
#include "BRepBuilderAPI_MakeShape.hxx"
+#include "BRepFilletAPI_MakeFillet2d.hxx"
#include "BRepTools_WireExplorer.hxx"
#include "BRep_Tool.hxx"
#include "LocOpe_SplitShape.hxx"
@@ -857,6 +858,7 @@
TopExp::MapShapes(old_surface, TopAbs_WIRE, M);
TopTools_ListOfShape shapes;
+ BRepFilletAPI_MakeFillet2d* test_op = NULL;
for (int ii=1; ii<=M.Extent(); ii++)
{
@@ -864,7 +866,9 @@
TopTools_ListOfShape shapes;
if(op)
{
- shapes.Assign(op->Modified(wire));
+ test_op = dynamic_cast<BRepFilletAPI_MakeFillet2d*>(op);
+ if(!test_op)
+ shapes.Assign(op->Modified(wire));
if(shapes.Extent() == 0)
shapes.Assign(op->Generated(wire));
if(!new_surface.IsNull())
@@ -887,7 +891,7 @@
}
else if(shapes.Extent() > 1)
shape.Nullify();
- else if(op->IsDeleted(wire))
+ else if(op->IsDeleted(wire) || shapes.Extent() == 0)
{
TopTools_IndexedMapOfShape M_new;
TopExp::MapShapes(new_surface, TopAbs_WIRE, M_new);
@@ -946,7 +950,8 @@
//update vertex
TopoDS_Vertex vertex = Ex.CurrentVertex();
- if(op)
+ shapes.Clear();
+ if(op && ! test_op )
shapes.Assign(op->Modified(vertex));
else if(sp)
shapes.Assign(sp->DescendantShapes(vertex));
More information about the cgma-dev
mailing list