I’m writing a TCL script that will be executed in the following scenario: in HyperView, once a model and its results are loaded.
It should behave as follows:
Retrieve the path of the loaded model, open a second window in the same instance, switch to HyperMesh, and import the model.
The script doesn’t return any error message; however, when I test it, it imports the model into HyperMesh, but then it disappears right after. If I run the script a second time, the model is imported and stays. I’m having trouble understanding why the script behaves this way.
Do you have any idea where my mistake might be?
My script :
catch {result_ctrl ReleaseHandle}
catch {model_handle ReleaseHandle}
catch {client ReleaseHandle}
catch {win ReleaseHandle}
catch {page ReleaseHandle}
catch {proj ReleaseHandle}
catch {sess ReleaseHandle}
catch {sess ReleaseHandle}
hwi OpenStack
hwi GetSessionHandle sess
sess GetProjectHandle proj
proj GetPageHandle page 1
page GetWindowHandle win 1
win GetClientHandle client
set modelID [client GetActiveModel]
client GetModelHandle model $modelID
set modelFilePath [model GetFileName]
puts "Chemin du modele charge : $modelFilePath"
hwc hwd page current layout=1
hwc hwd page current activewindow=2
hwc hwd window index=2 type=HyperMesh
*createstringarray 3 "Optistruct " " " "IMPORT_BY1COMP"
*feinputwithdata2 "\#optistruct\\optistruct" "$modelFilePath" 0 0 0 0 0 1 3 1 0
puts "DONE"
model ReleaseHandle
client ReleaseHandle
win ReleaseHandle
page ReleaseHandle
proj ReleaseHandle
sess ReleaseHandle
hwi CloseStack
Thanks in advance,
Best regards,
Thomas