Take screenshots of finite element results

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

Question

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

1 Like

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

3 Likes

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.

wbr

2 Likes

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

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

2 Likes

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

I adjusted this line:

# 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:

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 :white_check_mark: :+1: But for some reason the final PNG files are not saved, along with this error:

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

2023-09-08 09_40_45-Select Command Prompt

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 :slight_smile:

I’m studying CGX 2.19 documentation about PNG hardcopy:

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:thinking: :roll_eyes: I will try…

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

is the command not like these: hcpy png ?

image

1 Like

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

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 :white_check_mark:

1 Like

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 :mag:

1 Like

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.

3 Likes

Great, thanks :+1: I didn’t notice. I’m going to study them :white_check_mark:

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

2 Likes