Hi, I'm using Windows(OS).
I want to take a snapshot in my new toplevel widgets (having a canvas widgets).
And i find Gid Script(proc takesnapshot in PostWidgets.tcl),
So i want make extension proc about takesnapshot in my scripts.
Can you help me?
take snapshot in GiD
Moderator: GiD Team
Re: take snapshot in GiD
You can try to create an 'img' object with our procedure defined in 'dev_kit.tcl'
(but maybe it only works depending on your graphic card or the OpenGl mode by hardware or software)
GidUtils::CaptureWindow $w
where w is the tk name of your toplevel or your canvas
set x [GidUtils::CaptureWindow $w]
and for example you can save it to disk with something like this
$x write $filename -format PNG
(but maybe it only works depending on your graphic card or the OpenGl mode by hardware or software)
GidUtils::CaptureWindow $w
where w is the tk name of your toplevel or your canvas
set x [GidUtils::CaptureWindow $w]
and for example you can save it to disk with something like this
$x write $filename -format PNG
Re: take snapshot in GiD
I'm trying GidUtils::CaptureWindow procedure.
and occured error "Window not mapped while creating image "
This problem is solved using "update" keyword helpful.
But, maked file (.png file) nothing to draw.
reference my stackoverflow question helpful.
https://stackoverflow.com/questions/516 ... ble-in-tcl
Maybe this problem relevant your mentioned about OpenGL?
and occured error "Window not mapped while creating image "
This problem is solved using "update" keyword helpful.
But, maked file (.png file) nothing to draw.
reference my stackoverflow question helpful.
https://stackoverflow.com/questions/516 ... ble-in-tcl
Maybe this problem relevant your mentioned about OpenGL?
Re: take snapshot in GiD
I have tried, for example creating a mesh of triangles, opening the Mesh->Quality window and capturing the image of the mesh quality canvas, with a code like this:
set x [GidUtils::CaptureWindow .gid.meshq.f.nb.fTriangle.c]
$x write {C:\temp\mesh_quality.png} -format PNG
or this
set x [image create photo -format window -data .gid.meshq.f.nb.fTriangle.c]
$x write {C:\temp\mesh_quality.png} -format PNG
and the image was created, but corrupted (only the upper part of the image was properly filled)
It seems that the problem is related with the version of the Tcl Img package 1.4.1 used in GiD in Windows.
Updating it to version 1.4.7 works well. (On Linux it is working wel with the version 1.4.6)
Next GiD 14.0.2 official and 14.1.0d developer will include this version of the Img package.
Note: you can fix your current GiD Windows version simply replacing the current folder <gid>/scripts/img by this attached files
Windows x32 Windows x64 (use the x32 or x64 version depending on your GiD platform)
set x [GidUtils::CaptureWindow .gid.meshq.f.nb.fTriangle.c]
$x write {C:\temp\mesh_quality.png} -format PNG
or this
set x [image create photo -format window -data .gid.meshq.f.nb.fTriangle.c]
$x write {C:\temp\mesh_quality.png} -format PNG
and the image was created, but corrupted (only the upper part of the image was properly filled)
It seems that the problem is related with the version of the Tcl Img package 1.4.1 used in GiD in Windows.
Updating it to version 1.4.7 works well. (On Linux it is working wel with the version 1.4.6)
Next GiD 14.0.2 official and 14.1.0d developer will include this version of the Img package.
Note: you can fix your current GiD Windows version simply replacing the current folder <gid>/scripts/img by this attached files
Windows x32 Windows x64 (use the x32 or x64 version depending on your GiD platform)
Re: take snapshot in GiD
importing New img package helpful.
Thanks to help.
Thanks to help.