My current recommendation is not force to save (it is easier for the user to do a fast test), is the model is not saved it has name "UNNAMED" and the its files are saved in a temporary location.
Your calculation files can be also written to this temporary folder, and if the user save it with a name all temporary files are written in the selected user location.
You can get this path to save your files with
GidUtils::GetDirectoryModel
(if saved return the name, otherwise the temporary name)
and can know if was saved with a named with
GidUtils::ModelHasName
If do you want in any case to force be saved before calculate can implement for example the event
proc GiD_Event_BeforeWriteCalculationFile { file } {
}
https://gidsimulation.atlassian.net/wik ... ation+file
here can check if was saved, and otherwise call our Tcl procedure
DoProjectSaveAs
to open a file dialog to ask the user.
And about calculation, you can implement the event to detect when the calculation start or finish
proc GiD_Event_BeforeRunCalculation { batfilename basename dir problemtypedir gidexe args } {
}
proc GiD_Event_AfterRunCalculation { basename dir problemtypedir where error errorfilename } {
}
but I think that this is not necessary. GiD will show it own messages, and can show the console (or log file) output of the calculation program, if any in Calculate->View process info... (you must declare this log file in the .bat file, with a special OutPutFile comment, and/or ErrorFile in case of print error messages in other file)