On this page:
3.1.1 Starting and Exiting a Cubit Session
3.1.1.1 Starting the Session in Cubit Command Mode
3.1.1.3 Windows File Association
3.1.2 Execution Command Syntax
3.1.3 Initialization Files
3.1.4 Environment Variables
3.1.5 Environment Commands
3.1.5.10 Examples
3.1.6 Command Syntax
3.1.7 Command Line Help
3.1.8 Saving and Restoring a Cubit Session
2022.4+26187-e1209cf7 Apr 14, 2022

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:

-help

   

Print a short usage summary of the command syntax to the terminal and exit.

-initfile <$val>

   

Use the file specified by <$val> as the initialization file instead of the default set of initialization files. See Initialization Files

-noinitfile

   

Do not read any initialization file. This overrides the default behavior described in Initialization Files

-solidmodel <$val>

   

Read the ACIS solid model geometry or .cub file information from the file specified by <$val> prior to prompting for interactive input.

-batch

   

Specify that there will be no interactive input in this execution of  Cubit. Cubit will terminate after reading the initialization file, the geometry file, and the input_file_list.

-nographics

   

Run Cubit without graphics. This is generally used with the -batch option or when running Cubit over a line terminal.

-display

   

Sets the location where the Cubit graphics system will be displayed, analogous to the -display environment variable for the X Windows system. Unix only.

-driver <type>

   

Sets the <type> of graphics display driver to be used. Available drivers depend on platform, hardware, and system installation. Typical drivers include X11 and OpenGL.

-nojournal

   

Do not create a journal file for this execution of Cubit . This option performs the same function as the Journal Off command. The default behavior is to create a new journal file for every execution of Cubit .

-pythonversion

   

Set the Python version to 2 or 3

-journalfile <file>

   

Write the journal entries to <file>. The file will be overwritten if it already exists.

-maxjournal <$val>

   

Only create a maximum of <$val> default journal files. Default journal files are of the form cubit#.jou where # is a number in the range 01 to 999.

-nodeletions

   

Turn off the ability to delete files with the delete file ’<filename>’ command.

-nooverwritecheck

   

Turn off the file overwrite check flag. Files that are written may then overwrite (erase) old files with the same name with no warning. This is typically useful when re-running journal files, in order to overwrite existing output files. See the set File Overwrite Check [ON|off] command.

-restore

   

Restore the specified filename (or cubit_geom) mesh and ACIS files, e.g. cubit_geom.save.g and cubit_geom.save.sat

-noecho

   

Do not echo commands to the console. This option performs the same function as the Echo Off command. The default behavior is to echo commands to the console.

-debug=<$val>

   

Set to "on" the debug message flags indicated by <$val>, where <$val> is a comma-separated list of integers or ranges of integers, e.g. 1,3,8-10.

-information={on|off}

   

Turn {on|off} the printing of information messages from Cubit to the console.

-warning={on|off}

   

Turn {on|off} the printing of warning messages from Cubit to the console.

-include=<path>

   

Allows the user to specify a journal file from the command line.

-fastq=<file>

   

Read the mesh and geometry definition data in the FASTQ file <file> and interpret the data as FASTQ commands. See T. D. Blacker, FASTQ Users Manual Version 1.2, SAND88-1326, Sandia National Laboratories, (1988) for a description of the FASTQ file format.

<input_file_list>

   

Input files to be read and executed by Cubit . Files are processed in the order listed, and afterwards interactive command input can be entered (unless the -batch option is used.)

<variable=value>

   

APREPRO variable-value pairs to be used in the Cubit session. Values can be either doubles or character type (character values must be surrounded by double quotes.), Command options can also be specified using the CUBIT_OPT environment variable. (See Environment Variables .)

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.

display

   

The graphics window or GUI will pop-up on the specified X-Window display. This is useful for running Cubit across a network, or on a machine with more than one monitor. Unix only.

cubit_opt

   

Execution command line parameter options. Any option that is valid from the command line may be used in this environment variable. See Execution Command Syntax.

cubit_journal

   

Specifies path and name to use for journal file. The specified path may contain the following %-escape sequences: %a = abbreviated weekday name
%A = full weekday name
%b = abbreviated month name
%B = full month name
%d = date of the month [01,31]
%H = hour (24-hour clock) [00,23]
%I = hour (12-hour clock) [01,12]
%j = day of the year [1,366]
%m = month number [1,12]
%M = minute [00,59]
%n = replaced with the next available number between 01 and 999.
%p = “a.m.” or “p.m.”
%S = seconds [00,61]
%u = weekday [1,7], 1 is Monday
%U = week of year [00,53]
%w = weekday [0,6], 0 is Sunday
%y = year without century [00,99]
%Y = year with century (e.g. 1999)
%% = a % character
  • The default value is Cubit%n.jou.

  • This creates journal files in the current directory named cubit00.jou, cubit01.jou, cubit02.jou, etc.

  • To keep the same naming scheme but create the files the /tmp directory, set cubit_journal to /tmp/Cubit%n.jou.

  • To create journal files in directories according to the day of the week, first create directories named Mon, Tues, etc. Cubit will not create them automatically.

  • Next set {cubit_journal} to %a/%n.jou. This will create journal files named 01.jou through 999.jou in the appropriate directory for the current day of the week.

3.1.5 Environment Commands

3.1.5.1 Working Directory

The working directory is the current directory where journal files are saved. To list the current directory type

pwd

The current path will be echoed to the screen. By default, the current directory is the directory from which Cubit was launched. The command to change the current directory is

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

A helpful addition is the ability to do a directory listing of a directory. The command for this is

ls [’<file_name>’]

Note also that you can delete files from the command line. The command for this is

delete file [’<file_name>’]

The file name may include the wildcard character *, but not the wildcard character ?, since the ? is used for command completion. File deletion from the command line can also be disabled. If deletions are set to off files cannot be deleted from the Cubit command line.

set deletions [on|off]

The mkdir command is used to create a new directory. The syntax for this command is:

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

At times it is important to see how much cpu time is being used by a command. One function available to do this is the timer command. The syntax for this command is:

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

This keyword allows you to add comments without affecting the behavior of Cubit.

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

This command allows you to display a listing of your previous commands.

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

Coordinates and lengths will be listed with up to 6 digits.

Cubit> set digits 20

For this platform, max digits = 15. Coordinates and lengths will be listed with up to 15 digits.

Cubit> set digits -1

To reset digits to default, use set digits -1. The number of coordinate and length digits listed will vary depending on the context.

3.1.6 Command Syntax

The execution of Cubit is controlled either by entering commands from the command line or by reading them in from a journal file. Throughout this document, each function or process will have a description of the corresponding Cubit command; in this section, general conventions for command syntax will be described. The user can obtain a quick guide to proper command format by issuing the <keyword> help} command; see Command Line Help for details. Cubit commands are described in this manual and in the help output using the following conventions. An example of a typical Cubit command is:

volume <range> scheme sweep [source [surface] <range>] [target [surface] <range>] [rotate {on | OFF}]

The commands recognized by Cubit are free-format and abide by the following syntax conventions.
  1. Case is not significant.

  2. 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.

  3. Commands may be abbreviated as long as enough characters are used to distinguish it from other commands.

  4. 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.

  5. 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 notation conventions used in the command descriptions in this document are:
  • 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]

3.1.8 Saving and Restoring a Cubit Session

There are currently two ways to save/restore a model in Cubit. A file can be saved with either the Exodus or Cubit File method. The method of choice is determined by a set command. The Cubit method is the default.

Cubit users may use an additional file type named *.Cubit. A ’Cubit’ file is similar to a ’cubit’ file in that it contains the geometry, mesh, and associated mesh groups. In addition, a ’Cubit’ file may include the journal file that was used to construct the model being saved. A ’Cubit’ file is saved in HDF5 format, making it possible for users to include their own data without requiring access to low-level read/write functions in Cubit.

set save [exodus|cubit] [backups <number>]

3.1.8.1 Cubit File Method

The Cubit file is a binary cross-platform compatible file for the storage of a model that is compact in size and efficient to access. It includes both the geometry and the associated mesh, groups, blocks, sidesets, and nodesets. Mesh and geometry are restored from the Cubit file in exactly the same state as when saved. For example, element faces and edges are persistent, as well as mesh and geometry ids. The Graphical User Interface version of Cubit also provides a toolbar with direct access to file operations using the Cubit File method described here.

3.1.8.1.1 New

Creates a new blank model with default name, closing the current model. The New command essentially acts like the reset command.

3.1.8.1.2 Open ’<filename>’

Opens an existing *.cub or *.Cubit file, closing the current model.

Open ’filename.cub’

Open ’filename.Cubit’

3.1.8.1.3 Save

A default file name is assigned when Cubit is started (in very much the same way the journal files are assigned on startup) in the form cubit01.cub, for example. The current model filename is displayed on the title bar of the Cubit window. Typing save at any time during your session will save the current model to the assigned *.cub file. The *.cub file includes the *.sat file and the mesh. Groups, blocks, sidesets and nodesets are also saved within the *.cub file. To change the name of the current model, or to save the model’s current geometry to a different file, use the save as command. Note that ’save <file.cub>’ is NOT a valid command.

save

save as ’filename.cub’ [overwrite]

save cubit ’filename.cubit’ [overwrite] [journal]

The set file overwrite command can be toggled on and off to allow overwriting when using the save as command. The command is defaulted to not allow overwriting.The "journal’ keyword will cause the existing journal file to be embedded in the .Cubit file. From the GUI, this option is on by default.The default file type (.Cubit (HDF5) versus .cub (legacy Cubit format) is controlled from the Geometry Defaults options panel. The default type is Cubit. The Save and Save As commands are sensitive to this setting and will write .Cubit or .cub files based on the setting. The setting is persistent between sessions.

Figure 11: The default file type for saving a Cubit model can be set in the Options dialog.

The command, ’save Cubit...’ will always write a .Cubit file regardless of the option setting.

set file overwrite [On|OFF]

A backup file is created by default, allowing access to previous states of the model. The backup files are named *.cub.1, *.cub.2... The user can set the total number of backups created per model with the following command (the default number of backups is 99,999):

set save backups <number>

As soon as the number of model backups reaches the maximum, the lowest numbered backup file will be removed upon subsequent backup creation.To check on the status of a ’set’ command, type in the command in question without any options. For example, to check which save method is currently toggled, type:

set save

3.1.8.1.4 Import

Appends a *.cub file to an existing model.

import cubit ’filename.cub’ [merge_globally]

3.1.8.1.5 Export

In addition to saving an entire model, one can use the export command to save only a portion of a model. The geometry and associated mesh, groups, blocks, sidesets and nodesets are exported. Only bodies or free surfaces, curves or vertices can be exported to a Cubit file.

export cubit ’filename.cub’ entity-list