BatchMesher can be customized by providing user-defined Tcl procedures that run at specific times during the BatchMesher process. These scripts can perform a wide range of tasks.
BatchMesher has the ability to specify user-specified procedures at the following steps for each job:
|
Executed immediately after the job begins, before the input model is imported. |
||
|
Executed immediately after the input model is imported, before the batch mesh begins. Examples include extracting a midsurface or performing a surface offset. |
||
|
Executed immediately after the batch mesh process is complete. Examples include creating solver specific cards, or exporting the mesh in a specific format. |
Access to model-specific variables is possible within user-registered procedures. The array ::hmbm::gVarArray contains variables accessible by the user. The array names and their description are given below:
::hmbm::gVarArray Name |
Description |
cadtype |
The type of model file. |
critername |
The criteria file name, excluding the path. |
criterpath |
The criteria file name, including the path. |
CurrentEventName |
|
modelname |
The input model file name, excluding the path. |
modelpath |
The input model file name, including the path. |
outmodelname |
The output model file name, excluding the path. |
outpath |
The output file path. |
paramname |
The parameter file name, excluding the path. |
parampath |
The parameter file name, including the path. |
POST_BATCHMESH,tclparameters |
The parameters passed to the post-batch mesh procedure. Only available when such a procedure is defined. |
POST_BATCHMESH,tclprocedure |
The post-batch mesh procedure name. Only available when such a procedure is defined. |
POST_BATCHMESH,tclscriptpath |
The post-batch mesh script name, including the path. Only available when such a procedure is defined. |
PRE_BATCHMESH,tclparameters |
The parameters passed to the pre-batch mesh procedure. Only available when such a procedure is defined. |
PRE_BATCHMESH,tclprocedure |
The pre-batch mesh procedure name. Only available when such a procedure is defined. |
PRE_BATCHMESH,tclscriptpath |
The pre-batch mesh script name, including the path. Only available when such a procedure is defined. |
PRE_GEOMETRY_LOAD,tclparameters |
The parameters passed to the pre-geometry load procedure. Only available when such a procedure is defined. |
PRE_GEOMETRY_LOAD,tclprocedure |
The pre-geometry load procedure name. Only available when such a procedure is defined. |
PRE_GEOMETRY_LOAD,tclscriptpath |
The pre-geometry load script name, including the path. Only available when such a procedure is defined. |
resfilename |
The output result file name, excluding the path. |
By default, BatchMesher additionally passes in the name of the model file as the last argument to the Tcl procedures.
It is important to note that the Tcl scripts must not automatically run any procedures, as this is handled by BatchMesher. Doing so will generate an error or unexpected results.
It is also important to remember to save the model after running user procedures, as this is not done automatically. For example:
hm_answernext "yes"
*writefile "$::hmbm::gVarArray(outmodelname)" 0
This example exports the generated mesh to a NASTRAN file named <modelname>.dat in the same directory as the original input model.
proc nastran_export { modelName args } {
set outputDir $::hwbm::gVarArray(modelpath)
set template_dir [ hm_info -appinfo SPECIFIEDPATH TEMPLATES_DIR]
set template [file join $template_dir "feoutput" "nastran" "general"]
*feoutput "$template" ${outputDir}/${modelName}.dat 1 1 1
}
Procedures can also be specified at the run level. This enables you to perform operations such as reading all the batch-meshed parts into a single model, creating properties or materials, or creating connections such as welds between the parts. Customization options at the run level can be set to execute at two points in the batch mesh process:
|
Executed before the first model/job starts. |
||
|
Executed after the last model/job completes. |
In the pre-run and post-run scripts, the model-specific variables are not available.