GiD - The personal pre and post processor

Other 

GiD_Set ?-meshing_parameters_model? ?-default|-array_names? <varname> ?<value>?
This command is used to set or get GiD variables. GiD variables can be found through the Right buttons menu under the option Utilities -> Variables:

  • <varname> is the name of the variable;
  • <value> if this is omitted, the current variable value is returned (analogous with 'GiD_Info variables <varname>').
  • -default return the default value of the variable (<value> its not accepted)
  • -array_names return a list with the sub names of the array, or an empty list if is not an array
  • -meshing_parameters_model to use the copy of the variable used in meshing the current model instead of the general preference variable


Example:

GiD_Set CreateAlwaysNewPoint
GiD_Set CreateAlwaysNewPoint 1
GiD_Set -default CreateAlwaysNewPoint
GiD_Set -meshing_parameters_model SurfaceMesher


GiD_SetModelName <name>
To change the current model name.
If name is not specified then the current model name is returned.


GiD_SetProblemtypeName <name>
To change the current problemtype name.
If name is not specified then the current problemtype name is returned.


GiD_ModifiedFileFlag set|get ?<value>?
There is a GiD internal flag to indicate that the model has changed, and must be saved before exit.
With this command it is possible to set or get this flag value:

  • <value> is only required for set: must be 0 (false), or 1 (true).

Note: This command set all flags. Can set flags of individual datasets with the command GiD_Project set changes_dataset <dataset> ?<0|1>?


Example:

GiD_ModifiedFileFlag set 1
GiD_ModifiedFileFlag get


GiD_MustRemeshFlag set|get ?<value>?
There is a GiD internal flag to indicate that the geometry, conditions, etc. have changed, and that the mesh must be re-generated before calculations are performed.
With this command it is possible to set or get this flag value:

  • <value> is only required for set: must be 0 (false), or 1 (true).

Example:

GiD_MustRemeshFlag set 1
GiD_MustRemeshFlag get


GiD_Redraw
To force a redraw


GiD_BackgroundImage get|set show|filename|location <values>
This command allow to get and set the background image properties
Valid set values are:

  • show: 1 or 0
  • filename:

the full filename of some valid GiD image format to be used as background image
or "", to release the current image

  • location:

'fill' to fill the whole screen,
or a list (objarray) with six floating values for a real size image, to set the origin and x',y' local axes: ox oy ix iy jx jy
They are 3 points (in 2D space, z=0.0) that represent:
o=origin lower-left point
i=end point of the local x' axis
j=end point of the local y' axis (the size ratio of the image could change)
Note: 'GiD_BackgroundImage set location' must be called after 'GiD_BackgroundImage set filename'

GiD_RegisterExtensionProc <.extension> PRE|POST|PREPOST <procedure>
To register a Tcl procedure to be automatically called when dropping a file with this extension

Example:

GiD_RegisterExtensionProc ".h5" PRE Amelet::ReadPre


GiD_RegisterPluginAddedMenuProc <procedure>
To register a Tcl procedure to be automatically called when re-creating all menus (e.g. when doing files new)
this procedure is responsible to add its own options to default menu.

Example:

GiD_RegisterPluginAddedMenuProc Amelet::AddToMenu


GiD_Thumbnail get | get_pixels | get_vectorial | get_statistics_mean
Returns the image data of an downscaled view of the current graphical window.

  • get ?<width> <height>?

The image is a downscaled from the current size to width x height. The parameters width and height are optional and by default the view is scaled to 192x144. The result of this command can be directly used by the Tk image command, like this:

Example:

label .l -image [image create photo -data [GiD_Thumbnail get]]


  • get_pixels ?-quality <quality>? ?RGB|BGR|RGBA|BGRA|GREY|png|jpeg|raw?

It returns a list {width height data} of the current image in a direct way, binary and without modifications.
It allow to specify the kind and order of the data for Red, Green, Blue colors and for Alpha transparency factor.
If png format is specified that data is get as RBG and with png (portable network graphics format)
quality: integer value from 0 1o 100, valid only for jpeg format (that compress losing image quality)

Example:

lassign [GiD_Thumbnail get_pixels png] w h pixels
set my_image [image create photo -width $w -height $h -data [encrypter BASE64 encode $pixels]]
label .l -image $my_image


  • get_vectorial STL|VRML|OBJ

It returns the current view in binary STL or ascii VRML format. As STL only accepts triangles, lines are formatted as collapsed triangles and polygons are triangularized.
GiD_Thumbnail get_vectorial obj --> returns a list with 3 elements:
1st - the obj file contents ( refers to the 'ObjInMemory.mtl' material library file eventually)
2nd - (optional) the mtl file contents (i.e. the 'ObjInMemory.mtl', may refer to the 'ObjInMemory.png')
3rd - (optional) the texture data ( the ''ObjInMemory.png' binary data)
The returned data can be written directly in a file


Example:

# writing STL output
set fo [ open file.stl wb]
puts $fo [GiD_Thumbnail get_vectorial stl]
close $fo
# writing OBJ output
set obj_data [GiD_Thumbnail get_vectorial OBJ]
lassign $obj_data obj_objects obj_mtl obj_tex
set fo [open file.obj w]
puts $fo $obj_objects
close $fo
if { [llength $obj_mtl] > 0} {
  # inside $obj_objects there is the refence 'usemtl ObjInMemory.mtl'
  set fo [open ObjInMemory.mtl w]
  puts $fo $obj_mtl
  close $fo
}
if { [llength $obj_tex] > 0} {
  # inside $obj_mtl there is the refence 'map_Kd ObjInMemory.png'
  set fo [open ObjInMemory.png wb]
  puts $fo $obj_tex
  close $fo
}
  • get_statistics_mean

It returns an array of three real numbers with the mean of r g b components of all image pixels. (values from 0.0 to 255.0)
e.g.

GiD_Thumbnail get_statistics_mean

->254.5277054398148 254.52159288194446 254.51443142361111


GiD_GetWorldCoord screen_x screen_y
Given the screen coordinates ( screen_x, screen_y) returns a list with six coordinates:
{ x y z nx ny nz }
being
(x,y,z) the coordinates mapped into the world (model) of the screen coordinates,
(nx,ny,nz) the normal vector components of the world (model) pointing to the user.


The mapping screen --> world (model) is done by intersecting the line perpendicular to the screen, passing through the coordinates (screen_x,screen_y), with the plane parallel to the screen (in real model world) at the centre of the view / model. The returned normal is the normal of this plane.


GiD_Togl current|list|pick_one

A togl object is a Tk widget that allow draw using OpenGL commands

GiD_Togl current ?<togl>?

To get or set the current togl (Tk OpenGL object),

GiD_Togl list

To get the list of all togl's of all windows

GiD_Togl pick_one <togl_name> point|line|surface|volume|dimension|node|element|axis <x> <y>

To get the entity id of this category, if any, located on the x,y screen integer coordinates.


Example:

set togl [GiD_Togl current]
GiD_Togl current $togl
set togls [GiD_Togl list]


GiD_GetUserSettingsFilename ?-create_folders? ?-ignore_alternative_configuration_file?
To get the file name where the user settings are stored.
If -create_folders flag is provided, then all intermediate folders are created if doesn't exists
If -ignore_alternative_configuration_file flag is provided, then alternative_file provided by -c or -c2 command line argument is ignored.


GiD_GetUserSettingsCommonDirectory ?-create_folders?
Similar to GiD_GetUserSettingsFilename but return the common directory, not depend on GiD version or -c / -c2 command line flags

COPYRIGHT © 2022 · GID · CIMNE