3.1 Session Control
This section provides an overview to session control in Cubit. This includes information on starting and exiting a Cubit session, running Cubit in batch mode, initialization files, how to enter commands, file manipulation, changing the working directory, memory manipulation and more. Much of your ability to use Cubit effectively depends on mastery of concepts in this section. Even experienced users will find it useful to review this section periodically.
3.1.1 Starting and Exiting a Cubit Session
3.1.1.1 Starting the Session in Cubit Command Mode
The command line version of Cubit can be started on UNIX machines by typing Cubit at the command prompt from within the Cubit directory. If you have not yet installed Cubit, instructions for doing so can be found in Licensing, Distribution and Installation. A Cubit console window will appear which tells the user which Cubit version is being run and the most recent revision date. A graphics window will also appear unless you are running with the -nographics option. For a complete list of startup options see the Execution Command Syntax section of this document. Cubit can also be run with initialization files or in batch mode.}
3.1.1.2 Starting the Session in Python Interpretor Mode
Cubit™ can be started in the Python Interpreter Mode by type Cubit -nogui at the command prompt from within the Cubit directory.
3.1.1.3 Windows File Association
Windows users have the option to associate .cub, .sat, and .jou files with Cubit. This means that double-clicking on one of these files will open it automatically in Cubit. This option is available during the installation process
3.1.1.4 Exiting the Session
The Cubit session can be discontinued with either of the following commands
exit
quit
3.1.1.5 Resetting the Session
A reset of Cubit will clear the Cubit database of the current geometry and mesh model, allowing the user to begin a new session without exiting Cubit. This is accomplished with the command
reset [genesis | block | nodeset | sideset]
A subset of portions of the Cubit database to be reset can be designated using the qualifiers listed. Advanced options controlled with the Set command are not reset. You can also reset the number of errors in the current Cubit session, using the command
reset errors <value>
which will set the error count to the specified value, or zero if the value is left blank.
3.1.1.6 Abort Handling
In the event of a crash, Cubit will attempt to save the current mesh as "crashbackup.cub" in the current working directory just before it exits. To disable saving of the "crashbackup.cub" file set an environment variable CUBIT_NO_CRASHSAVE equal to true. Or, use the following command:
set crash save [on | off]
This command will turn on or off crashbackup.cub creation during a crash on a per-instance basis. To minimize the effects of unexpected aborts, use Cubit’s automatic journaling feature, and remember to save your model often.
3.1.2 Execution Command Syntax
To run Cubit from the command line use the following pattern Cubit [options and args] [journalFile(s)|python historyFile(s)]. Command options for the command line are listed below. Each of these are optional. If specified, the quantities in square brackets, [$val], are optional and the quantities in angle brackets, <$val>, are required. Options are summarized in more detail below:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3.1.2.1 Passing Variables into a Cubit Session
To pass an APREPRO variable into a Cubit Session, start Cubit with the variable defined in quotes i.e. Cubit "some_var=2.3".
3.1.3 Initialization Files
CUBIT can execute commands on startup, before interactive command input, through initialization files. This is useful if the user frequently uses the same settings. The following files are played back in order, if they exist, at startup:
$(cubit install directory)/.cubit.install $HOME/.cubit $(current working directory)/.cubit
The $(cubit install directory) is determined by the location the program is installed. On Linux and Windows, it’ll be the bin directory of the installation and on macOS it’ll be the Cubit.app/Contents/MacOS directory. $HOME is is an environment variable pointing to the location of the user’s home directory. On Windows, the HOMEDRIVE and HOMEPATH environment variables will be used instead of the HOME environment variable. The $(current working directory) is determined where the user starts the program itself. If the -initfile <filename> option is used on the command that starts cubit, then the other init files are skipped and only the specified filename is played back. These files are typically used to perform initialization commands that do not change from one execution to the next, such as turning off journal file output, specifying default mouse buttons, setting geometric and mesh entity colors, and setting the size of the graphics window.
3.1.4 Environment Variables
Cubit can interpret the following environment variables. These settings are only applicable to the Command Line Version of Cubit and do not apply to the Graphical User Interface. See also the cubit_step_path and cubit_iges_path environment variables. See also the cubit_dir, homedrive and homepath settings.
|
|
|
|
|
|
|
|
|
3.1.5 Environment Commands
3.1.5.1 Working Directory
pwd
cd "<new_path>"
The new path may be an absolute reference, or relative to the current directory. The <TAB> key will complete unique file references.
3.1.5.2 File Manipulation
ls [’<file_name>’]
delete file [’<file_name>’]
set deletions [on|off]
mkdir "<directory_name>"
This creates a new directory with the specified name and path. The command accepts an absolute path, a relative path, or no path. If a relative path is specified, it is relative to the current working directory, which can be seen by typing ’pwd’ at the Cubit command prompt. If no path is specified, the new directory is created in the current working directory. The command succeeds if the specified directory was successfully created, or if the specified directory already exists. The command fails if the new directory’s immediate parent directory does not exist or is not a directory.
3.1.5.3 CPU Time
Timer [start | stop]
The start option will start a CPU timer that will continue until the stop command is issued. The elapsed time will be printed out on the command line. If no arguments are given, the command will act like a toggle.
3.1.5.4 Comment
comment [’<text_to_print>’] [<aprepro_var>] [<numeric_value>]
The comment command can take multiple arguments. If an argument is an unquoted word, it is treated as an aprepro variable and its value is printed out. Quoted strings are printed verbatim, and numbers are printed as they would be in a journal string. For example:
Cubit> #{x=5} |
Cubit> #{s="my string"} |
Cubit> comment "x is" x "and s is" s |
|
User Comment: x is 5 and s is my string |
|
Journaled Command: comment "x is" x "and s is" s |
3.1.5.5 History
history <number_of_lines>
For example, if you type history 10, the most recent 10 commands will be echoed to the input window.
3.1.5.6 Error Logging
[set] logging errors {off | on file ’<filename>’ [resume]}
This setting will allow users to echo error messages to a separate log file. The resume option will allow output to be appended to existing files instead of overwriting them. For more information on Cubit environment settings see List Cubit Environment.
3.1.5.7 Determining the Cubit Version
To determine information on version numbers, enter the command version. This command reports the Cubit version number, the date and time the executable was compiled, and the version numbers of the ACIS solid modeler and the VTK library linked into the executable. This information is useful when discussing available capabilities or software problems with Cubit developers.
3.1.5.8 Echoing Commands
By default, commands entered by the user will be echoed to the terminal. The echo of commands is controlled with the command:
[set] echo {on | off}
3.1.5.9 Digits Displayed
Cubit uses all available precision internally, but by default will only print out a certain number of digits in order for columns to line up nicely. The user can override that with the set digits command:
set digits [<num_to_list=-1>]
If the digits are set to -1, then the default number of digits for pretty formatting are used. If the digits are set to a specific number, such as 15, more digits of accuracy can be displayed. This may be useful when checking the exact position and size of geometric features. The number of digits used for listing positions, vectors and lengths can be listed using the following command:
list digits
3.1.5.10 Examples
Cubit> set digits 6 |
Cubit> set digits 20 |
Cubit> set digits -1 |
3.1.6 Command Syntax
volume <range> scheme sweep [source [surface] <range>] [target [surface] <range>] [rotate {on | OFF}]
Case is not significant.
The "#" character in any command line begins a comment. The "#" and any characters following it on the same line are ignored. Although note that the "#" character can also be used to start an Aprepro statement. See the Aprepro documentation for more information.
Commands may be abbreviated as long as enough characters are used to distinguish it from other commands.
The meaning and type of command parameters depend on the keyword. Some parameters used in Cubit commands are:
Numeric: A numeric parameter may be a real number or an integer. A real number may be in any legal C or FORTRAN numeric format (for example, 1, 0.2, -1e-2). An integer parameter may be in any legal decimal integer format (for example, 1, 100, 1000, but not 1.5, 1.0, 0x1F).
String: A string parameter is a literal character string contained within single or double quotes. For example, ’This is a string’ .
Filename: When a command requires a filename, the filename must be enclosed in single or double quotes. If no path is specified, the file is understood to be in the current working directory. After entering a portion of a filename, typing a ’?’ will complete the filename, or as much of the filename as possible if there is more than one possible match.
A filename parameter must specify a legal filename on the system on which Cubit is running. The filename may be specified using either a relative path (../Cubit/mesh.jou), a fully-qualified path (/home/jdoe/Cubit/mesh.jou), or no path; in the latter case, the file must be in the working directory (See Environment Commands for details.) Environment variables and aliases may also be used in the filename specification; for example, the C-Shell shorthand of referring to a file relative to the user’s login directory (~jdoe/Cubit/mesh.jou) is valid.
Toggle: Some commands require a "toggle" keyword to enable or disable a setting or option. Valid toggle keywords are "on", "yes", and "true" to enable the option; and "off", "no", and "false" to disable the option.
- Each command typically has either: * an action keyword or "verb" followed by a variable number of parameters. For example:
mesh volume 1
Here mesh is the verb and volume 1 is the parameter. * or a selector keyword or "noun" followed by a name and value of an attribute of the entity indicated. For example:volume 1 scheme sweep source 1 target 2
Here volume 1 is the noun, scheme is the attribute, and the remaining data are parameters to the scheme keyword.
The command will be shown in a format that looks like this:
A word enclosed in angle brackets ( <parameter> ) signifies a user-specified parameter. the value can be an integer, a range of integers, a real number, a string, or a string denoting a filename or toggle. the valid value types should be evident from the command or the command description.
A series of words delimited by a vertical bar ( choice1 | choice2 | choice3 ) signifies a choice between the parameters listed.
A toggle parameter listed in all caps signifies the default setting.
A word that is not enclosed in any brackets, or is enclosed in curly brackets ( {required} ) signifies required input.
A word enclosed in square brackets ( [optional] ) signifies optional input which can be entered to modify the default behavior of the command.
A curly bracket that is inside a square bracket (e.g. [rotate {on|OFF}] ) is only required if that optional modifier is used.
3.1.7 Command Line Help
In addition to the documentation you are currently viewing, CUBIT can give help on command syntax from the command line. For help on a particular command or keyword, the user can simply type help <keyword>. If the user is uncertain of the keyword, an asterisk * may be added to the end of the entered characters and help for all keywords that start with the entered characters will be printed. In addition, if the user has typed part of a command and is uncertain of the syntax of the remainder of the command, they can type a question mark ? and help will be printed for the sequence of keywords currently entered. It is important to note that if the user has typed the keywords out of order, then no help will be found. If the user is not sure of the correct order of the keywords, the ampersand & key will search on all occurrences of whatever keywords are entered, regardless of the order. The results of this type of command are shown in the following listing.
Cubit>help degenerate* |
|
Help for words: degenerate*. |
|
set block mixed element output { OFFSET | degenerate } |
|
set degenerates [on|off] |
|
Cubit> volume 3 label ? |
Completing commands starting with: volume, label. |
Help not found for the specified word order. |
|
Cubit> volume 3 label & |
Help for words: volume & label |
Label Volume [ on | off | name [only|id] | id | interval | size | scheme | merge | firmness ] |
|
Cubit> label volume 3 ? |
Completing commands starting with: label, volume. |
Label Volume [on|off|name [only|ids]|ids|interval|size|scheme|merge|firmness] |