...
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]
}
Special Tcl commands>Print>WriteCalculationFile
GiD_WriteCalculationFile
The command called GiD_WriteCalculationFile facilitate the creation of the output calculation file.
See also Writing the input file for calculation
Note: This command is provided to allow efficiency and relative flexibility writing the mesh and tree data related to groups, traversing the data structures without the cost of create a serialized copy in memory.
It is not compulsory to use this command, it is possible, and sometimes necesary, to use other Tcl commands to get mesh, groups and other data and reorder the information in order to be written.
GiD_WriteCalculationFile init|end|puts|coordinates|all_connectivities|connectivities|nodes|elements|has_elements ?-elemtype <etype>? ?-localaxes <formatLADict> ""? ?-elements_faces all|elements|faces? ?-number_ranges <NRDict>? ?-unique? ?-multiple? ?-all_entities? ?-do_subst? ?-sorted? ?-count? ?-return? ?-print_faces_conecs ? -connec_ordering? corner_face_corner_face <groupsDict>
- GiD_WriteCalculationFile init ?-mode append? ?-encoding external|utf-8? <filename>
To open for writting the calculation file.
Before to print any information to the file it must be opened with this command. Next prints of GiD_WriteCalculationFile will use implicilty this opened channel.
GiD internal strings are utf-8 codified,
-encoding external : (default) strings to print are converted to the current external encoding.
-encoding utf-8: strings are not converted.
It returns an file identifier that could be used with with 'GiD_File fprintf', but must not be used with Tcl standard print commands like 'puts' or 'write'
Example:
set file_id [GiD_WriteCalculationFile init -mode append {c:/temp/my output.dat}]
lassign {1.5 2.3} x y
GiD_File fprintf $file_id "x=%15.5f y=%15.5f" $x $y
- GiD_WriteCalculationFile end
To close the calculation file
Example:
GiD_WriteCalculationFile end
- GiD_WriteCalculationFile puts ?-nonewline? <string>
...
Example:
GiD_WriteCalculationFile puts "hello world"
- GiD_WriteCalculationFile coordinates ?-count? ?-return? ?-factor <factor>? <format>
...
Example:
set num_coordinates [GiD_WriteCalculationFile coordinates -count ""] ;#with -count the format doesn't matter, "" could be used
GiD_WriteCalculationFile puts "num coordinates: $num_coordinates"
set unit_origin [gid_groups_conds::give_mesh_unit]
set unit_destination [gid_groups_conds::give_active_unit L]
set mesh_factor [gid_groups_conds::convert_unit_value L 1.0 m mm]
GiD_WriteCalculationFile coordinates -factor $mesh_factor "%d %g %g %g"
- GiD_WriteCalculationFile all_connectivities ?-elemtype <etype>? ?-count? ?-return? ?-connec_ordering corners_faces|corner_face_corner_face? <format>
...
by default the order is corners_faces (first are printed the corners and then the quadratic nodes)
Example:
GiD_WriteCalculationFile all_connectivities -elemtype Triangle "id: %d connectivities: %d %d %d"
- GiD_WriteCalculationFile connectivities|nodes|elements|has_elements ?-elemtype <etype>? ?-localaxes <groupsLADict>? ?-elements_faces all | elements | faces? ?-number_ranges <NRDict>? ?-count? ?-unique? ?-error_if_repeated? ?-multiple? ?-all_entities? ?-print_faces_conecs? ?-sorted? ?-do_subst? ?-connec_ordering? ?-return? <groupsDict>
...