3.3.2. printModel Command

This command is used to print information about the model, e.g. the nodes and elements, to the screen or a file.

There are several forms of the command:

  1. Print the whole model:

printModel <-JSON> <-file $fileName>
  1. Print the nodes:

printModel <-file $fileName> -node <-flag $flag> <$node1 $node2 ...>
  1. Print the elements:

printModel <-file $fileName> -ele <-flag $flag> <$ele1 $ele2 ...>

Argument

Type

Description

-JSON

string

write the whole model in JSON format, e.g. for use by other programs (optional)

$fileName

string

name of the file to which the information is written; text output is added to the end of an existing file, while JSON output overwrites it (optional: default = the screen)

$node1 $node2 …

list integer

tags of the nodes to print (optional: default = all nodes)

$ele1 $ele2 …

list integer

tags of the elements to print (optional: default = all elements)

$flag

integer

flag passed to the print method of each object, which may print more or different information depending on its type (optional: default = 0, the full current state). For nodes, a flag of 1 prints only the node tag and its displacements

Note

  1. Without any options, the whole model is printed to the screen.

  2. Only one of -node or -ele can be given in a command. Anything after it is read as its arguments.

  3. -file must come before -node or -ele.

  4. In Tcl, the dashes may be left out, e.g. printModel node 1 2, and the file name may be given without -file, e.g. printModel out.txt -node. In Python, -file must be given.

Warning

  1. -JSON must be followed by -file, i.e. printModel -JSON -file model.json. In Tcl, printModel -JSON on its own, or printModel -file model.json -JSON, stops the program. In Python, -JSON after -file writes nothing.

  2. -node -flag 1 stops the program if a node printed has no displacements yet, e.g. a node that is not connected to any element.

Example:

The following example prints all elements, then the tags and displacements (flag 1) of nodes 1 and 2, and then writes the whole model in JSON format to the file model.json.

printModel -ele
printModel -node -flag 1 1 2
printModel -JSON -file model.json

Code Developed by: fmk