# CGX to display INP files in realtime as they get generated

**URL:** <https://calculix.discourse.group/t/cgx-to-display-inp-files-in-realtime-as-they-get-generated/2024>\
**Category:** CalculiX GraphiX\
**Created:** [January 17, 2024, 12:47pm UTC](https://calculix.discourse.group/t/cgx-to-display-inp-files-in-realtime-as-they-get-generated/2024 "2024-01-17T12:47:12Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Megidd](https://yyz2.discourse-cdn.com/free1/user_avatar/calculix.discourse.group/megidd/32/1875_2.png) [@Megidd](https://calculix.discourse.group/u/Megidd)\
**Post date:** [January 17, 2024, 12:47pm UTC](https://calculix.discourse.group/t/cgx-to-display-inp-files-in-realtime-as-they-get-generated/2024/1 "2024-01-17T12:47:12Z")

</div>

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

```bash
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:

```bash
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.

```auto
# 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.

---

<div class="post-metadata">

**Author:** ![Megidd](https://yyz2.discourse-cdn.com/free1/user_avatar/calculix.discourse.group/megidd/32/1875_2.png) [@Megidd](https://calculix.discourse.group/u/Megidd)\
**Post date:** [January 19, 2024, 4:09am UTC](https://calculix.discourse.group/t/cgx-to-display-inp-files-in-realtime-as-they-get-generated/2024/2 "2024-01-19T04:09:01Z")

</div>

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

[http://www.dhondt.de/cgx\_2.21.pdf](http://www.dhondt.de/cgx_2.21.pdf)

And also the examples:

> **[GitHub - calculix/CalculiX-Examples: CalculiX examples by Prof. Martin Kraska...](https://github.com/calculix/CalculiX-Examples)**
>
> CalculiX examples by Prof. Martin Kraska from Brandenburg University of Applied Sciences. Excellent starting point to master parametric modelling with CGX and CCX. - GitHub - calculix/CalculiX-Exam...

---

<div class="post-metadata">

**Author:** ![klaus.wittig](https://avatars.discourse-cdn.com/v4/letter/k/4da419/32.png) [@klaus.wittig](https://calculix.discourse.group/u/klaus.wittig)\
**Post date:** [January 20, 2024, 4:57pm UTC](https://calculix.discourse.group/t/cgx-to-display-inp-files-in-realtime-as-they-get-generated/2024/3 "2024-01-20T16:57:42Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Megidd](https://yyz2.discourse-cdn.com/free1/user_avatar/calculix.discourse.group/megidd/32/1875_2.png) [@Megidd](https://calculix.discourse.group/u/Megidd)\
**Post date:** [January 22, 2024, 11:09am UTC](https://calculix.discourse.group/t/cgx-to-display-inp-files-in-realtime-as-they-get-generated/2024/4 "2024-01-22T11:09:59Z")

</div>

Thanks @klaus.wittig 👍

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

---

<div class="post-metadata">

**Author:** ![klaus.wittig](https://avatars.discourse-cdn.com/v4/letter/k/4da419/32.png) [@klaus.wittig](https://calculix.discourse.group/u/klaus.wittig)\
**Post date:** [January 24, 2024, 6:15pm UTC](https://calculix.discourse.group/t/cgx-to-display-inp-files-in-realtime-as-they-get-generated/2024/5 "2024-01-24T18:15:18Z")

</div>

The windows binary can be downloaded from  
[www.calculix.de/cgx\_STATIC.exe](http://www.calculix.de/cgx_STATIC.exe)  
The updated manual  
[www.calculix.de/cgx\_2.22.pdf](http://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.
