mirror of
https://github.com/NGSolve/netgen.git
synced 2025-01-12 14:10:34 +05:00
* Bug-fix: Fixed loss of OCC face colours after performing a geometry healing run
This commit is contained in:
parent
cb777203cf
commit
a7f8772932
@ -114,9 +114,6 @@ namespace netgen
|
|||||||
|
|
||||||
double surfacecont = 0;
|
double surfacecont = 0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
Handle_ShapeBuild_ReShape rebuild = new ShapeBuild_ReShape;
|
Handle_ShapeBuild_ReShape rebuild = new ShapeBuild_ReShape;
|
||||||
rebuild->Apply(shape);
|
rebuild->Apply(shape);
|
||||||
@ -155,8 +152,20 @@ namespace netgen
|
|||||||
|
|
||||||
for (exp0.Init (shape, TopAbs_FACE); exp0.More(); exp0.Next())
|
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());
|
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 = new ShapeFix_Face (face);
|
||||||
sff->FixAddNaturalBoundMode() = Standard_True;
|
sff->FixAddNaturalBoundMode() = Standard_True;
|
||||||
sff->FixSmallAreaWireMode() = Standard_True;
|
sff->FixSmallAreaWireMode() = Standard_True;
|
||||||
@ -184,6 +193,10 @@ namespace netgen
|
|||||||
rebuild->Replace(face, newface, Standard_False);
|
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;
|
//delete sff; sff = NULL;
|
||||||
}
|
}
|
||||||
shape = rebuild->Apply(shape);
|
shape = rebuild->Apply(shape);
|
||||||
@ -570,16 +583,16 @@ namespace netgen
|
|||||||
cout << "Totol surface area : " << newsurfacecont << " (" << surfacecont << ")" << endl;
|
cout << "Totol surface area : " << newsurfacecont << " (" << surfacecont << ")" << endl;
|
||||||
cout << endl;
|
cout << endl;
|
||||||
|
|
||||||
// cout << "Write: " << flush;
|
// cout << "Write: " << flush;
|
||||||
// char answer;
|
// char answer;
|
||||||
// cin >> answer;
|
// cin >> answer;
|
||||||
// if(answer == 'y')
|
// if(answer == 'y')
|
||||||
// {
|
// {
|
||||||
// cout << "Writing VRML" << endl;
|
// cout << "Writing VRML" << endl;
|
||||||
// VrmlAPI::Write(shape,"test2.vrml");
|
// VrmlAPI::Write(shape,"test2.vrml");
|
||||||
// cout << "Writing STL" << endl;
|
// cout << "Writing STL" << endl;
|
||||||
// StlAPI::Write(shape,"test2.stl");
|
// StlAPI::Write(shape,"test2.stl");
|
||||||
// }
|
// }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user