From 0c3c3f32d173b3f7edcb40f9f6447fae60f02c05 Mon Sep 17 00:00:00 2001 From: Joachim Schoeberl Date: Sun, 1 Feb 2009 23:08:39 +0000 Subject: [PATCH] occ build visualization mesh --- libsrc/occ/occconstruction.cpp | 3 +++ libsrc/occ/occgeom.cpp | 25 ++++++++++++++----------- libsrc/occ/occgeom.hpp | 5 +++-- libsrc/visualization/vsocc.cpp | 6 ++++-- ng/ngpkg.cpp | 10 +++++----- nglib/nglib.cpp | 2 ++ windows/Makefile.am | 3 +-- 7 files changed, 32 insertions(+), 22 deletions(-) diff --git a/libsrc/occ/occconstruction.cpp b/libsrc/occ/occconstruction.cpp index 8da19448..2945a147 100644 --- a/libsrc/occ/occconstruction.cpp +++ b/libsrc/occ/occconstruction.cpp @@ -37,6 +37,7 @@ namespace netgen void OCCConstructGeometry (OCCGeometry & geom) { +#ifdef NOTHING cout << "OCC construction" << endl; BRep_Builder builder; @@ -147,6 +148,8 @@ namespace netgen geom.BuildFMap(); geom.BuildVisualizationMesh(); geom.changed = 1; +#endif + } } diff --git a/libsrc/occ/occgeom.cpp b/libsrc/occ/occgeom.cpp index 770ce1b9..17ee1a60 100644 --- a/libsrc/occ/occgeom.cpp +++ b/libsrc/occ/occgeom.cpp @@ -21,6 +21,8 @@ namespace netgen { + // #include "../visualization/vispar.hpp" + void OCCGeometry :: PrintNrShapes () { @@ -954,19 +956,19 @@ namespace netgen } - void OCCGeometry :: BuildVisualizationMesh () + void OCCGeometry :: BuildVisualizationMesh (double deflection) { - - cout << "Preparing visualization (deflection = " << vispar.occdeflection << ") ... " << flush; - + cout << "Preparing visualization (deflection = " << deflection << ") ... " << flush; BRepTools::Clean (shape); //WriteOCC_STL("test.stl"); - BRepMesh_IncrementalMesh::BRepMesh_IncrementalMesh (shape, vispar.occdeflection, true); + BRepMesh_IncrementalMesh::BRepMesh_IncrementalMesh (shape, deflection, true); cout << "done" << endl; + } - + void OCCGeometry :: CalcBoundingBox () + { Bnd_Box bb; BRepBndLib::Add (shape, bb); @@ -978,8 +980,6 @@ namespace netgen (*testout) << "Bounding Box = [" << p1 << " - " << p2 << "]" << endl; boundingbox = Box<3> (p1,p2); SetCenter(); - - } @@ -1129,7 +1129,8 @@ namespace netgen // - occgeo->BuildVisualizationMesh(); + // occgeo->BuildVisualizationMesh(); + occgeo->CalcBoundingBox(); PrintContents (occgeo); return occgeo; @@ -1196,7 +1197,8 @@ OCCGeometry * LoadOCC_STEP (const char * filename) occgeo->changed = 1; occgeo->BuildFMap(); - occgeo->BuildVisualizationMesh(); + // occgeo->BuildVisualizationMesh(); + occgeo->CalcBoundingBox(); PrintContents (occgeo); return occgeo; @@ -1282,7 +1284,8 @@ OCCGeometry * LoadOCC_STEP (const char * filename) occgeo->changed = 1; occgeo->BuildFMap(); - occgeo->BuildVisualizationMesh(); + // occgeo->BuildVisualizationMesh(); + occgeo->CalcBoundingBox(); PrintContents (occgeo); return occgeo; diff --git a/libsrc/occ/occgeom.hpp b/libsrc/occ/occgeom.hpp index fda4a0ae..a1ba7497 100644 --- a/libsrc/occ/occgeom.hpp +++ b/libsrc/occ/occgeom.hpp @@ -112,7 +112,7 @@ namespace netgen { -#include "../visualization/vispar.hpp" + // #include "../visualization/vispar.hpp" // class VisualizationParameters; // extern VisualizationParameters vispar; @@ -252,7 +252,8 @@ namespace netgen return OCCSurface (TopoDS::Face(fmap(surfi)), PLANESPACE); } - void BuildVisualizationMesh (); + void CalcBoundingBox (); + void BuildVisualizationMesh (double deflection); void RecursiveTopologyTree (const TopoDS_Shape & sh, stringstream & str, diff --git a/libsrc/visualization/vsocc.cpp b/libsrc/visualization/vsocc.cpp index 80877191..ac0fa71d 100644 --- a/libsrc/visualization/vsocc.cpp +++ b/libsrc/visualization/vsocc.cpp @@ -364,8 +364,10 @@ namespace netgen void VisualSceneOCCGeometry :: BuildScene (int zoomall) { - if (occgeometry -> changed == OCCGEOMETRYVISUALIZATIONFULLCHANGE) - { + if (occgeometry -> changed == OCCGEOMETRYVISUALIZATIONFULLCHANGE) + { + occgeometry -> BuildVisualizationMesh (vispar.occdeflection); + center = occgeometry -> Center(); rad = occgeometry -> GetBoundingBox().Diam() / 2; diff --git a/ng/ngpkg.cpp b/ng/ngpkg.cpp index 66e497d1..cc354895 100644 --- a/ng/ngpkg.cpp +++ b/ng/ngpkg.cpp @@ -3980,7 +3980,7 @@ namespace netgen { if (strcmp (argv[1], "buildvisualizationmesh") == 0) { - occgeometry->BuildVisualizationMesh(); + occgeometry->BuildVisualizationMesh(vispar.occdeflection); occgeometry->changed = OCCGEOMETRYVISUALIZATIONHALFCHANGE; } if (strcmp (argv[1], "mesherror") == 0) @@ -3998,7 +3998,7 @@ namespace netgen occgeometry->BuildFMap(); cout << endl << "After operation:" << endl; occgeometry->PrintNrShapes(); - occgeometry->BuildVisualizationMesh(); + occgeometry->BuildVisualizationMesh(vispar.occdeflection); occgeometry->changed = OCCGEOMETRYVISUALIZATIONHALFCHANGE; } if (strcmp (argv[1], "makesolid") == 0) @@ -4009,7 +4009,7 @@ namespace netgen occgeometry->BuildFMap(); cout << endl << "After operation:" << endl; occgeometry->PrintNrShapes(); - occgeometry->BuildVisualizationMesh(); + occgeometry->BuildVisualizationMesh(vispar.occdeflection); occgeometry->changed = OCCGEOMETRYVISUALIZATIONHALFCHANGE; } if (strcmp (argv[1], "upgradetopology") == 0) @@ -4021,7 +4021,7 @@ namespace netgen occgeometry->BuildFMap(); cout << endl << "After operation:" << endl; occgeometry->PrintNrShapes(); - occgeometry->BuildVisualizationMesh(); + occgeometry->BuildVisualizationMesh(vispar.occdeflection); occgeometry->changed = OCCGEOMETRYVISUALIZATIONHALFCHANGE; } if (strcmp (argv[1], "shapehealing") == 0) @@ -4045,7 +4045,7 @@ namespace netgen occgeometry->BuildFMap(); // cout << endl << "After operation:" << endl; // occgeometry->PrintNrShapes(); - occgeometry->BuildVisualizationMesh(); + occgeometry->BuildVisualizationMesh(vispar.occdeflection); occgeometry->changed = OCCGEOMETRYVISUALIZATIONHALFCHANGE; } diff --git a/nglib/nglib.cpp b/nglib/nglib.cpp index afc7a6a9..277ead33 100644 --- a/nglib/nglib.cpp +++ b/nglib/nglib.cpp @@ -42,12 +42,14 @@ namespace netgen #endif +/* // should not be needed (occ currently requires it) namespace netgen { #include "../libsrc/visualization/vispar.hpp" VisualizationParameters vispar; VisualizationParameters :: VisualizationParameters() { ; } } +*/ namespace nglib { diff --git a/windows/Makefile.am b/windows/Makefile.am index 3f2dd05a..5cf45a8f 100644 --- a/windows/Makefile.am +++ b/windows/Makefile.am @@ -1,4 +1,3 @@ -dist_noinst_DATA = netgen.sln netgen.suo netgen.vcproj postBuild_Install.bat -# abc +dist_noinst_DATA = netgen.sln netgen.suo netgen.vcproj netgen_MSVC2005.sln netgen_MSVC2005.suo netgen_MSVC2005.vcproj postBuild_Install.bat