occ build visualization mesh

This commit is contained in:
Joachim Schoeberl 2009-02-01 23:08:39 +00:00
parent 8a64f004a9
commit 0c3c3f32d1
7 changed files with 32 additions and 22 deletions

View File

@ -37,6 +37,7 @@ namespace netgen
void OCCConstructGeometry (OCCGeometry & geom) void OCCConstructGeometry (OCCGeometry & geom)
{ {
#ifdef NOTHING
cout << "OCC construction" << endl; cout << "OCC construction" << endl;
BRep_Builder builder; BRep_Builder builder;
@ -147,6 +148,8 @@ namespace netgen
geom.BuildFMap(); geom.BuildFMap();
geom.BuildVisualizationMesh(); geom.BuildVisualizationMesh();
geom.changed = 1; geom.changed = 1;
#endif
} }
} }

View File

@ -21,6 +21,8 @@
namespace netgen namespace netgen
{ {
// #include "../visualization/vispar.hpp"
void OCCGeometry :: PrintNrShapes () void OCCGeometry :: PrintNrShapes ()
{ {
@ -954,19 +956,19 @@ namespace netgen
} }
void OCCGeometry :: BuildVisualizationMesh () void OCCGeometry :: BuildVisualizationMesh (double deflection)
{ {
cout << "Preparing visualization (deflection = " << deflection << ") ... " << flush;
cout << "Preparing visualization (deflection = " << vispar.occdeflection << ") ... " << flush;
BRepTools::Clean (shape); BRepTools::Clean (shape);
//WriteOCC_STL("test.stl"); //WriteOCC_STL("test.stl");
BRepMesh_IncrementalMesh::BRepMesh_IncrementalMesh (shape, vispar.occdeflection, true); BRepMesh_IncrementalMesh::BRepMesh_IncrementalMesh (shape, deflection, true);
cout << "done" << endl; cout << "done" << endl;
}
void OCCGeometry :: CalcBoundingBox ()
{
Bnd_Box bb; Bnd_Box bb;
BRepBndLib::Add (shape, bb); BRepBndLib::Add (shape, bb);
@ -978,8 +980,6 @@ namespace netgen
(*testout) << "Bounding Box = [" << p1 << " - " << p2 << "]" << endl; (*testout) << "Bounding Box = [" << p1 << " - " << p2 << "]" << endl;
boundingbox = Box<3> (p1,p2); boundingbox = Box<3> (p1,p2);
SetCenter(); SetCenter();
} }
@ -1129,7 +1129,8 @@ namespace netgen
// //
occgeo->BuildVisualizationMesh(); // occgeo->BuildVisualizationMesh();
occgeo->CalcBoundingBox();
PrintContents (occgeo); PrintContents (occgeo);
return occgeo; return occgeo;
@ -1196,7 +1197,8 @@ OCCGeometry * LoadOCC_STEP (const char * filename)
occgeo->changed = 1; occgeo->changed = 1;
occgeo->BuildFMap(); occgeo->BuildFMap();
occgeo->BuildVisualizationMesh(); // occgeo->BuildVisualizationMesh();
occgeo->CalcBoundingBox();
PrintContents (occgeo); PrintContents (occgeo);
return occgeo; return occgeo;
@ -1282,7 +1284,8 @@ OCCGeometry * LoadOCC_STEP (const char * filename)
occgeo->changed = 1; occgeo->changed = 1;
occgeo->BuildFMap(); occgeo->BuildFMap();
occgeo->BuildVisualizationMesh(); // occgeo->BuildVisualizationMesh();
occgeo->CalcBoundingBox();
PrintContents (occgeo); PrintContents (occgeo);
return occgeo; return occgeo;

View File

@ -112,7 +112,7 @@
namespace netgen namespace netgen
{ {
#include "../visualization/vispar.hpp" // #include "../visualization/vispar.hpp"
// class VisualizationParameters; // class VisualizationParameters;
// extern VisualizationParameters vispar; // extern VisualizationParameters vispar;
@ -252,7 +252,8 @@ namespace netgen
return OCCSurface (TopoDS::Face(fmap(surfi)), PLANESPACE); return OCCSurface (TopoDS::Face(fmap(surfi)), PLANESPACE);
} }
void BuildVisualizationMesh (); void CalcBoundingBox ();
void BuildVisualizationMesh (double deflection);
void RecursiveTopologyTree (const TopoDS_Shape & sh, void RecursiveTopologyTree (const TopoDS_Shape & sh,
stringstream & str, stringstream & str,

View File

@ -364,8 +364,10 @@ namespace netgen
void VisualSceneOCCGeometry :: BuildScene (int zoomall) void VisualSceneOCCGeometry :: BuildScene (int zoomall)
{ {
if (occgeometry -> changed == OCCGEOMETRYVISUALIZATIONFULLCHANGE) if (occgeometry -> changed == OCCGEOMETRYVISUALIZATIONFULLCHANGE)
{ {
occgeometry -> BuildVisualizationMesh (vispar.occdeflection);
center = occgeometry -> Center(); center = occgeometry -> Center();
rad = occgeometry -> GetBoundingBox().Diam() / 2; rad = occgeometry -> GetBoundingBox().Diam() / 2;

View File

@ -3980,7 +3980,7 @@ namespace netgen
{ {
if (strcmp (argv[1], "buildvisualizationmesh") == 0) if (strcmp (argv[1], "buildvisualizationmesh") == 0)
{ {
occgeometry->BuildVisualizationMesh(); occgeometry->BuildVisualizationMesh(vispar.occdeflection);
occgeometry->changed = OCCGEOMETRYVISUALIZATIONHALFCHANGE; occgeometry->changed = OCCGEOMETRYVISUALIZATIONHALFCHANGE;
} }
if (strcmp (argv[1], "mesherror") == 0) if (strcmp (argv[1], "mesherror") == 0)
@ -3998,7 +3998,7 @@ namespace netgen
occgeometry->BuildFMap(); occgeometry->BuildFMap();
cout << endl << "After operation:" << endl; cout << endl << "After operation:" << endl;
occgeometry->PrintNrShapes(); occgeometry->PrintNrShapes();
occgeometry->BuildVisualizationMesh(); occgeometry->BuildVisualizationMesh(vispar.occdeflection);
occgeometry->changed = OCCGEOMETRYVISUALIZATIONHALFCHANGE; occgeometry->changed = OCCGEOMETRYVISUALIZATIONHALFCHANGE;
} }
if (strcmp (argv[1], "makesolid") == 0) if (strcmp (argv[1], "makesolid") == 0)
@ -4009,7 +4009,7 @@ namespace netgen
occgeometry->BuildFMap(); occgeometry->BuildFMap();
cout << endl << "After operation:" << endl; cout << endl << "After operation:" << endl;
occgeometry->PrintNrShapes(); occgeometry->PrintNrShapes();
occgeometry->BuildVisualizationMesh(); occgeometry->BuildVisualizationMesh(vispar.occdeflection);
occgeometry->changed = OCCGEOMETRYVISUALIZATIONHALFCHANGE; occgeometry->changed = OCCGEOMETRYVISUALIZATIONHALFCHANGE;
} }
if (strcmp (argv[1], "upgradetopology") == 0) if (strcmp (argv[1], "upgradetopology") == 0)
@ -4021,7 +4021,7 @@ namespace netgen
occgeometry->BuildFMap(); occgeometry->BuildFMap();
cout << endl << "After operation:" << endl; cout << endl << "After operation:" << endl;
occgeometry->PrintNrShapes(); occgeometry->PrintNrShapes();
occgeometry->BuildVisualizationMesh(); occgeometry->BuildVisualizationMesh(vispar.occdeflection);
occgeometry->changed = OCCGEOMETRYVISUALIZATIONHALFCHANGE; occgeometry->changed = OCCGEOMETRYVISUALIZATIONHALFCHANGE;
} }
if (strcmp (argv[1], "shapehealing") == 0) if (strcmp (argv[1], "shapehealing") == 0)
@ -4045,7 +4045,7 @@ namespace netgen
occgeometry->BuildFMap(); occgeometry->BuildFMap();
// cout << endl << "After operation:" << endl; // cout << endl << "After operation:" << endl;
// occgeometry->PrintNrShapes(); // occgeometry->PrintNrShapes();
occgeometry->BuildVisualizationMesh(); occgeometry->BuildVisualizationMesh(vispar.occdeflection);
occgeometry->changed = OCCGEOMETRYVISUALIZATIONHALFCHANGE; occgeometry->changed = OCCGEOMETRYVISUALIZATIONHALFCHANGE;
} }

View File

@ -42,12 +42,14 @@ namespace netgen
#endif #endif
/*
// should not be needed (occ currently requires it) // should not be needed (occ currently requires it)
namespace netgen { namespace netgen {
#include "../libsrc/visualization/vispar.hpp" #include "../libsrc/visualization/vispar.hpp"
VisualizationParameters vispar; VisualizationParameters vispar;
VisualizationParameters :: VisualizationParameters() { ; } VisualizationParameters :: VisualizationParameters() { ; }
} }
*/
namespace nglib { namespace nglib {

View File

@ -1,4 +1,3 @@
dist_noinst_DATA = netgen.sln netgen.suo netgen.vcproj postBuild_Install.bat dist_noinst_DATA = netgen.sln netgen.suo netgen.vcproj netgen_MSVC2005.sln netgen_MSVC2005.suo netgen_MSVC2005.vcproj postBuild_Install.bat
# abc