Coreform Cubit 2025.1 User Documentation

The Coreform Cubit Python API

Coreform Cubit's Application Programming Interface (API) for Python provides methods that allow Coreform Cubit to be scripted to automatically to create meshes and geometry for complex models. It can be used to generate models for parametric studies where either geometric or mesh parameters are changed. It also provides archival capabilities to recreate models without having to store large datasets.

The Coreform Cubit Python API presents some of the most commonly used commands. The graphical user interface for Coreform Cubit is implemented using the C++ version of these commands. These commands are maintained, used, tested, and being developed.

The API is designed to be a read only interface. All modification to Coreform Cubit should be completed by executing Cubit commands. This is done with the cmd method.

#! python x = 10 y = 12 z = 7 cubit.cmd(f'brick x {x} y {y} z {z}') id = cubit.get_last_id('volume') cubit.cmd(f'color volume {id} rgb .5 1.0 1.0')

There are a number of functions in the API that are not presented here, but they can be found in the Appendix. Many of the skipped commands can be implemented using the commands presented here. For example, there is an API function to get the hexahedral elements in a volume. Most users should prefer the command parse_cubit_list. For example,

hexes = cubit.parse_cubit_list("hex", "in volume 1")

In addition to the method based API there are also Cubit objects. Only the query methods are documented here. The object modification methods are not supported.

The API is documented in the following sections.