Box#

final class Box[source]#

Bases: MultiConstructorBaseModel, _VolumeEntityBase

Box class represents a box in three-dimensional space.

Example

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

Define a box using principal axes:

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

Attributes

name: str#
center: LengthType.Vector#

The coordinates of the center of the box.

size: LengthType.PositiveVector#

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

axis_of_rotation: Axis#

The rotation axis. Cannot change once specified.

Default:

(0, 0, 1)

angle_of_rotation: AngleType#

The rotation angle. Cannot change once specified.

Default:

0 * degree

Properties

axes#

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[_VectorType, PlainSerializer(func=~flow360.component.simulation.unit_system._dimensioned_type_serializer, return_type=PydanticUndefined, when_used=always)])

  • size (Annotated[_VectorType, PlainSerializer(func=~flow360.component.simulation.unit_system._dimensioned_type_serializer, return_type=PydanticUndefined, when_used=always)])

  • axes (Annotated[Tuple[Axis, Axis], AfterValidator(func=~flow360.component.simulation.primitives._check_axis_is_orthogonal)])

classmethod from_file(filename)#

Loads a Flow360BaseModel from .json, or .yaml file.

Parameters:

filename (str) – Full path to the .yaml or .json file to load the Flow360BaseModel from.

Returns:

An instance of the component class calling load.

Return type:

Flow360BaseModel

Example

>>> params = Flow360BaseModel.from_file(filename='folder/sim.json') 

Methods

help(methods=False)#

Prints message describing the fields and methods of a Flow360BaseModel.

Parameters:

methods (bool = False) – Whether to also print out information about object’s methods.

Return type:

None

Example

>>> params.help(methods=True) 
to_file(filename, **kwargs)#

Exports Flow360BaseModel instance to .json or .yaml file

Parameters:

filename (str) – Full path to the .json or .yaml or file to save the Flow360BaseModel to.

Return type:

None

Example

>>> params.to_file(filename='folder/flow360.json')