# Take screenshots of finite element results

**URL:** <https://calculix.discourse.group/t/take-screenshots-of-finite-element-results/1793>\
**Category:** Uncategorized\
**Created:** [September 5, 2023, 12:04pm UTC](https://calculix.discourse.group/t/take-screenshots-of-finite-element-results/1793 "2023-09-05T12:04:25Z")\
**Posts on this page:** 13\
**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:** [September 5, 2023, 12:04pm UTC](https://calculix.discourse.group/t/take-screenshots-of-finite-element-results/1793/1 "2023-09-05T12:04:25Z")

</div>

I have a `result.frd` file containing the finite element results. I want to programmatically take screenshots of the _von Mises stress_ at different views like this:

1. Top.
2. Bottom.
3. Left.
4. Right.
5. Front.
6. Back.

I want to have a max zoom. I mean, the screenshots are preferred to be auto-filled. For example, the final screenshots would look like this:

 ![2023-09-05 15_32_25-_New document 1 - Inkscape](https://global.discourse-cdn.com/free1/uploads/calculix/original/2X/9/9ad757a326eca5b05d984f4c41f6201d8c00c166.png)

# Question

Is it possible to do it programmatically by CGX or PrePoMax? I mean by running their executables and passing some arguments?

---

<div class="post-metadata">

**Author:** ![Calc\_em](https://avatars.discourse-cdn.com/v4/letter/c/43a26b/32.png) [@Calc\_em](https://calculix.discourse.group/u/Calc_em)\
**Post date:** [September 5, 2023, 12:45pm UTC](https://calculix.discourse.group/t/take-screenshots-of-finite-element-results/1793/2 "2023-09-05T12:45:50Z")

</div>

PrePoMax doesn’t have such a functionality. Maybe ParaView would be the best choice for this purpose.

---

<div class="post-metadata">

**Author:** ![dichtstoff](https://avatars.discourse-cdn.com/v4/letter/d/dec6dc/32.png) [@dichtstoff](https://calculix.discourse.group/u/dichtstoff)\
**Post date:** [September 5, 2023, 12:51pm UTC](https://calculix.discourse.group/t/take-screenshots-of-finite-element-results/1793/3 "2023-09-05T12:51:27Z")

</div>

Hello,  
you can use maybe cgx for such things,  
create a fbd file and put these first:

read example.frd  
read example.inp inp nom

and add your commands

#view elem  
#view sh

#view disp  
#scal d 5

#plot fv all

please check out example from mr. kraska:

[GitHub - 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.](https://github.com/calculix/CalculiX-Examples)

wbr

---

<div class="post-metadata">

**Author:** ![rsmith](https://yyz2.discourse-cdn.com/free1/user_avatar/calculix.discourse.group/rsmith/32/1684_2.png) [@rsmith](https://calculix.discourse.group/u/rsmith)\
**Post date:** [September 5, 2023, 6:45pm UTC](https://calculix.discourse.group/t/take-screenshots-of-finite-element-results/1793/4 "2023-09-05T18:45:42Z")

</div>

> [@Megidd](#):
>
> Is it possible to do it programmatically by CGX

Yes. Write a CGX input file like this (e.g. `pictures.fbd`):

```auto
# Change file name to the job name you used.
read result.frd

# Data set number depends on how may things you saved!
ds 4 e 7

rot y
frame
hcpy png right
rot r 90
frame
hcpy png front
rot r 90
frame
hcpy png left
rot r 90
frame
hcpy png back
rot y
rot u 90
frame
hcpy png top
rot d 180
frame
hcpy png bottom

quit

```

Then run `cgx -b pictures.fbd`.

---

<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:** [September 8, 2023, 6:15am UTC](https://calculix.discourse.group/t/take-screenshots-of-finite-element-results/1793/5 "2023-09-08T06:15:30Z")

</div>

Thanks. Your script is a great point for me to start.

I adjusted this line:

```auto
# Data set number depends on how many things you saved!
ds 2 e 7

```

# Error with CGX `2.10`

I’m receiving this error with CGX version `2.10` on a Windows machine:

```auto
key:HARDCOPY from string hardcopy png bottom not known
 key:QUIT from string quit not known
 done

```

# CGX `2.19`

With CGX `2.19` the rotations are great. I can see that all 6 views are properly rotated ✅ 👍 But for some reason the final PNG files are not saved, along with this error:

```auto
key:HARDCOPY from string hardcopy png bottom not known
 key:QUIT from string quit not known

```

 ![2023-09-08 09_44_03-CalculiX GraphiX](https://global.discourse-cdn.com/free1/uploads/calculix/original/2X/5/516051a925f841ea5eb9dbb2cdc87a153397c80a.png)

 ![2023-09-08 09_40_45-Select Command Prompt](https://global.discourse-cdn.com/free1/uploads/calculix/original/2X/c/cf5ae85ebfcac4c8b22f1e65f6c7f4c2cd033775.png)

# Latest version of CGX?

I couldn’t find the latest version of CGX yet for Windows OS. If I find them, or if I build them, I will test them. Maybe the `HARDCOPY` and `QUIT` keywords of the script are available on the latest version of CGX 🙂

---

<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:** [September 8, 2023, 6:24am UTC](https://calculix.discourse.group/t/take-screenshots-of-finite-element-results/1793/6 "2023-09-08T06:24:40Z")

</div>

I’m studying CGX `2.19` documentation about PNG hardcopy:

 ![2023-09-08 09_51_33-cgx_2.19.pdf — Mozilla Firefox](https://global.discourse-cdn.com/free1/uploads/calculix/original/2X/6/6ce2716f547dd580a1118d91fe8441568f9ff762.png)

> 7.12.4 Png-Hardcopy  
> To create a window dump in png format. The program convert must be installed.

Maybe the command syntax is a bit different, or I have to install `convert`… 🤔 🙄 I will try…

---

<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:** [September 8, 2023, 6:29am UTC](https://calculix.discourse.group/t/take-screenshots-of-finite-element-results/1793/7 "2023-09-08T06:29:37Z")

</div>

Looks like the command I’m looking for is actually `hcpy`:

 ![2023-09-08 09_58_24-cgx_2.19.pdf — Mozilla Firefox](https://global.discourse-cdn.com/free1/uploads/calculix/original/2X/e/e0976218548574eae6dc0bdb060367d9bf8f63d7.png)

---

<div class="post-metadata">

**Author:** ![dichtstoff](https://avatars.discourse-cdn.com/v4/letter/d/dec6dc/32.png) [@dichtstoff](https://calculix.discourse.group/u/dichtstoff)\
**Post date:** [September 8, 2023, 6:31am UTC](https://calculix.discourse.group/t/take-screenshots-of-finite-element-results/1793/8 "2023-09-08T06:31:39Z")

</div>

is the command not like these: hcpy png ?

![image](https://global.discourse-cdn.com/free1/uploads/calculix/original/2X/4/472bae2d5059a2a4a51b607409dc29c4f5bfb9e2.png)

---

<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:** [September 8, 2023, 6:54am UTC](https://calculix.discourse.group/t/take-screenshots-of-finite-element-results/1793/9 "2023-09-08T06:54:04Z")

</div>

Finally, using `hcpy` command and installing `ImageMagick` along with its legacy utilities like `convert.exe`, `composite.exe`, etc. created the PNGs I wanted:

![2023-09-08 10_19_03-_New document 1 - Inkscape](https://global.discourse-cdn.com/free1/uploads/calculix/original/2X/d/d34fc43fe0c1988d97699d96c13223e641d1eb94.png)

I will study CGX documentation further. Maybe I can also control what sections of the legend and color spectrum are displayed and so on. But for now, it’s great ✅

---

<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:** [September 8, 2023, 7:01am UTC](https://calculix.discourse.group/t/take-screenshots-of-finite-element-results/1793/10 "2023-09-08T07:01:20Z")

</div>

# Quit

For some reason, the `exit`, `quit`, `q`, and `terminate` commands don’t work. I’m studying the documentation to see how to terminate the FBD script and to close the accompanying CGX window 🔍

---

<div class="post-metadata">

**Author:** ![dichtstoff](https://avatars.discourse-cdn.com/v4/letter/d/dec6dc/32.png) [@dichtstoff](https://calculix.discourse.group/u/dichtstoff)\
**Post date:** [September 8, 2023, 7:04am UTC](https://calculix.discourse.group/t/take-screenshots-of-finite-element-results/1793/11 "2023-09-08T07:04:36Z")

</div>

good resources are examples from mr. kraska,

[GitHub - 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.](https://github.com/calculix/CalculiX-Examples/tree/master)

---

<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:** [September 8, 2023, 7:07am UTC](https://calculix.discourse.group/t/take-screenshots-of-finite-element-results/1793/12 "2023-09-08T07:07:17Z")

</div>

Great, thanks 👍 I didn’t notice. I’m going to study them ✅

---

<div class="post-metadata">

**Author:** ![rsmith](https://yyz2.discourse-cdn.com/free1/user_avatar/calculix.discourse.group/rsmith/32/1684_2.png) [@rsmith](https://calculix.discourse.group/u/rsmith)\
**Post date:** [September 8, 2023, 8:40am UTC](https://calculix.discourse.group/t/take-screenshots-of-finite-element-results/1793/13 "2023-09-08T08:40:24Z")

</div>

> [@Megidd](#):
>
> `key:HARDCOPY from string hardcopy png bottom not known`

That was a mistake on my part; it should be `hcpy`. I’ve edited my original answer
