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 subnames 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 specificied then the current model name is returned.

GiD_SetProblemtypeName <name>

To change the current problemtype name.

If name is not specificied 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).

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_WriteCalculationFile

It is a command to efficiently print to file the mesh data classified by groups

To see its syntax see Writing the input file for calculation

GiD_File fopen|fclose|fprintf|fflush|list

To allow print data from a Tcl procedure with standard fprintf command, specially to write the calculation file from Tcl or a mix of .bas template and Tcl procedures

  • GiD_File fopen <filename> ?<access>?

Open a file named <filename> for writting access. By default access is "w", but is possible to use "a" to append to a previous file (and "wb" or "ab" to open the file in binary mode). It returns a long integer <file_id> representing the channel

  • GiD_File fclose <file_id>

Close a channel

  • GiD_File fprintf -nonewline <file_id> <format> ?<arg>? ... ?<arg>?

Print data from a Tcl procedure in a file opened with GiD_File fopen and returns the number of printed characters.

(a .bas template implictly open/close a file with this command, and the file_id could be send to a tcl procedure as a parameter with the *FileId template keyword)

<file_id> must be a valid file descriptor, that could be obtained in a .bas template with the *FileId command (or with GiD_File fopen)

<format> must be a valid C/C++ format, according with the arguments

return

  • GiD_File fflush <file_id>

Force unwritten buffered data to be written to the file

  • GiD_File list

It returns a list of currently open file_ids

Example:

.bas file:

Number of points and lines: *tcl(MyMethod *FileId)

.tcl file:

proc MyMethod { channel } {

GiD_File fprintf -nonewline $channel {%d %d} [GiD_Info Geometry NumPoints] [GiD_Info Geometry NumLines]

}

GiD_Thumbnail get | get_pixels | get_vectorial

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 widht 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 formated 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

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

}

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

To get or set the current togl (Tk OpenGL object), and the list of all togl's of all windows

Example:

set togl [GiD_Togl current]

GiD_Togl current $togl

set togls [GiD_Togl list]

GiD_GetUserSettingsFilename ?-create_folders?

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