Cubit Python API 2026.6
Loading...
Searching...
No Matches

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

 bodies (self)
 Retrieve bodies contained within the geometry entity.

 
 curves (self)
 Retrieve curves (edges) associated with the geometry entity.

 
 dimension (self)
 Get the topological dimension of the geometry entity.

 
 entity_name (self)
 Retrieve the primary name of the geometry entity.

 
 entity_names (self)
 Retrieve all names assigned to the geometry entity.

 
 is_meshed (self)
 Returns the current mesh state of the GeomEntity.

 
 is_transparent (self)
 Get the transparency state of the geometry entity.

 
 is_visible (self)
 Get the visibility state of the geometry entity.

 
 mesh (self)
 Generates mesh on a GeomEntity and verifies meshing status.

 
 num_names (self)
 Get the count of names assigned to the geometry entity.

 
 remove_entity_name (self, name)
 Remove a specific name from the geometry entity.

 
 remove_entity_names (self)
 Remove all non-default names from the geometry entity.

 
 remove_mesh (self)
 Remove any mesh associated with the geometry entity.

 
 set_entity_name (self, name)
 Assign a name to the geometry entity.

 
 set_transparent (self, transparency_flag)
 Set the transparency state of the geometry entity.

 
 set_visible (self, visibility_flag)
 Set and verify the visibility state of the geometry entity.

 
 smooth (self)
 Smooths the mesh on a GeomEntity to improve element quality.

 
 surfaces (self)
 Retrieve surfaces associated with the geometry entity.

 
 vertices (self)
 Retrieve vertices (points) associated with the geometry entity.

 
 volumes (self)
 Retrieve volumes associated with the geometry entity.

 
- Public Member Functions inherited from Entity
 bounding_box (self)
 Returns the axis-aligned bounding box of the Entity.

 
 center_point (self)
 Returns the geometric center point of the Entity.

 
 id (self)
 Retrieves the unique identifier of the Entity.

 

Detailed Description

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

Member Function Documentation

◆ bodies()

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
cmd(input_string)
Execute a raw Cubit command string immediately (modifies model state).
Definition cubit.py:5275
surface(id_in)
Retrieve a surface object by its ID.
Definition cubit.py:23968
        @n return type of : std::vector< CubitInterface::Body,std::allocator< CubitInterface:: Body > >
Returns
A vector (list) of Body objects contained within the GeomEntity.

◆ curves()

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
# 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
brick(width, depth=-1, height=-1)
Create a brick of specified width, depth, and height.
Definition cubit.py:24090
        @n return type of : std::vector< CubitInterface::Curve,std::allocator< CubitInterface:: Curve > >
Returns
A vector (list) of Curve objects associated with this GeomEntity.

◆ dimension()

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
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()
cylinder(height, x_radius, y_radius, top_radius)
Create a cylinder or truncated cone of specified dimensions.
Definition cubit.py:24260

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()

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.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()

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.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()

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()

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
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()

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.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()

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()

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.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()

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.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
nameThe specific name to remove from this GeomEntity.

◆ remove_entity_names()

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.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()

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.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())
get_hex_count()
Retrieve the count of hexahedral elements in the current model.
Definition cubit.py:9450

◆ set_entity_name()

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.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
nameThe name to be assigned to the GeomEntity.

◆ set_transparent()

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)
# 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_flagThe flag (1 for transparent, 0 for opaque) to set the render transparency state.

◆ set_visible()

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
# 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_flagThe flag to set whether the Entity is visible (true) or hidden (false).

◆ smooth()

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")
sphere(radius, x_cut=0, y_cut=0, z_cut=0, inner_radius=0)
Create all or part of a sphere.
Definition cubit.py:24145

◆ surfaces()

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
# 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()

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
# 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()

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
# 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.