Checks and Corrections
This topic provides information about creating Model Checker custom checks and corrections. Details are provided on how to define checks and corrections in the config file, as well as the corresponding Tcl procedures.
The syntax of the config file is explained in the Config File topic.
- Common checks/corrections - Those which use a common function underneath and can be added across multiple entity types, or across multiple solvers.
- Solver checks/corrections - Those that are unique to a specific solver.
- ::HM::ModelCheck::HyperMesh for common procedures.
- ::HM::ModelCheck::LsDyna for LS-DYNA specific procedures.
- ::HM::ModelCheck::Nastran for Nastran specific procedures.
- ::HM::ModelCheck::OptiStruct for OptiStruct specific procedures.
- ::HM::ModelCheck::RadiossBlock for RADIOSS specific procedures.
For example, a common check might be named ::HM::ModelCheck::HyperMesh::UnusedEntities. A corresponding correction might be named ::HM::ModelCheck::HyperMesh::DeleteUnusedEntities.
Similarly, an LS-DYNA specific check and correction of the same names would be ::HM::ModelCheck::LsDyna::UnusedEntities and ::HM::ModelCheck::LsDyna::DeleteUnusedEntities.
- Common custom check/correction procedures
- <altair_home>/hm/scripts/ModelCheck/HyperMesh/modelcheckmain.tcl - Sources the files that define the common custom checks/corrections.
- Solver custom check/correction procedures
- <altair_home>/hm/scripts/ModelCheck/<solver>/Checks_Corrections/modelcheckmain.tcl - Sources the files that define the <solver> custom checks/corrections.
Syntax
It is recommended to make a copy of the config file from the installation and edit the copy instead of the original, as the original may be overwritten in newer releases. The new version can then be selected in the Model Checker GUI.
/MODCHK/SOLVER/LSDYNA
#=======================================
/MODCHK/GROUP
Property Cards
#---------------------------------------
/MODCHK/CHECK/WARNING/HM::ModelCheck::HyperMesh::UnusedEntities/Props
Unused properties
Unused
/MODCHK/CORRECTION/HM::ModelCheck::HyperMesh::DeleteUnusedEntities
Delete unused properties
#---------------------------------------
/MODCHK/CHECK/ERROR/HM::ModelCheck::LsDyna::CheckTSandTTequalities/Props
Check TS and TT equalities
TsTTChecks
/MODCHK/CORRECTION/ModifyManually
Modify Manually
/MODCHK/CORRECTIONMODE/props/ / /
#---------------------------------------
Notice that the syntax of the checks and corrections is exactly the same as core function checks, aside from the custom name.
By default, custom procedures are searched for in the installation locations described above. While it is possible to add, remove or modify checks and corrections in these above files, the originals may be overwritten in newer releases. Instead, a mechanism is available to define external files that contain the needed procedures, which is described below.
Path
/MODCHK/CHECK/TCLPath/{<PATH>}
/MODCHK/CORRECTION/TCLPath/{<PATH>}
- /{<PATH>}
- The full path and filename of the file to source.
/MODCHK/SOLVER/LSDYNA
#=======================================
/MODCHK/GROUP
Property Cards
#---------------------------------------
/MODCHK/CHECK/TCLPath/{C:/my_common_checks.tcl}
/MODCHK/CHECK/WARNING/HM::ModelCheck::HyperMesh::UnusedEntities/Props
Unused properties
Unused
/MODCHK/CORRECTION/TCLPath/{C:/my_common_checks.tcl}
/MODCHK/CORRECTION/HM::ModelCheck::HyperMesh::DeleteUnusedEntities
Delete unused properties
#---------------------------------------
/MODCHK/CHECK/TCLPath/{C:/my_dyna_checks.tcl}
/MODCHK/CHECK/ERROR/HM::ModelCheck::LsDyna::CheckTSandTTequalities/Props
Check TS and TT equalities
TsTTChecks
/MODCHK/CORRECTION/ModifyManually
Modify Manually
/MODCHK/CORRECTIONMODE/props/ / /
#---------------------------------------
- The Tcl file name should be unique.
- The Tcl check and correction function names should be unique.
- The check display name and correction display name should be unique.
Tcl Procedures
namespace eval :::HM::ModelCheck::HyperMesh {}
proc ::HM::ModelCheck::HyperMesh::UnusedEntities { checkDisplayname } {
#Get the entity type for the check
set entitytype [hm_getmodelcheckenttype $checkDisplayname];
#Find the unused entities of the required type
*EntityPreviewUnused $entitytype 1;
#Set the unused entities found by the check
hm_setmodelcheckresultentids $checkDisplayname 1;
#Set the check status to "run"
hm_setmodelcheckcheckstatus $checkDisplayname 1;
}
proc ::HM::ModelCheck::HyperMesh::DeleteUnusedEntities { checkDisplayname flag mark } {
#Get the entity type for the correction
set entitytype [hm_getmodelcheckenttype $checkDisplayname];
#Get the unused entities found by the check
set resultentids [hm_getmodelcheckresultentids $checkDisplayname];
#Delete the unused entities
hm_createmark $entitytype 1 "by id only" $resultentids;
catch {*deletemark $entitytype 1};
#Set the correction status to "applied"
set correctionDisplayname [hm_getmodelcheckcorrectiondisplayname $checkDisplayname];
hm_setmodelcheckcorrectionstatus $checkDisplayname $correctionDisplayname 1;
}
- You must define the namespace inside of your custom Tcl script. For example: namespace eval ::HM::ModelCheck::LsDyna {}
- The check display name is passed in as an argument to both the check and correction procedures and must be handled accordingly.
- The flag and mark arguments are passed to the correction procedure and must be handled accordingly. The flag will be 0 and the mark will be NULL if the correction should be applied to all entities. Otherwise, flag will be non-zero and the mark will be the ID of the mark containing the entities to which the correction should be applied.
- The check and correction procedures can include any simple or advanced logic that is necessary.
- There are several Model Check APIs that are necessary for creating custom checks/corrections, as used in the example above: