Search the documentation
Enter at least 2 characters
Enter at least 2 characters
![]() |
CAE Fidesys 9.0 Documentation |
cubit.cmd(input_string) fidesys.cmd(input_string) Pass a command string in Passing a command into Fidesys using this method will result in an immediate execution of the command. The command is passed directly to Fidesys without any validation or other checking.
ccubit.cmd("brick x 10")
fidesys.cmd("brick x 20")
Parameters: input_string – Pointer to a string containing a complete Fidesys command |
cubit.get_id_string(entity_ids) Parse a list of integers into a Fidesys style id list. Return string will not include carriage returns or line break.
cubit.cmd('sphere radius .5')
cubit.cmd('volume 1 copy move x 2 repeat 3')
id_list = cubit.
parse_cubit_list('volume', 'all')
# id_list = [1,2,3,4]
# returned id_string is '1 to 4'
id_string = cubit.get_id_string(id_list)
Parameters: entity_ids – tuple of integers return A string representing the id list without line breaks Type: list[int] Returns: a Cubit stype string of ids Return type: str |
cubit.init(argv, in_python=True) Use cubit.init() to initialize Fidesys a stand-alone python session. Fidesys may be imported into python without starting up the GUI. The path to a licensed version of Fidesys must be specifed and Fidesys must be initialized prior accessing the other methods in this API. The arguments to the init() method are the command line arguments for Fidesys with the addition that the first argument is the program name “cubit”. The following python script shows an example of initializing and using Fidesys. The key parts are ensuring that the Fidesys libraries are in the path, importing the Fidesys libraries, and calling cubit.init().
import sys
# add Fidesys libraries to your path
sys.path.append('/opt/Fidesys/bin')
import cubit
# start cubit - this step is key. Note that:
# cubit.init does not require any arguments.
# If you do want to provide arguments, you must
# provide 2 or more, where the first must
# be "cubit", and user args start
# as the 2nd argument.
# If only one argument is used, it will be ignored.
cubit.init(['cubit','-nojournal'])
height = 1.2
blockHexRadius = 0.1732628
#hexagon
cubit.cmd(f"create prism height {height} sides 6 radius {blockHexRadius}")
#etc . . .
Parameters: argv – List of command line start-up directives. A blank list such as [‘’] will suffice. If command parameters are specified, the first item in the list is ignored. Type: list[str] |
cubit.parse_cubit_list(type, entity_list_string) Parse a Fidesys style entity list into a list of integers Users are allowed to input many variations of entities and IDs for any given command. This routine parses the input and returns a regular list of valid IDs for the specified entity type. For example:
cubit.parse_cubit_list('surface', '1 to 12')
cubit.parse_cubit_list('surface', 'with name "myname*"')
cubit.parse_cubit_list('surface', 'in volume 5 to 23')
cubit.parse_cubit_list('hex', 'in volume 1')
Parameters:
Type: str Type: str Returns: A list of valid ids for the given type within the specified parameters. Return type: tuple[int] |
cubit.get_arc_length(curve_id) Get the arc length of a specified curve Parameters: curve_id – ID of the curve Returns: Arc length of the curve Return type: float |
cubit.get_block_name(entity_id) Get the block name for a given block id. block_name = cubit.get_block_name(1) Parameters: block_id – Id of block in question Returns: Block name associated with this block or “” if none Return type: str |
cubit.get_curve_center(curve_id) Get the center point of the arc Parameters: curve_id – ID of the curve Returns: x, y, z center point of the curve Return type: tuple[float] |
cubit.get_curve_length(curve_id) Get the length of a specified curve Parameters: curve_id – ID of the curve Returns: Length of the curve Return type: float |
cubit.get_curve_radius(curve_id) Get the radius of a specified arc Parameters: curve_id – ID of the curve Returns: Radius of the curve Return type: float |
cubit.get_distance_from_curve_start(x_coordinate, y_coordinate, z_coordinate, curve_id) Get the distance from a point on a curve to the curve’s start point Parameters:
Type: float Type: float Type: float Returns: Distance from the xyz to the curve start Return type: float |
cubit.get_center_point(entity_type, entity_id) Get the center point of a specified entity.
center_point = cubit.get_center_point("surface", 22)
Parameters:
Returns: The x, y, z, coordinates of the center point Return type: tuple[float] |
cubit.get_common_curve_id(surface_1_id, surface_2_id) Given 2 surfaces, get the common curve id Parameters:
Returns: The id of the curve common to the two surfaces Return type: int cubit.get_common_vertex_id(curve_1_id, curve_2_id) Given 2 curves, get the common vertex id Parameters:
Returns: The id of the vertex common to the two curves, 0 if there is none Return type: int |
cubit.get_entities(entity_type) Get all entities of a specified type (including geometry, mesh, etc…).
entity_id_list = cubit.get_entities("volume")
Parameters: entity_type – Specifies the type of the entity Returns: A tuple of ids of the specified geometry type Return type: boolean cubit.get_entity_color(entity_type, entity_id) Get the color of a specified entity.
color = cubit.get_entity_color("curve", 33)
Parameters:
Returns: The color of the entity (r, g, b, a). Note that (0,0,0,0) denotes the default color. Return type: tuple[float], length 4 |
cubit.get_entity_name(entity_type, entity_id, no_default=False) Get the name of a specified entity Names returned are of two types: 1) user defined names which are actually stored in Fidesys when the name is defined, and 2) ‘default’ names supplied by Fidesys at run-time which are not stored in Fidesys. The second variety of name cannot be used to query Fidesys.
name = cubit.get_entity_name("vertex", 22)
Parameters:
Returns: The name of the entity Return type: str |
cubit.get_error_count() Get the number of errors in the current Fidesys session. Returns: The number of errors in the Fidesys session. Return type: int |
cubit.get_merge_tolerance() Get the current merge tolerance value Returns: The value of the current merge tolerance Return type:float |
cubit.get_mesh_intervals(geometry_type, entity_id: int) → int Get the interval count for a specified entity.
intervals = cubit.get_mesh_intervals("surface", 12)
Parameters:
Returns: The entity’s interval count Return type: int |
cubit.get_mesh_scheme(geometry_type, entity_id) Get the mesh scheme for the specified entity.
scheme = cubit.get_mesh_scheme("surface", 12)
Parameters:
Returns: The entity’s meshing scheme Return type: str |
cubit.get_mesh_size(geometry_type, entity_id) Get the mesh size for a specified entity.
mesh_size = cubit.get_mesh_size("volume",2)
Parameters:
Returns: The entity’s mesh size Return type: float |
cubit.get_surface_area(surface_id) Get the area of a surface Parameters: surface_id – ID of the surface Returns: Area of the surface Return type: float |
cubit.get_surface_centroid(surface_id) Get the surface centroid for a specified surface Parameters: surface_id – ID of the surface Returns: surface centroid Return type: tuple[float], length 3 |
cubit.get_surface_normal(surface_id) Get the surface normal for a specified surface Parameters: surface_id – ID of the surface Returns: surface normal at the center Return type: tuple[float], length 3 |
cubit.get_surface_normal_at_coord(surface_id, arg2) Get the surface normal for a specified surface at a location Parameters: surface_id – ID of the surface :param coord: array of x,y,z location on surface Returns: surface normal at coord Return type: tuple[float], length 3 |
cubit.get_total_volume(volume_list) Get the total volume for a list of volume ids Parameters: volume_list – List of volume ids Returns: The total volume of all volumes indicated in the id list Return type: float |
cubit.get_version() Get the Fidesys version. Returns: A string containing the current version of Fidesys. Return type: str |
cubit.get_volume_area(volume_id) Get the area of a volume Parameters: volume_id – ID of the volume Type: int Returns: Area of the volume Return type: float |
cubit.get_volume_volume(vol_id) Get the volume of a volume Parameters: volume_id – ID of the volume Type: int Returns: volume Return type: float |
cubit.is_merged(geometry_type, entity_id) Determines whether a specified entity is merged.
state = cubit.is_merged("surface",137)
Parameters:
Return type: boolean |
cubit.is_meshed(geometry_type, entity_id) Determines whether a specified entity is meshed.
state = cubit.is_meshed("surface",137)
Parameters:
|
cubit.is_periodic(geometry_type, entity_id) Query whether a specified surface or curve is periodic.
result = cubit.is_periodic("surface",22)
Parameters:
Returns: True is entity is periodic, otherwise false Return type: boolean |
cubit.is_point_contained(geometry_type, entity_id, xyz_point) Determine if given point is inside, outside, on or unknown the given entity. note that this is typically used for volumes or sheet bodies Parameters:
Type: str Type: int Type: tuple[float], length 3 Returns: -1 failure, 0 outside, 1, inside, 2 on Return type: int |
cubit.is_surface_meshable(surface_id) Check if surface is meshable with current scheme. Returns: A boolean indicating whether surface is meshable with current scheme. Return type: boolean |
cubit.is_surface_planar(surface_id) Query if the given surface is planar. Parameters: surface_id – Specifies the id of the surface |
cubit.is_volume_meshable(volume_id) Check if volume is meshable with current scheme. Returns: A boolean indicating whether volume is meshable with current scheme Return type: boolean |
cubit.is_sheet_body(volume_id) Query whether a specified volume is a sheet body Parameters: volume_id – Id of the volume Returns: True if volume is a sheet body, otherwise false Return type: boolean |
cubit.measure_between_entities(entity_type1, entity_id1, entity_type2, entity_id2) Returns distance between two geometry entities and their closest points. dist_info = cubit.measure_between_entities(“curve”, 10, “surface”, 12) dist = dist_info[0] curv_point = [dist_info[1], dist_info[2], dist_info[3]] surf_point = [dist_info[4], dist_info[5], dist_info[6]]] Parameters:
Type: str, one of “vertex”, “curve”, “surface”, “volume”, “node”, “edge”, “tri”, “face”, “tet”, “hex”, “wedge”, “pyramid” Returns: The distance between two entities Return type: float |
cubit.get_id_from_name(name) Get id for a named entity This routine returns an integer id for the entity whose name is passed in.
entity_id = cubit.get_id_from_name("member_2")
Parameters: name – Name of the entity to examine return Integer representing the entity Returns: The id associated with the given name. Return type: str |
cubit.get_last_id(entity_type) Get the id of the last created entity of the given type. last_id = cubit.get_last_id(“surface”) Parameters: entity_type – Type of the entity being queried Type: str Returns: The id of last created entity Return type: int |
cubit.get_next_block_id() Get a next available block id Returns: Next available block id Return type: int |
cubit.get_next_group_id() Get the next available group id from Fidesys Returns: next group id Return type: int |
cubit.get_next_nodeset_id() Get a next available nodeset id Returns: Next available nodeset id Return type: int |
cubit.get_next_sideset_id() Get a next available sideset id Returns: Next available sideset id Return type: int |
cubit.get_bounding_box(geometry_type, entity_id) Get the bounding box for a specified entity. vector_list = cubit.get_bounding_box("surface", 22) Parameters:
Returns: A tuple of coordinates describing the entity’s bounding box. Ten (10) values will be:
Return type: tuple[float], length 10 |
|
cubit.get_total_bounding_box(geometry_type, entity_list) Get the bounding box for a list of entities. vector_list = cubit.get_total_bounding_box("surface", entity_list) Parameters:
Returns: An array of coordinates for the entity’s bounding box.
Return type: tuple[float], length 10 |
|
cubit.get_tight_bounding_box(geometry_type, entity_list) Get the tight bounding box for a list of entities. vector_list = cubit.get_tight_bounding_box("surface", entity_list) Parameters:
Returns: A tuple of center point coordinates and axis definitions.
Return type: tuple[float], length 15 |
cubit.get_closest_node(x_coordinate, y_coordinate, z_coordinate) Get the node closest to the given coordinates Parameters:
Type: float Type: float Type: float Returns: id of closest node, 0 if none found Return type: int |
cubit.get_connectivity(entity_type, entity_id) Get the list of node ids contained within a mesh entity.
node_id_list = cubit.get_connectivity("hex", 221)
Parameters:
Returns: Tuple of node ids Return type: tuple[int] |
cubit.get_expanded_connectivity(entity_type, entity_id) Get the list of node ids contained within a mesh entity, including interior nodes.
node_id_list = cubit.get__expanded_connectivity("hex", 221)
Parameters:
Returns: Tuple of all node ids associated with the element, including interior (high-order) nodes Return type: tuple[int] |
cubit.get_element_type(element_id) Return the type of a given element Parameters: element_id – The element id (i.e. the global element export id) Returns: The type Return type: str |
cubit.get_geometry_owner(entity_type, entity_id) Get the geometric owner of this mesh element.
geom_owner = cubit.get_geometry_owner("hex", 221)
Parameters:
Returns: Name of owner Return type: str |
cubit.get_nodal_coordinates(node_id) Get the nodal coordinates for a given node id. Parameters: node_id – The node id Returns: A tuple containing the x, y, and z coordinates Return type: tuple[float], length 3 |