bluemira.base.builder

Interfaces for builder classes.

Attributes

BuildConfig

Type alias for representing nested build configuration information.

Classes

Builder

Base class for component builders.

Module Contents

type bluemira.base.builder.BuildConfig = dict[str, int | float | str | 'BuildConfig']

Type alias for representing nested build configuration information.

class bluemira.base.builder.Builder(params: bluemira.base.parameter_frame.typed.ParameterFrameLike, build_config: dict | None = None, *, verbose=True)

Bases: abc.ABC

Inheritance diagram of bluemira.base.builder.Builder

Base class for component builders.

Parameters:
  • params (bluemira.base.parameter_frame.typed.ParameterFrameLike) – The parameters required by the builder.

  • build_config (dict | None) – The build configuration for the builder.

  • verbose – control how much logging the designer will output

Notes

If there are no parameters associated with a concrete builder, set param_cls to None and pass None into this class’s constructor.

params
build_config
name
build
property param_cls: type[bluemira.base.parameter_frame.ParameterFrame] | None
Abstractmethod:

Return type:

type[bluemira.base.parameter_frame.ParameterFrame] | None

The class to hold this Builders’s parameters.

get_material(component_name: str | None = None) matproplib.material.Material | None

Get the material for a component from the build config.

This will lookup the component_name in the “material” section of the build config to get the material name. It will then use that to get the corresponding material from the material cache.

If no component_name is given, it’s assumed the material name is directly given by the “material” key in the build config.

See establish_material_cache and get_cached_material for more information on how the material cache is used.

If no material is found or there is no “material” key in the build_config, a warning is raised and None returned.

Parameters:

component_name (str | None) – The name of the component.

Returns:

The material for the component.

Raises:

MaterialsError – If the material build config is not a string when no component name is given.

Return type:

matproplib.material.Material | None

component_tree(xz: list[bluemira.base.components.ComponentT] | None, xy: list[bluemira.base.components.ComponentT] | None, xyz: list[bluemira.base.components.ComponentT] | None) bluemira.base.components.Component

Adds views of components to an overall component tree.

Parameters:
  • xz (list[bluemira.base.components.ComponentT] | None) – xz view of component

  • xy (list[bluemira.base.components.ComponentT] | None) – xy view of component

  • xyz (list[bluemira.base.components.ComponentT] | None) – xyz view of component

Returns:

The component tree

Return type:

component