diff --git a/libsrc/occ/occgeom.cpp b/libsrc/occ/occgeom.cpp index 61603216..566c3f69 100644 --- a/libsrc/occ/occgeom.cpp +++ b/libsrc/occ/occgeom.cpp @@ -1243,18 +1243,18 @@ namespace netgen TDF_LabelSequence step_shapes; step_shape_contents->GetShapes(step_shapes); - /* + // List out the available colours in the STEP File as Colour Names - TDF_LabelSequence allColours; - stepColourContents->GetColors(allColours); - cout << "Number of colours in STEP = " << allColours.Length() << endl; - for(int i = 1; i <= allColours.Length(); i++) + TDF_LabelSequence all_colours; + step_colour_contents->GetColors(all_colours); + PrintMessage(4,"Number of colours in STEP File: ",all_colours.Length()); + for(int i = 1; i <= all_colours.Length(); i++) { Quantity_Color col; - stepColourContents->GetColor(allColours.Value(i),col); - cout << "Colour [" << i << "] = " << col.StringName(col.Name()) << endl; + step_colour_contents->GetColor(all_colours.Value(i),col); + PrintMessage(4, "Colour [", i, "] = ",col.StringName(col.Name())); } - */ + // For the STEP File Reader in OCC, the 1st Shape contains the entire // compound geometry as one shape diff --git a/ng/menustat.tcl b/ng/menustat.tcl index 1ab2251b..8dceef98 100644 --- a/ng/menustat.tcl +++ b/ng/menustat.tcl @@ -776,7 +776,8 @@ menu .ngmenu.special } .ngmenu.special add command -label "Helmholtz Mesh grading" \ -command { Ng_HelmholtzMesh; } - +.ngmenu.special add command -label "Colour-based boundary conditions" \ + -command { Ng_OCCAutoColourBcProps; redraw } # menu .mbar.stl.menu diff --git a/ng/ngpkg.cpp b/ng/ngpkg.cpp index cc354895..c7ab455a 100644 --- a/ng/ngpkg.cpp +++ b/ng/ngpkg.cpp @@ -18,18 +18,19 @@ The interface between the GUI and the netgen library #include #include -#ifdef OCCGEOMETRY -#include -#endif - - #include #include - #include + +#ifdef OCCGEOMETRY +#include +#include "../libsrc/occ/occauxfunctions.hpp" +#endif + #include #include + #ifdef SOCKETS #include "../libsrc/sockets/sockets.hpp" #include "../libsrc/sockets/socketmanager.hpp" @@ -1539,17 +1540,57 @@ namespace netgen Tcl_SetResult (interp, buf, TCL_STATIC); } return TCL_OK; -#else +#else // No OCCGEOMETRY Tcl_SetResult (interp, (char *)"Ng_SurfaceMeshSize currently supports only OCC (STEP/IGES) Files", TCL_STATIC); return TCL_ERROR; -#endif +#endif // OCCGEOMETRY } + // Philippose - 10/03/2009 + // TCL interface function for the Automatic Colour-based + // definition of boundary conditions for OCC Geometry + int Ng_OCCAutoColourBcProps (ClientData clientData, + Tcl_Interp * interp, + int argc, tcl_const char *argv[]) + { +#ifdef OCCGEOMETRY + + if(!mesh.Ptr()) + { + Tcl_SetResult (interp, (char *)"Ng_OCCAutoColourBcProps: Valid netgen mesh required...please mesh the OCC Geometry first", TCL_STATIC); + return TCL_ERROR; + } + + if (!occgeometry) + { + Tcl_SetResult (interp, (char *)"Ng_OCCAutoColourBcProps: Currently supports only OCC (STEP/IGES) Geometry", TCL_STATIC); + return TCL_ERROR; + } + + if(occgeometry->face_colours.IsNull()) + { + Tcl_SetResult (interp, (char *)"Ng_OCCAutoColourBcProps: No colour data detected in the current OCC Geometry", TCL_STATIC); + return TCL_ERROR; + } + + OCCAutoColourBcProps(*mesh, *occgeometry); + + return TCL_OK; +#else + + Tcl_SetResult (interp, (char *)"Ng_OCCAutoColourBcProps currently supports only OCC (STEP/IGES) Geometry", TCL_STATIC); + return TCL_ERROR; + +#endif // OCCGEOMETRY + } + + + int Ng_SetNextTimeStamp (ClientData clientData, Tcl_Interp * interp, int argqc, tcl_const char *argv[]) @@ -4886,7 +4927,10 @@ namespace netgen (ClientData)NULL, (Tcl_CmdDeleteProc*) NULL); - + Tcl_CreateCommand (interp, "Ng_OCCAutoColourBcProps", Ng_OCCAutoColourBcProps, + (ClientData)NULL, + (Tcl_CmdDeleteProc*) NULL); + // meshing Tcl_CreateCommand (interp, "Ng_GenerateMesh", Ng_GenerateMesh,