I am using Coreform Cubit 2023.8 on Windows 10.
When I run the following Python script with Python, png file is not created.
When I run from the correponing journal file, then png file is generated.
I am expecting to do it from CLI.
Hello,
have you already tried to run your script with the python that’s delivered with cubit?
you can usually find it in "..\Coreform Cubit 2023.8\bin\python3"
This should normally work and you can start scripting.
I will take a closer look at the problem and get back to you as soon as possible.
Hi @ksugahar – when you’re running from a Python script (or similar “no-graphics” modes) you’ll need to create a graphics window manually to then draw / render the model before hardcopy.
There are several graphics commands that will help you, but the minimal command is:
graphics window create <id>
As you can see in the GIF below, prior to creating the window I can’t hardcopy, as evidenced by test_1.png not existing, but when I create the window (with id=2) a window will pop up (briefly, but note the top of the window says Coreform Cubit 2023.10 (<id>)) and then the hardcopy command works.
The other commands which you may be interested in are:
Note that I got these commands by typing into the command line: graphics window ?. Note that when you run in a nogui or nographics mode I believe that your graphics & display preferences aren’t loaded. However, you can find all the graphics commands by typing graphics ? - which will help you reset some properties (and you may also be interested in color ? for background and default entity colors).
There is one other thing you can do if you don’t want a graphics window popping up.
cubit.init(['cubit', '-driver', 'offscreen'])
This should work except in a couple cases:
Ssh into a mac machine and not being attached to the display.
Ssh into a RHEL7 or older linux machine and not being attached to the display. RHEL8 and newer supports Cubit’s offscreen rendering, even without a display or graphics card.