* Bug-fix: Fixed loss of OCC face colours after performing a geometry healing run

This commit is contained in:
Philippose Rajan 2009-04-03 20:11:18 +00:00
parent cb777203cf
commit a7f8772932

View File

@ -114,9 +114,6 @@ namespace netgen
double surfacecont = 0;
{
Handle_ShapeBuild_ReShape rebuild = new ShapeBuild_ReShape;
rebuild->Apply(shape);
@ -155,8 +152,20 @@ namespace netgen
for (exp0.Init (shape, TopAbs_FACE); exp0.More(); exp0.Next())
{
// Variable to hold the colour (if there exists one) of
// the current face being processed
Quantity_Color face_colour;
TopoDS_Face face = TopoDS::Face (exp0.Current());
if(face_colours.IsNull()
|| (!(face_colours->GetColor(face,XCAFDoc_ColorSurf,face_colour))))
{
// Set the default face colour to green (Netgen Standard)
// if no colour has been defined for the face
face_colour = Quantity_Color(0.0,1.0,0.0,Quantity_TOC_RGB);
}
sff = new ShapeFix_Face (face);
sff->FixAddNaturalBoundMode() = Standard_True;
sff->FixSmallAreaWireMode() = Standard_True;
@ -184,6 +193,10 @@ namespace netgen
rebuild->Replace(face, newface, Standard_False);
}
// Set the original colour of the face to the newly created
// face (after the healing process)
face_colours->SetColor(face,face_colour,XCAFDoc_ColorSurf);
//delete sff; sff = NULL;
}
shape = rebuild->Apply(shape);
@ -570,16 +583,16 @@ namespace netgen
cout << "Totol surface area : " << newsurfacecont << " (" << surfacecont << ")" << endl;
cout << endl;
// cout << "Write: " << flush;
// char answer;
// cin >> answer;
// if(answer == 'y')
// {
// cout << "Writing VRML" << endl;
// VrmlAPI::Write(shape,"test2.vrml");
// cout << "Writing STL" << endl;
// StlAPI::Write(shape,"test2.stl");
// }
// cout << "Write: " << flush;
// char answer;
// cin >> answer;
// if(answer == 'y')
// {
// cout << "Writing VRML" << endl;
// VrmlAPI::Write(shape,"test2.vrml");
// cout << "Writing STL" << endl;
// StlAPI::Write(shape,"test2.stl");
// }
}