Problem saving snapshots through bch file

Moderator: GiD Team

Post Reply
jbaiges
Posts: 8
Joined: Thu Dec 11, 2014 12:02 pm

Problem saving snapshots through bch file

Post by jbaiges »

Hi,

I am trying to save an image by invoking gid through a .bch file. The bch file works fine (loads the file, does the cuts, draws the countour) but the images are not saved.

The bch file says:

Mescape Postprocess
Mescape Files Read /home/jbaiges/Joan/Treball/EST/Case33/results/Tenerife_caso33_v1.post.res
Mescape results analysissel ANALYSIS 500
Mescape Results ContourFill TEMPE Mescape results contoptions setmaxoptions setvalue 34.5 Mescape Utilities Redisplay escape escape Mescape results contoptions setminoptions setvalue 20.9 Mescape Utilities Redisplay
Mescape Results ContourFill TEMPE
'HardCopy PNG /home/jbaiges/Joan/Treball/EST/Case33/results

The invocation to gid I use is:
gid -b bchfile.bch
or
gid -b bchfile.bch -n

If I launch gid and then paste the content of the bch file in the gid commandline everything works fine.

Thanks for the help,

Joan
User avatar
escolano
Posts: 1918
Joined: Sun Sep 05, 1982 10:51 pm

Re: Problem saving snapshots through bch file

Post by escolano »

I think that the name of the .png is missing in the batch, you are only setting the path to the folder.
e.g.
instead of
/home/jbaiges/Joan/Treball/EST/Case33/results
use
/home/jbaiges/Joan/Treball/EST/Case33/results/my_image.png

and invoke the batch wiht +g (just after -b) and without the -n
gid -b+g bchfile.bch
because the extra flag -n start GiD without any window, and then without graphical context it is not possible to create any screen image.
and the +g enable graphics to draw the image (I think that graphics are disabled in batch mode by default)

It is possible to use a kind of special 'offscreen' compiled version of GiD, that allow the creation of images without have any graphical context. use it only if you are specially interested in avoid any GiD window but require screen captures. (e.g. to create images for a web server)

gid_offscreen -b+g bchfile.bch -offscreen
User avatar
miguel
Posts: 361
Joined: Thu Sep 25, 2014 9:04 am

Re: Problem saving snapshots through bch file

Post by miguel »

1. if the .png extension is missing, GiD adds it
2. from the command line, if you use gid -b , the graphics are not enabled, you should launch your batch with gid -b+g YourBatch
3. From Gid-->Files-->Import-->batch also graphics are disabled ( this way creating heavy geometries is faster)
4. But you can use Utilities-->Tools-->Read Bacth Window where graphics are enabled, you can see the contents of your batch file and even execute it step by step.

If you want gid to not use any graphics at all, for instance, on a queue cluster or without possible remote visualization, you can use the offscreen version as escolano explained.
jbaiges
Posts: 8
Joined: Thu Dec 11, 2014 12:02 pm

Re: Problem saving snapshots through bch file

Post by jbaiges »

Thank you for the quick response.
The problem was solved after adding the missing -g. The offscreen version also solved the issue.

Joan
Post Reply