Box#

final class Box[source]#

Bases: MultiConstructorBaseModel, _VolumeEntityBase

Box in three-dimensional space, defined by center, size, and rotation.

Example

>>> Box(
...     name="box",
...     axis_of_rotation=(1, 0, 0),
...     angle_of_rotation=45 * unyt.deg,
...     center=(1, 1, 1) * unyt.m,
...     size=(0.2, 0.3, 2) * unyt.m,
... )

Define a box using principal axes:

>>> Box.from_principal_axes(
...     name="box",
...     axes=[(0, 1, 0), (0, 0, 1)],
...     center=(0, 0, 0) * unyt.m,
...     size=(0.2, 0.3, 2) * unyt.m,
... )

Attributes

center: Any#

The coordinates of the center of the box.

size: Any#

The dimensions of the box (length, width, height).

Properties

axes: OrthogonalAxes | None#

Return the axes that the box is aligned with.

id: str#

Returns private_attribute_id of the entity.

Additional Constructors

classmethod from_principal_axes(name, center, size, axes)[source]#

Construct box from principal axes.

Parameters:
  • name (str)

  • center (Annotated[Any, BeforeValidator(func=~flow360_schema.framework.physical_dimensions.composers._create_validator.<locals>.validate, json_schema_input_type=PydanticUndefined), PlainSerializer(func=~flow360_schema.framework.physical_dimensions.composers._create_serializer.<locals>.serialize, return_type=PydanticUndefined, when_used=always), WithJsonSchema(json_schema={'type': 'object', 'properties': {'value': {'$ref': 'https://flexcompute.com/schemas/1.0.0/Vector3Json.json'}, 'units': {'type': 'string'}}, 'required': ['value', 'units'], 'additionalProperties': False}, mode=None)])

  • size (Annotated[Any, BeforeValidator(func=~flow360_schema.framework.physical_dimensions.composers._create_validator.<locals>.validate, json_schema_input_type=PydanticUndefined), PlainSerializer(func=~flow360_schema.framework.physical_dimensions.composers._create_serializer.<locals>.serialize, return_type=PydanticUndefined, when_used=always), WithJsonSchema(json_schema={'type': 'object', 'properties': {'value': {'$ref': 'https://flexcompute.com/schemas/1.0.0/PositiveVector3Json.json'}, 'units': {'type': 'string'}}, 'required': ['value', 'units'], 'additionalProperties': False}, mode=None)])

  • axes (Annotated[tuple[Axis, Axis], AfterValidator(func=~flow360_schema.models.entities.base._check_axis_is_orthogonal)])

Return type:

Self

classmethod from_file(filename)#

Load a Flow360BaseModel from a .json file.

Parameters:

filename (str)

Return type:

Flow360BaseModel

Methods

help(methods=False)#

Print fields and methods of a Flow360BaseModel using rich.

Parameters:

methods (bool)

Return type:

None

to_file(filename, **kwargs)#

Export Flow360BaseModel instance to a .json file.

Parameters:
Return type:

None