CGX to display INP files in realtime as they get generated

I have INP files like below that are created one-by-one.

file001_state1.inp
file002_state1.inp
file003_state1.inp
...
file082_state1.inp
file083_state1.inp
resulting_states.vtk  # as soon as this file is created, it means the process is finished.

Currently, I’m displaying the last file when the process is done:

cgx_STATIC.exe -b file083_state1.inp

Real-time display

I know that I need a CGX script like real-time.fbd to be able to display the INP files one-by-one as they get generated until the file resulting_states.vtk is created which means the process is finished.

# Reading the INP files...
# TODO: How to read files one-by-one as they get generated?
read file001_state1.inp
# ...
read file083_state1.inp

capt i-th iteration
ulin Topology optimization progress

view bg k
view rul off

I wonder if anybody has done it before. A boilerplate FBD script would be great to help me get started. Thanks.

To figure out how to write the CGX script, I’m studying the CGX user manual:

http://www.dhondt.de/cgx_2.21.pdf

And also the examples:

Hello Megidd,
actually you try something which can only be done quite convenient with the next version cgx_2.22 using the ‘while’ command (Someone else had the same problem recently). Up to the current version the ‘while’ command stores everything (command lines, read files, etc.) in the first loop. So even if your code references a new filename in every loop it would not update the lines it had found in the first file. In addition the command ‘test’ allows to ask if a certain file is there (and might search for a certain string in that file). Together with ‘sys’ you can wait a certain time and ask again until it is there and read it then. If you have the possibility to compile the code I could provide it and you can solve that task. If not I could ask Rafal Brzegowy if he has the time to do it for you.

2 Likes

Thanks @klaus.wittig :+1:

If Rafal doesn’t have the opportunity, I would gladly try to build it myself :wrench:

The windows binary can be downloaded from
www.calculix.de/cgx_STATIC.exe
The updated manual
www.calculix.de/cgx_2.22.pdf

Please look into the manual for the details regarding the mentioned commands. There is a ‘while’ example at the end of the manual.

1 Like