Cubit Python API  17.05
Public Member Functions
GeomEntity

The base class for specifically the Geometry types (Body , Surface , etc.) More...

Inheritance diagram for GeomEntity:
Entity Body Curve Surface Vertex Volume

Public Member Functions

def  bodies (self)
  Retrieve bodies contained within the geometry entity. More...
 
def  curves (self)
  Retrieve curves (edges) associated with the geometry entity. More...
 
def  dimension (self)
  Get the topological dimension of the geometry entity. More...
 
def  entity_name (self)
  Retrieve the primary name of the geometry entity. More...
 
def  entity_names (self)
  Retrieve all names assigned to the geometry entity. More...
 
def  is_meshed (self)
  Returns the current mesh state of the GeomEntity. More...
 
def  is_transparent (self)
  Get the transparency state of the geometry entity. More...
 
def  is_visible (self)
  Get the visibility state of the geometry entity. More...
 
def  mesh (self)
  Generates mesh on a GeomEntity and verifies meshing status. More...
 
def  num_names (self)
  Get the count of names assigned to the geometry entity. More...
 
def  remove_entity_name (self, name)
  Remove a specific name from the geometry entity. More...
 
def  remove_entity_names (self)
  Remove all non-default names from the geometry entity. More...
 
def  remove_mesh (self)
  Remove any mesh associated with the geometry entity. More...
 
def  set_entity_name (self, name)
  Assign a name to the geometry entity. More...
 
def  set_transparent (self, transparency_flag)
  Set the transparency state of the geometry entity. More...
 
def  set_visible (self, visibility_flag)
  Set and verify the visibility state of the geometry entity. More...
 
def  smooth (self)
  Smooths the mesh on a GeomEntity to improve element quality. More...
 
def  surfaces (self)
  Retrieve surfaces associated with the geometry entity. More...
 
def  vertices (self)
  Retrieve vertices (points) associated with the geometry entity. More...
 
def  volumes (self)
  Retrieve volumes associated with the geometry entity. More...
 
- Public Member Functions inherited from Entity
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 for specifically the Geometry types (Body , Surface , etc.)

Member Function Documentation

◆ bodies()

def bodies (   self )

Retrieve bodies contained within the geometry entity.

Returns a list of Body objects associated with this GeomEntity , such as sheet bodies from a surface or volumes from a body.

         .. code-block:: python
# Create a 2D rectangular sheet via a Cubit command
cubit.cmd ("create surface rectangle width 1" )
# Get the surface entity by its ID
surf = cubit.surface (1)
# Retrieve sheet bodies associated with this surface
bodies = surf.bodies()
print("Number of bodies:" , len(bodies)) # Expected output: 1
        @n return type of : std::vector< CubitInterface::Body,std::allocator< CubitInterface:: Body > >
Returns
A vector (list) of Body objects contained within the GeomEntity.

◆ curves()

def curves (   self )

Retrieve curves (edges) associated with the geometry entity.

Returns a list of Curve objects that bound this GeomEntity , such as the edges of a brick or boundary curves of surfaces.

         .. code-block:: python
# Create a brick which has edges as curves
b = cubit.brick (1)
# Retrieve all curves (edges) of the brick
curves = b.curves()
print("Number of curves:" , len(curves)) # Expected output: 12
# Access the first curve and query its dimension
c = curves[0]
print("Curve dimension:" , c.dimension()) # Expected output: 1
        @n return type of : std::vector< CubitInterface::Curve,std::allocator< CubitInterface:: Curve > >
Returns
A vector (list) of Curve objects associated with this GeomEntity.

◆ dimension()

def dimension (   self )

Get the topological dimension of the geometry entity.

Returns the dimension (0 for Vertex , 1 for Curve , 2 for Surface , 3 for Volume/Body) of this GeomEntity .

         .. code-block:: python
# Create a brick and query its dimension
b = cubit.brick (1)
print("Body dimension:" , b.dimension()) # Expected output: 3
# Create a cylinder and query its dimension
cyl = cubit.cylinder (0.5, 2.0)
print("Cylinder dimension:" , cyl.dimension()) # Expected output: 3
# Retrieve boundary curves of the cylinder and query their dimensions
curves = cyl.curves()

for c in curves: print("Curve dimension:", c.dimension()) # Expected output: 1

         @n return type of :  int
Returns
The topological dimension of the GeomEntity (0x3).

◆ entity_name()

def entity_name (   self )

Retrieve the primary name of the geometry entity.

Returns the first name assigned to this GeomEntity , useful for identification and labeling.

         .. code-block:: python
# Create a brick, set its name, and retrieve it
b = cubit.brick (1)
b.set_entity_name("MyBrick" )
name = b.entity_name()
print("Entity name:" , name)
        @n return type of :  string
Returns
The first name of the GeomEntity.

◆ entity_names()

def entity_names (   self )

Retrieve all names assigned to the geometry entity.

Returns a list of every name that has been assigned to this GeomEntity , allowing enumeration of aliases or prior identifiers.

         .. code-block:: python
# Create a brick, assign two names, and list them
b = cubit.brick (1)
b.set_entity_name("BrickA" )
b.set_entity_name("PrimaryBrick" )
names = b.entity_names()

for n in names: print("Name:", n)

         @n return type of : std::vector< std::string,std::allocator< std:: string > >
Returns
A vector (list) of all names assigned to the GeomEntity.

◆ is_meshed()

def is_meshed (   self )

Returns the current mesh state of the GeomEntity .

Indicates whether the GeomEntity has mesh elements defined.

         .. code-block:: python
# Create and mesh a 10x10x10 brick
b = cubit.brick (10.0, 10.0, 10.0)
b.mesh()
# Check mesh state
meshed = b.is_meshed()
print("Meshed:" , meshed) # prints True
        @n return type of :  boolean
Returns
True if the GeomEntity is meshed, false otherwise.

◆ is_transparent()

def is_transparent (   self )

Get the transparency state of the geometry entity.

Returns whether this GeomEntity is currently rendered as transparent ( 1 ) or opaque ( 0 ).

         .. code-block:: python
# Create a brick and query default transparency
b = cubit.brick (1)
print("Is brick transparent?" , b.is_transparent()) # Expected output: 1
        @n return type of :  int
Returns
The current transparency state of the GeomEntity ( 1 if transparent, 0 if opaque).

◆ is_visible()

def is_visible (   self )

Get the visibility state of the geometry entity.

Returns whether this GeomEntity is currently visible in the viewport (1) or hidden (0).

         .. code-block:: python
# Create a brick and hide it
b = cubit.brick (1)
b.set_visible(False )
# Query visibility state
vis = b.is_visible()
print("Is brick visible?" , vis) # Expected output: False
        @n return type of :  int
Returns
The current visibility state of the GeomEntity (1 if visible, 0 if hidden).

◆ mesh()

def mesh (   self )

Generates mesh on a GeomEntity and verifies meshing status.

Discretizes the geometry of the given GeomEntity (e.g., surface, volume) into mesh elements. Use is_meshed to verify if meshing has been performed on the entity.

         .. code-block:: python
# Create a 10x10x10 brick
b = cubit.brick (10.0, 10.0, 10.0)
# Generate mesh on the volume
b.mesh()
# Verify that meshing has occurred
meshed = b.is_meshed()
print("Mesh generated:" , meshed) # prints True

◆ num_names()

def num_names (   self )

Get the count of names assigned to the geometry entity.

Returns the number of names currently assigned to this GeomEntity for tracking aliases or identifiers.

         .. code-block:: python
# Create a brick, assign two names, and get the name count
b = cubit.brick (1)
b.set_entity_name("BrickA" )
b.set_entity_name("PrimaryBrick" )
count = b.num_names()
print("Name count:" , count)
        @n return type of :  int
Returns
The number of names assigned to the GeomEntity.

◆ remove_entity_name()

def remove_entity_name (   self,
  name 
)

Remove a specific name from the geometry entity.

Deletes one of the names previously assigned to this GeomEntity , preserving any other names.

         .. code-block:: python
# Create a brick, assign two names, remove one, and list remaining names
b = cubit.brick (1)
b.set_entity_name("BrickA" )
b.set_entity_name("PrimaryBrick" )
# Remove the first assigned name
b.remove_entity_name("BrickA" )
# Verify remaining names
names = b.entity_names()

for n in names: print("Remaining name:", n)

         @n type of name:  string, in
Parameters
name The specific name to remove from this GeomEntity.

◆ remove_entity_names()

def remove_entity_names (   self )

Remove all non-default names from the geometry entity.

Deletes every custom name assigned to this GeomEntity , preserving its inherent default name.

         .. code-block:: python
# Create a brick, assign two custom names, then remove them and verify
b = cubit.brick (1)
b.set_entity_name("BrickA" )
b.set_entity_name("PrimaryBrick" )
# Initial name count (default + 2 custom names)
print("Before removal, name count:" , b.num_names())
# Expected output: 3
# Remove all custom names
b.remove_entity_names()
# Verify only default name remains
print("After removal, name count:" , b.num_names())
# Expected output: 1

◆ remove_mesh()

def remove_mesh (   self )

Remove any mesh associated with the geometry entity.

Deletes the mesh on a GeomEntity

         .. code-block:: python
# Create a brick and mesh it
b = cubit.brick (1)
b.mesh()
# Check the number of hexes that were created
print("Hex count:" , cubit.get_hex_count ())
# Delete the mesh on the brick
b.remove_mesh()
# Check that the number of elements is 0
print("Hex count:" , cubit.get_hex_count ())

◆ set_entity_name()

def set_entity_name (   self,
  name 
)

Assign a name to the geometry entity.

Sets the primary name of this GeomEntity for identification and labeling.

         .. code-block:: python
# Create a brick and set its name
b = cubit.brick (1)
b.set_entity_name("Brick1" )
# Retrieve and print the assigned name
name = b.entity_name()
print("Entity name:" , name)
        @n type of name:  string, in
Parameters
name The name to be assigned to the GeomEntity.

◆ set_transparent()

def set_transparent (   self,
  transparency_flag 
)

Set the transparency state of the geometry entity.

Toggles whether this GeomEntity is rendered with transparency. Passing 1 makes it transparent; 0 makes it opaque. The default state upon creation is transparent.

         .. code-block:: python
# Create a brick (default is transparent)
b = cubit.brick (1)
# Turn transparency off
b.set_transparent(0)
print("Is brick transparent?" , b.is_transparent()) # Expected output: 0
# Turn transparency back on
b.set_transparent(1)
print("Is brick transparent?" , b.is_transparent()) # Expected output: 1
        @n type of transparency_flag:  int, in
Parameters
transparency_flag The flag ( 1 for transparent, 0 for opaque) to set the render transparency state.

◆ set_visible()

def set_visible (   self,
  visibility_flag 
)

Set and verify the visibility state of the geometry entity.

Toggles whether this GeomEntity is rendered in the viewport. Passing true makes it visible; false hides it. Use is_visible() to query the current state.

         .. code-block:: python
# Create a brick
b = cubit.brick (1)
# Hide the brick and verify
b.set_visible(False )
print("Is brick visible?" , b.is_visible()) # Expected output: False
# Show the brick and re-verify
b.set_visible(True )
print("Is brick visible?" , b.is_visible()) # Expected output: True
        @n type of visibility_flag:  boolean, in
Parameters
visibility_flag The flag to set whether the Entity is visible ( true) or hidden ( false).

◆ smooth()

def smooth (   self )

Smooths the mesh on a GeomEntity to improve element quality.

Applies mesh smoothing to the existing mesh on the GeomEntity . Requires that the entity has already been meshed ( is_meshed() returns true). Smoothing method is based on the scheme currently set on the geomEntity (ie. Laplacian, Mean Ratio, etc.)

         .. code-block:: python
# create a sphere with radius 1
sphere_body = cubit.sphere (1)
# get the surface from the sphere body
sphere_surf = sphere_body.surfaces()[0]
# set the meshing scheme to trimesh
cubit.cmd (f"surface {sphere_surf.id()} scheme trimesh" )
# set the smoothing scheme to mean ratio
cubit.cmd (f"surface {sphere_surf.id()} smooth scheme mean ratio" )
# mesh the surface with triangles
sphere_surf.mesh()
# check the quality and display the result
cubit.cmd ("quality surf all draw mesh" )
# smooth the surface mesh
sphere_surf.smooth()
# display the new quality after smoothing
cubit.cmd ("quality surf all draw mesh" )

◆ surfaces()

def surfaces (   self )

Retrieve surfaces associated with the geometry entity.

Returns a list of Surface objects that bound this GeomEntity , such as the faces of a brick.

         .. code-block:: python
# Create a brick which generates a volume
b = cubit.brick (1)
# Retrieve boundary surfaces from the body
surfaces = b.surfaces()
print("Number of surfaces:" , len(surfaces)) # Expected output: 6
# Access the first surface and query its dimension
s = surfaces[0]
print("Surface dimension:" , s.dimension()) # Expected output: 2
        @n return type of : std::vector< CubitInterface::Surface,std::allocator< CubitInterface:: Surface > >
Returns
A vector (list) of Surface objects associated with this GeomEntity.

◆ vertices()

def vertices (   self )

Retrieve vertices (points) associated with the geometry entity.

Returns a list of Vertex objects that bound this GeomEntity , such as the corners of a brick.

         .. code-block:: python
# Create a brick which generates a volume
b = cubit.brick (1)
# Retrieve vertices from the body
vertices = b.vertices()
print("Number of vertices:" , len(vertices)) # Expected output: 8
# Access the first vertex and query its dimension
v = vertices[0]
print("Vertex dimension:" , v.dimension()) # Expected output: 0
        @n return type of : std::vector< CubitInterface::Vertex,std::allocator< CubitInterface:: Vertex > >
Returns
A vector (list) of Vertex objects associated with this GeomEntity.

◆ volumes()

def volumes (   self )

Retrieve volumes associated with the geometry entity.

Returns a list of Volume objects associated with this GeomEntity , such as the volume created by a brick.

         .. code-block:: python
# Create a brick which generates a volume
b = cubit.brick (1)
# Retrieve volumes from the body
volumes = b.volumes()
print("Number of volumes:" , len(volumes)) # Expected output: 1
# Access the first volume and query its dimension
vol = volumes[0]
print("Volume dimension:" , vol.dimension()) # Expected output: 3
        @n return type of : std::vector< CubitInterface::Volume,std::allocator< CubitInterface:: Volume > >
Returns
A vector (list) of Volume objects associated with this GeomEntity.