* First version of automated colour based boundary conditions for OpenCascade geometry

* Modified the menustat.tcl file to add an entry in the "Special" menu for the colour based boundary properties functionality
* Added the relevant TCL wrapper functions in ngpkg.cpp to enable the above functionality
* Note: The core functionality is implemented in the file "occauxfunctions.cpp"
This commit is contained in:
Philippose Rajan 2009-03-15 12:25:09 +00:00
parent 9d0be8a262
commit 3092d6cb9d
3 changed files with 63 additions and 18 deletions

View File

@ -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

View File

@ -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

View File

@ -18,18 +18,19 @@ The interface between the GUI and the netgen library
#include <linalg.hpp>
#include <csg.hpp>
#ifdef OCCGEOMETRY
#include <occgeom.hpp>
#endif
#include <geometry2d.hpp>
#include <stlgeom.hpp>
#include <meshing.hpp>
#ifdef OCCGEOMETRY
#include <occgeom.hpp>
#include "../libsrc/occ/occauxfunctions.hpp"
#endif
#include <incvis.hpp>
#include <visual.hpp>
#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,6 +4927,9 @@ namespace netgen
(ClientData)NULL,
(Tcl_CmdDeleteProc*) NULL);
Tcl_CreateCommand (interp, "Ng_OCCAutoColourBcProps", Ng_OCCAutoColourBcProps,
(ClientData)NULL,
(Tcl_CmdDeleteProc*) NULL);
// meshing