Event procedures |
The structure of problem_type_name.tcl can optionally implement some of these Tcl prototype procedures (and other user-defined procedures). The procedures listed below are automatically called by GiD. Their syntax corresponds to standard Tcl/Tk language:
proc InitGIDProject { dir } {
...body...
}
proc InitGIDPostProcess {} {
...body...
}
proc EndGIDProject {} {
...body...
}
proc EndGiDPostprocess {} {
...body...
}
proc AfterOpenFile { filename format error } {
...body...
}
proc LoadGIDProject { filespd } {
...body...
}
proc SaveGIDProject { filespd } {
...body...
}
proc LoadResultsGIDPostProcess { file } {
...body...
}
proc BeforeMeshGeneration { elementsize } {
...body...
}
proc AfterMeshGeneration { fail } {
...body...
}
proc SelectGIDBatFile { dir basename } {
...body...
set value ...
return $value
}
proc BeforeRunCalculation { batfilename basename dir problemtypedir gidexe args } {
...body...
}
proc AfterRunCalculation { basename dir problemtypedir where error errorfilename } {
...body...
return $value
}
proc ChangedLanguage { language } {
...body...
}
proc BeforeWriteCalcFileGIDProject { file } {
...body...
set value ...
return $value
}
proc AfterWriteCalcFileGIDProject { file error } {
...body...
set value ...
return $value
}
proc AfterTransformProblemType { file oldproblemtype newproblemtype } {
...body...
}
proc LoadFileInGidUnknowExtension { filename } {
...body...
}
- filename: the full name of the file that has been read;
- format: ACIS_FORMAT, CGNS_FORMAT, DXF_FORMAT, GID_BATCH_FORMAT, GID_GEOMETRY_FORMAT, GID_MESH_FORMAT, IGES_FORMAT, NASTRAN_FORMAT, PARASOLID_FORMAT, RHINO_FORMAT, SHAPEFILE_FORMAT, STL_FORMAT, VDA_FORMAT, VRML_FORMAT or 3DSTUDIO_FORMAT;
- error: boolean 0 or 1 to indicate an error when reading.
This procedure must return as a value the alternative pathname of the batch file. For example it is used as a trick to select a different analysis from a list of batch calculation files.
- batfilename: the name of the batch file to be run (see Executing an external program );
- basename: the short name model;
- dir: the full path to the model directory;
- problemtypedir: the full path to the Problem Types directory;
- gidexe: the full path to gid;
- args: an optional list with other arguments.
If it returns nowindow as a value then nothing will be written.
It receives as arguments:
- basename: the short name model;
- dir: the full path to the model directory;
- problemtypedir: the full path to the Problem Types directory;
- where: must be local or remote (remote if it was run in a server machine, using ProcServer);
- error: returns 1 if an calculation error was detected;
- errorfilename: an error filename with some error explanation, or nothing if everything was ok.
If it returns -cancel- as a value then nothing will be written.
- file: the name of the output calculation file.
If it returns -cancel- as a value then the calculation is not invoked.
- file: the name of the output calculation file error: an error code if there is some problem writing the output calculation file.
- file: the name of the model to be transformed;
- oldproblemtype: the name of the previous problem type;
- newproblemtype: the name of the problem type to be transformed.
- filename: the name of dropped file.
Note: To use Tcl to improve the capabilities of writing the calculations file, it is possible to use the command *tcl in the template file (.bas file); see Specific commands for details.