|
Cubit Python API 2026.6
|
Loading...
Searching...
No Matches
Defines a body object that mostly parallels Cubit's Body class. More...
Inheritance diagram for Body:
Public Member Functions | |
| get_mass_props (self) | |
| Get the center of gravity of the Body. | |
| is_sheet_body (self) | |
| Get whether the Body is a sheet body or not. | |
| point_containment (self, loc_in) | |
| Determine point containment relative to the Body. | |
| volume (self) | |
| Get the volume of the Body. | |
Public Member Functions inherited from GeomEntity | |
| 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
Defines a body object that mostly parallels Cubit's Body class.
Member Function Documentation
◆ get_mass_props()
| get_mass_props | ( | self | ) |
Get the center of gravity of the Body.
Computes and returns the mass properties of this Body, specifically the center of gravity coordinates.
.. code-block:: python
# Create and unite two bricks: a cube and a long rectangular brick
cubit.cmd("brick x 1 y 1 z 1")
cubit.cmd("brick x 10 y 1 z 1")
cubit.cmd("vol 2 move x 10")
cubit.cmd("unite vol all")
# Retrieve the unified body
b = cubit.body(1)
# Get geometric center and center of gravity
center_pt = b.center_point()
cg = b.get_mass_props()
print("Geometric center:", center_pt)
print("Center of gravity:", cg)
# Expected: geometric center != center of gravity
cmd(input_string)
Execute a raw Cubit command string immediately (modifies model state).
Definition cubit.py:5275
@n return type of : std:: array< double,3 >
- Returns
- : A std::array of three double values the x, y, and z coordinates of the Body's center of gravity.
◆ is_sheet_body()
| is_sheet_body | ( | self | ) |
Get whether the Body is a sheet body or not.
Determines if this Body represents a sheet (2D) geometry rather than a volume (3D).
.. code-block:: python
# Create a 3D brick (volume)
cubit.cmd("reset")
vol_body = cubit.brick(1)
print("Is sheet body?", vol_body.is_sheet_body()) # Expected output: False
# Create a 2D rectangular sheet via command
cubit.cmd("reset")
cubit.cmd("create surface rectangle width 1")
surf = cubit.surface(1)
# Extract the sheet body from the surface
sheet_bodies = surf.bodies()
sheet_body = sheet_bodies[0]
print("Is sheet body?", sheet_body.is_sheet_body()) # Expected output: True
brick(width, depth=-1, height=-1)
Create a brick of specified width, depth, and height.
Definition cubit.py:24090
@n return type of : boolean
- Returns
- True if the Body is a sheet body, False otherwise.
◆ point_containment()
| point_containment | ( | self, | |
| loc_in ) |
Determine point containment relative to the Body.
Checks whether a given point is inside, on, or outside this Body
.. code-block:: python
# Create a unit cube body (1x1x1) centered at origin (extends -0.5 to 0.5)
b = cubit.brick(1)
# Point strictly inside the volume
print("Inside:", b.point_containment([0.0, 0.0, 0.0])) # Expected output: 1
# Point on the boundary
print("On:", b.point_containment([0.5, 0.0, 0.0])) # Expected output: 2
# Point outside the volume
print("Outside:",b.point_containment([1.0, 0.0, 0.0])) # Expected output: 0
@n type of loc_in: std::array< double,3 >, in
- Parameters
-
loc_in A three-element array specifying the point coordinates (x, y, z).
return type of : int
- Returns
- : An integer code -1 if unknown, 0 if outside, 1 if inside, or 2 if on the boundary of the Body.
◆ volume()
| volume | ( | self | ) |
Get the volume of the Body.
Notes This function is only available on Body objects.
Returns the computed geometric volume of this Body.
.. code-block:: python
# Create a unit cube body (1x1x1)
b = cubit.brick(1)
# Compute and print its volume
vol = b.volume()
print("Body volume:", vol) # Expected output: 1.0
@n return type of : float
- Returns
- The volume of the Body.
Generated on Tue Jun 9 2026 13:00:43 for Cubit Python API by
Public Member Functions inherited from