Cubit 15.8 User Documentation
The Command Line Workspace is the interface for command interaction between the user and the CUBIT application. The user can enter commands into this window as if they were using the command line version of CUBIT. Journaled commands will be echoed to this screen, even if they were not typed in manually. Thus, if the user wants to know what the command sequence for a particular action on the GUI is, they can watch for the "Journaled Command:" line to appear. In addition, this screen will contain important informational and error messages. The command window has the following four tabs:
The Script window is hidden by default. To turn it on open the Tools-Options dialog and check the "Show Script Tab under Layout/Cubit Layout.
The command line workspace emulates the environment in the command line version of Cubit. Commands can be entered directly by typing at the CUBIT> prompt. This window also prints out error messages, informational messages, and journaled commands.
To enter commands in the command line workspace, the command window must be active. Activate the command window by clicking anywhere inside the window. Commands are typed in at the CUBIT> prompt. If you do not remember the specific command sequence you can type help and the name of the command phrase. The input window will show all of the commands that contain that word or phrase. Alternatively, if you know how a command starts, but do not remember all of the options, you can type ? at the end of the command to show all possible command completions. See Command Syntax for an explanation of command syntax rules.
Use the Up and Down arrow keys on the keyboard to recall previously executed commands.
Commands can be repeated in other ways as well.
Beginning with version 13.0, Cubit includes a 'focus follows cursor' option for the command window. The option can be enabled and disabled from the Tools/Options/General options panel. The setting is persistent between sessions and is disabled by default.
Please note, the focus follows cursor behavior is available only in the command window. All other windows or widgets require the user to click the mouse in order to grab focus.
The error window is located in the Command Line Workspace under the Error tab. If there are errors, a warning icon will appear on the tab. The icon will disappear when you open the window to view errors. The error window only displays the error output, which can make it easier to find and read the error output. The command that caused the error will be printed along with the error information. If the command was from a journal file, the file name and number will be printed next to the command.
The history window lists the last 100 commands. The number of commands listed can be configured in the options dialog on the History page. You can re-run the commands in the history window using the context menu. You can also clear the history using the context menu.
CUBIT boasts a robust Python interpreter built right into the graphical user interface. To create a Python script using the Script tab, start typing at the "%>" prompt. At the end of each line, hit Enter to move to the next line . To execute the script, press Enter at a blank line. Scripts may also be written in the Journal File Editor.
The Claro Python interpreter works as though you were entering lines from the Python command prompt. This means that a blank line is interpreted as the end of a block. If you want to add whitespace for clarity you have to add a # mark for a comment on any white line that is in a loop or a class.
One possible solution to this problem is to create two Python files. The first file can contain the complex set of Python instructions(program.py) including blank lines. The second file will read and execute the first file. An example syntax for the second file is given below.
f = file("program.py")
commandText = f.read()
exec(commandText)
You can then execute the second program within Cubit.
The interface between cubit and python is the "cubit" object. This object has a method called cmd which takes as an argument a command string. Thus, the following command in the script window:
cubit.cmd("create brick x 10")
will create a cube with sides 10 units long. The following script is a simple example that illustrates using loops, strings, and integers in Python.
%>for i in range(4):
. . x=i*3
. . for j in range(4):
. . y=j*3
. . for k in range(4):
. . z=k*3
. . mystr="create vertex x "+str(x)+" y "+str(y)+" z "+str(z)
. . cubit.cmd(mystr)
This simple script will create a grid of vertices four wide. Scripts can be more advanced, even creating customized windows and toolbars. For a complete list of python/cubit interface commands see the Appendix.
The command window can be undocked by clicking and dragging the left edge. If it is floating it can be redocked by double-clicking the solid blue bar. By default, it will always be redocked in the bottom of the application window. To change the size of the floating window, click and drag the edge of the window. To change the height of the docked window, click and drag the top edge or right edge.