Loft

class Loft

Bases: CommonBaseModel

Represents a lofted surface, a smooth spatial surface generated by transitioning between multiple spline curves.

In engineering and design, lofts are used to create complex shapes by smoothly connecting a series of cross-sectional profiles. This class enables the representation of lofted surfaces, facilitating their use in computational modeling, simulation, and visualization of aerodynamic shapes, product designs, and more.

splines

A series of splines defining the shapes to interpolate for the loft.

Type:

List[Spline]

num_samples

The number of sample points to generate along each spline.

Type:

int

metadata

Additional metadata for the loft.

Type:

Metadata

Attributes Summary

model_config

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

Methods Summary

add_spline(spline)

Add a new spline to the series of cross-sectional profiles, potentially altering the shape of the lofted surface.

calculate_surface()

Calculate the lofted surface by interpolating between the splines.

validate_num_samples(value)

Validate the 'num_samples' field to ensure it is a positive integer.

validate_splines(value)

Validate the 'splines' list to ensure it contains at least two splines with the same degree.

Attributes Documentation

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'extra': 'allow', 'protected_namespaces': (), 'validate_assignment': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

Methods Documentation

add_spline(spline)

Add a new spline to the series of cross-sectional profiles, potentially altering the shape of the lofted surface.

Parameters:

spline (Spline) – The new spline to be added to the series defining the loft.

Return type:

None

calculate_surface()

Calculate the lofted surface by interpolating between the splines.

This method generates a series of intermediate curves by interpolating between the given splines, creating a smooth surface that transitions from one cross-sectional profile to another.

Returns:

A list of lists representing the lofted surface points, where each inner list represents a point on the surface with [x, y, z] coordinates.

Return type:

List[List[float]]

classmethod validate_num_samples(value)

Validate the ‘num_samples’ field to ensure it is a positive integer.

Parameters:

value (int) – The number of samples being validated.

Returns:

The validated number of samples.

Raises:

ValueError – If the number of samples is not a positive integer.

Return type:

int

classmethod validate_splines(value)

Validate the ‘splines’ list to ensure it contains at least two splines with the same degree.

Parameters:

value (List[Spline]) – The list of splines being validated.

Returns:

The validated list of splines.

Raises:

ValueError – If the list contains fewer than two splines or if the splines have different degrees.

Return type:

List[Spline]

Methods:

validate_splines(value)

Validate the 'splines' list to ensure it contains at least two splines with the same degree.

validate_num_samples(value)

Validate the 'num_samples' field to ensure it is a positive integer.

add_spline(spline)

Add a new spline to the series of cross-sectional profiles, potentially altering the shape of the lofted surface.

calculate_surface()

Calculate the lofted surface by interpolating between the splines.

Attributes:

__pydantic_setattr_handlers__

__setattr__ handlers.

classmethod validate_splines(value)

Validate the ‘splines’ list to ensure it contains at least two splines with the same degree.

Parameters:

value (List[Spline]) – The list of splines being validated.

Returns:

The validated list of splines.

Raises:

ValueError – If the list contains fewer than two splines or if the splines have different degrees.

Return type:

List[Spline]

classmethod validate_num_samples(value)

Validate the ‘num_samples’ field to ensure it is a positive integer.

Parameters:

value (int) – The number of samples being validated.

Returns:

The validated number of samples.

Raises:

ValueError – If the number of samples is not a positive integer.

Return type:

int

add_spline(spline)

Add a new spline to the series of cross-sectional profiles, potentially altering the shape of the lofted surface.

Parameters:

spline (Spline) – The new spline to be added to the series defining the loft.

Return type:

None

calculate_surface()

Calculate the lofted surface by interpolating between the splines.

This method generates a series of intermediate curves by interpolating between the given splines, creating a smooth surface that transitions from one cross-sectional profile to another.

Returns:

A list of lists representing the lofted surface points, where each inner list represents a point on the surface with [x, y, z] coordinates.

Return type:

List[List[float]]

__pydantic_setattr_handlers__: ClassVar[Dict[str, Callable[[BaseModel, str, Any], None]]] = {}

__setattr__ handlers. Memoizing the handlers leads to a dramatic performance improvement in __setattr__