From 1b4c7be8766bc5a2ca0e5260b8b1d49175cd841e Mon Sep 17 00:00:00 2001 From: Joachim Schoeberl Date: Fri, 14 Jan 2011 17:03:35 +0000 Subject: [PATCH] occ as shared lib --- libsrc/occ/Makefile.am | 2 +- libsrc/occ/occpkg.cpp | 4 ++-- ng/csgeom.tcl | 5 ----- ng/menustat.tcl | 4 +++- ng/ng.tcl | 13 ++++++++++--- ng/ngpkg.cpp | 10 ++++++++-- ng/occgeom.tcl | 12 +++++++++++- ng/stlgeom.tcl | 3 ++- 8 files changed, 37 insertions(+), 16 deletions(-) diff --git a/libsrc/occ/Makefile.am b/libsrc/occ/Makefile.am index c495cb70..3df9f496 100644 --- a/libsrc/occ/Makefile.am +++ b/libsrc/occ/Makefile.am @@ -14,7 +14,7 @@ AM_CPPFLAGS = -I$(top_srcdir)/libsrc/include $(OCCFLAGS) $(TCL_INCLUDES) METASOURCES = AUTO -noinst_LTLIBRARIES = libocc.la liboccvis.la +lib_LTLIBRARIES = libocc.la liboccvis.la libocc_la_SOURCES = Partition_Inter2d.cxx Partition_Inter3d.cxx \ Partition_Loop.cxx Partition_Loop2d.cxx Partition_Loop3d.cxx Partition_Spliter.cxx \ diff --git a/libsrc/occ/occpkg.cpp b/libsrc/occ/occpkg.cpp index 770b84f7..aeb691e5 100644 --- a/libsrc/occ/occpkg.cpp +++ b/libsrc/occ/occpkg.cpp @@ -15,7 +15,7 @@ #include "vsocc.hpp" -extern "C" int Ng_OCC_Init (Tcl_Interp * interp); +extern "C" int Ng_occ_Init (Tcl_Interp * interp); @@ -958,7 +958,7 @@ namespace netgen using namespace netgen; -int Ng_OCC_Init (Tcl_Interp * interp) +int Ng_occ_Init (Tcl_Interp * interp) { geometryregister.Append (new OCCGeometryRegister); diff --git a/ng/csgeom.tcl b/ng/csgeom.tcl index 64b29bfa..b8cab4d1 100644 --- a/ng/csgeom.tcl +++ b/ng/csgeom.tcl @@ -16,11 +16,6 @@ .ngmenu.geometry add command -label "CSG Properties..." \ -command topleveldialog2 -.ngmenu.geometry add separator - - - - diff --git a/ng/menustat.tcl b/ng/menustat.tcl index eb009272..2a2be74b 100644 --- a/ng/menustat.tcl +++ b/ng/menustat.tcl @@ -62,7 +62,9 @@ menu .ngmenu.file set dirname [file dirname $file] set basefilename [file tail [file rootname $file]] - rebuildoccdialog + if { $hasocc == "yes" } { + rebuildoccdialog + } } } diff --git a/ng/ng.tcl b/ng/ng.tcl index 1369e5ad..c706b1f1 100644 --- a/ng/ng.tcl +++ b/ng/ng.tcl @@ -12,6 +12,8 @@ if {[catch {package require Tix } result ]} { + + # userlevel 1..standard user 2..power-user 3..developer set userlevel 3 @@ -84,7 +86,10 @@ catch { source ${ngdir}/csgeom.tcl source ${ngdir}/stlgeom.tcl -source ${ngdir}/occgeom.tcl + +set hasocc no +catch { source ${ngdir}/occgeom.tcl } + source ${ngdir}/acisgeom.tcl @@ -107,7 +112,7 @@ catch { set zugstange 0 -catch { source ${ngdir}/trafo/menu.tcl } +catch { source ${ngdir}/trafo/menu.tcl } @@ -118,10 +123,12 @@ Ng_SetVisParameters Ng_SetDebugParameters Ng_STLDoctor Ng_GeometryOptions set -catch { + +if { $hasocc == "yes" } { Ng_SetOCCVisParameters } + if { $batchmode != "defined" } { catch { wm protocol . WM_DELETE_WINDOW { .ngmenu.file invoke "Quit" } diff --git a/ng/ngpkg.cpp b/ng/ngpkg.cpp index 50e0380d..9688b295 100644 --- a/ng/ngpkg.cpp +++ b/ng/ngpkg.cpp @@ -3074,7 +3074,11 @@ namespace netgen extern "C" int Ng_Init (Tcl_Interp * interp); extern "C" int Ng_CSG_Init (Tcl_Interp * interp); extern "C" int Ng_STL_Init (Tcl_Interp * interp); - extern "C" int Ng_OCC_Init (Tcl_Interp * interp); + +#ifdef OCCGEOMETRY + // extern "C" int Ng_occ_Init (Tcl_Interp * interp); +#endif + extern "C" int Ng_Geom2d_Init (Tcl_Interp * interp); // int main_Eero (ClientData clientData, @@ -3091,9 +3095,11 @@ namespace netgen Ng_CSG_Init(interp); Ng_STL_Init(interp); + #ifdef OCCGEOMETRY - Ng_OCC_Init(interp); + // Ng_occ_Init(interp); #endif + Ng_Geom2d_Init(interp); tcl_interp = interp; diff --git a/ng/occgeom.tcl b/ng/occgeom.tcl index 9061aadc..d18a8a9e 100644 --- a/ng/occgeom.tcl +++ b/ng/occgeom.tcl @@ -1,8 +1,18 @@ +if { [catch { load liboccvis[info sharedlibextension] Ng_OCC } result ] } { +# puts "cannot load occ" +# puts "error: $result" +} { + puts "OCC module loaded" + set hasocc yes +} + + +.ngmenu.geometry add separator + .ngmenu.geometry add command -label "IGES/STEP Topology Explorer/Doctor..." \ -command { occdialog; } - # Philippose - 30/01/2009 # Add menu item for local face mesh size definition in the # TCL Gui diff --git a/ng/stlgeom.tcl b/ng/stlgeom.tcl index df47e21e..664805f0 100644 --- a/ng/stlgeom.tcl +++ b/ng/stlgeom.tcl @@ -1,3 +1,5 @@ +.ngmenu.geometry add separator + .ngmenu.geometry add command -label "STL Doctor..." \ -command { stldoctordialog; } @@ -17,4 +19,3 @@ tk_messageBox -title "STL Info" -message $msgtext -type ok } -.ngmenu.geometry add separator