Cubit Python API  17.05
Public Member Functions
Entity

The base class of all the geometry and mesh types. More...

Inheritance diagram for Entity:
GeomEntity Body Curve Surface Vertex Volume

Public Member Functions

def  bounding_box (self)
  Returns the axis-aligned bounding box of the Entity. More...
 
def  center_point (self)
  Returns the geometric center point of the Entity. More...
 
def  id (self)
  Retrieves the unique identifier of the Entity. More...
 

Detailed Description

The base class of all the geometry and mesh types.

.. code-block:: python

import cubit
br = cubit.brick (1,1,1)
cubit.scale (br,2)
cubit.cmd ('delete body 1' )

Member Function Documentation

◆ bounding_box()

def bounding_box (   self )

Returns the axis-aligned bounding box of the Entity .

Computes the minimum and maximum coordinates of the Entityxs geometry in X, Y, and Z directions.

         .. code-block:: python
# Create a half-sphere of radius 1 cut by the YZ-plane
halfSphere = cubit.sphere (1.0, 1)
# Compute bounding box as a list [minX, minY, minZ, maxX, maxY, maxZ]
bbox = halfSphere.bounding_box()
print(f"Bounding Box: [{bbox[0]}, {bbox[1]}, {bbox[2]}] to [{bbox[3]}, {bbox[4]}, {bbox[5]}]" ) # prints [0, -1, -1] to [1, 1, 1]
        @n return type of : std:: array< double,6 >
Returns
: An array (or list) of six values minX, minY, minZ, maxX, maxY, maxZ.

◆ center_point()

def center_point (   self )

Returns the geometric center point of the Entity .

Computes the centroid of the Entityxs geometry based on its current position.

         .. code-block:: python
# Create a unit cube (center at origin)
b = cubit.brick (1.0, 1.0, 1.0)
# Check original center
center = b.center_point()
print(f"Original Center: ({center[0]}, {center[1]}, {center[2]})" ) # prints (0, 0, 0)
# Move the cube by (1, 2, 3)
cubit.move (b, [1.0, 2.0, 3.0], False )
# Check new center
center = b.center_point()
print(f"New Center: ({center[0]}, {center[1]}, {center[2]})" ) # prints (1, 2, 3)
        @n return type of : std:: array< double,3 >
Returns
: An array (or list) of three values x, y, and z coordinates of the Entityxs center.

◆ id()

def id (   self )

Retrieves the unique identifier of the Entity .

Returns the integer ID assigned to the Entity upon creation.

         .. code-block:: python
# Create a unit cube
b = cubit.brick (1.0, 1.0, 1.0)
# Get and print its ID
id = b.id()
print("Entity ID:" , id) # prints 1
        @n return type of :  int
Returns
The integer ID of the Entity.