mirror of
https://github.com/NGSolve/netgen.git
synced 2024-12-26 05:50:32 +05:00
* 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:
parent
9d0be8a262
commit
3092d6cb9d
@ -1243,18 +1243,18 @@ namespace netgen
|
|||||||
TDF_LabelSequence step_shapes;
|
TDF_LabelSequence step_shapes;
|
||||||
step_shape_contents->GetShapes(step_shapes);
|
step_shape_contents->GetShapes(step_shapes);
|
||||||
|
|
||||||
/*
|
|
||||||
// List out the available colours in the STEP File as Colour Names
|
// List out the available colours in the STEP File as Colour Names
|
||||||
TDF_LabelSequence allColours;
|
TDF_LabelSequence all_colours;
|
||||||
stepColourContents->GetColors(allColours);
|
step_colour_contents->GetColors(all_colours);
|
||||||
cout << "Number of colours in STEP = " << allColours.Length() << endl;
|
PrintMessage(4,"Number of colours in STEP File: ",all_colours.Length());
|
||||||
for(int i = 1; i <= allColours.Length(); i++)
|
for(int i = 1; i <= all_colours.Length(); i++)
|
||||||
{
|
{
|
||||||
Quantity_Color col;
|
Quantity_Color col;
|
||||||
stepColourContents->GetColor(allColours.Value(i),col);
|
step_colour_contents->GetColor(all_colours.Value(i),col);
|
||||||
cout << "Colour [" << i << "] = " << col.StringName(col.Name()) << endl;
|
PrintMessage(4, "Colour [", i, "] = ",col.StringName(col.Name()));
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
// For the STEP File Reader in OCC, the 1st Shape contains the entire
|
// For the STEP File Reader in OCC, the 1st Shape contains the entire
|
||||||
// compound geometry as one shape
|
// compound geometry as one shape
|
||||||
|
@ -776,7 +776,8 @@ menu .ngmenu.special
|
|||||||
}
|
}
|
||||||
.ngmenu.special add command -label "Helmholtz Mesh grading" \
|
.ngmenu.special add command -label "Helmholtz Mesh grading" \
|
||||||
-command { Ng_HelmholtzMesh; }
|
-command { Ng_HelmholtzMesh; }
|
||||||
|
.ngmenu.special add command -label "Colour-based boundary conditions" \
|
||||||
|
-command { Ng_OCCAutoColourBcProps; redraw }
|
||||||
|
|
||||||
|
|
||||||
# menu .mbar.stl.menu
|
# menu .mbar.stl.menu
|
||||||
|
60
ng/ngpkg.cpp
60
ng/ngpkg.cpp
@ -18,18 +18,19 @@ The interface between the GUI and the netgen library
|
|||||||
#include <linalg.hpp>
|
#include <linalg.hpp>
|
||||||
#include <csg.hpp>
|
#include <csg.hpp>
|
||||||
|
|
||||||
#ifdef OCCGEOMETRY
|
|
||||||
#include <occgeom.hpp>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#include <geometry2d.hpp>
|
#include <geometry2d.hpp>
|
||||||
#include <stlgeom.hpp>
|
#include <stlgeom.hpp>
|
||||||
|
|
||||||
#include <meshing.hpp>
|
#include <meshing.hpp>
|
||||||
|
|
||||||
|
#ifdef OCCGEOMETRY
|
||||||
|
#include <occgeom.hpp>
|
||||||
|
#include "../libsrc/occ/occauxfunctions.hpp"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <incvis.hpp>
|
#include <incvis.hpp>
|
||||||
#include <visual.hpp>
|
#include <visual.hpp>
|
||||||
|
|
||||||
|
|
||||||
#ifdef SOCKETS
|
#ifdef SOCKETS
|
||||||
#include "../libsrc/sockets/sockets.hpp"
|
#include "../libsrc/sockets/sockets.hpp"
|
||||||
#include "../libsrc/sockets/socketmanager.hpp"
|
#include "../libsrc/sockets/socketmanager.hpp"
|
||||||
@ -1539,17 +1540,57 @@ namespace netgen
|
|||||||
Tcl_SetResult (interp, buf, TCL_STATIC);
|
Tcl_SetResult (interp, buf, TCL_STATIC);
|
||||||
}
|
}
|
||||||
return TCL_OK;
|
return TCL_OK;
|
||||||
#else
|
#else // No OCCGEOMETRY
|
||||||
|
|
||||||
Tcl_SetResult (interp, (char *)"Ng_SurfaceMeshSize currently supports only OCC (STEP/IGES) Files", TCL_STATIC);
|
Tcl_SetResult (interp, (char *)"Ng_SurfaceMeshSize currently supports only OCC (STEP/IGES) Files", TCL_STATIC);
|
||||||
return TCL_ERROR;
|
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,
|
int Ng_SetNextTimeStamp (ClientData clientData,
|
||||||
Tcl_Interp * interp,
|
Tcl_Interp * interp,
|
||||||
int argqc, tcl_const char *argv[])
|
int argqc, tcl_const char *argv[])
|
||||||
@ -4886,6 +4927,9 @@ namespace netgen
|
|||||||
(ClientData)NULL,
|
(ClientData)NULL,
|
||||||
(Tcl_CmdDeleteProc*) NULL);
|
(Tcl_CmdDeleteProc*) NULL);
|
||||||
|
|
||||||
|
Tcl_CreateCommand (interp, "Ng_OCCAutoColourBcProps", Ng_OCCAutoColourBcProps,
|
||||||
|
(ClientData)NULL,
|
||||||
|
(Tcl_CmdDeleteProc*) NULL);
|
||||||
|
|
||||||
|
|
||||||
// meshing
|
// meshing
|
||||||
|
Loading…
Reference in New Issue
Block a user