bluemira.builders.tools
A collection of tools used in the EU-DEMO design.
Functions
|
Apply color and transparency to a PhysicalComponent for both plotting and CAD. |
|
Get sector count and angle size for a given number of degrees of the reactor. |
|
Pattern the provided Component equally spaced around a circle n_children times. |
Pattern a silhouette with revolutions about the z-axis, inter-spaced with parallel |
|
Pattern a silhouette with lofts about the z-axis, inter-spaced with parallel |
|
|
Get the radial coordinates of a wire's intersection points with a plane. |
Make a circular annulus in the x-y plane (z=0) |
|
|
Build the x-y components of sectioned component |
|
Build the x-y-z components of sectioned component |
Module Contents
- bluemira.builders.tools.apply_component_display_options(phys_component: bluemira.base.components.PhysicalComponent, color: collections.abc.Iterable | bluemira.display.palettes.ColorPalette, transparency: float | None = None)
Apply color and transparency to a PhysicalComponent for both plotting and CAD.
- Parameters:
phys_component (bluemira.base.components.PhysicalComponent)
color (collections.abc.Iterable | bluemira.display.palettes.ColorPalette)
transparency (float | None)
- bluemira.builders.tools.get_n_sectors(no_obj: int, degree: float = 360) tuple[float, int]
Get sector count and angle size for a given number of degrees of the reactor.
- Parameters:
no_obj (int) – total number of components (eg TF coils)
degree (float) – angle to view of reactor
- Returns:
sector_degree – number of degrees per sector
n_sectors – number of sectors
- Return type:
tuple[float, int]
- bluemira.builders.tools.circular_pattern_component(component: bluemira.base.components.ComponentT | list[bluemira.base.components.ComponentT], n_children: int, parent_prefix: str = 'Sector', *, origin: tuple[float, float, float] = (0.0, 0.0, 0.0), direction: tuple[float, float, float] = (0.0, 0.0, 1.0), degree: float = 360.0) list[bluemira.base.components.ComponentT]
Pattern the provided Component equally spaced around a circle n_children times.
The resulting components are assigned to a set of common parent Components having a name with the structure “{parent_prefix} {idx}”, where idx runs from 1 to n_children. The Components produced under each parent are named according to the original Component with the corresponding idx value appended.
- Parameters:
component (bluemira.base.components.ComponentT | list[bluemira.base.components.ComponentT]) – The original Component to use as the template for copying around the circle.
n_children (int) – The number of children to produce around the circle.
parent_prefix (str) – The prefix to provide to the new parent component, having a name of the form “{parent_prefix} {idx}”, by default “Sector”.
origin (tuple[float, float, float]) – The origin of the circle to pattern around, by default (0., 0., 0.).
direction (tuple[float, float, float]) – The surface normal of the circle to pattern around, by default (0., 0., 1.) i.e. the positive z axis, resulting in a counter clockwise circle in the x-y plane.
degree (float) – The angular extent of the patterning in degrees, by default 360.
- Returns:
The patterned components
- Raises:
ComponentError – Could not find PhysicalComponent for a given sector
- Return type:
list[bluemira.base.components.ComponentT]
- bluemira.builders.tools.pattern_revolved_silhouette(face: bluemira.geometry.face.BluemiraFace, n_seg_p_sector: int, n_sectors: int, gap: float) list[bluemira.geometry.solid.BluemiraSolid]
Pattern a silhouette with revolutions about the z-axis, inter-spaced with parallel gaps between solids.
- Parameters:
face (bluemira.geometry.face.BluemiraFace) – x-z silhouette of the geometry to revolve and pattern
n_seg_p_sector (int) – Number of segments per sector
n_sectors (int) – Number of sectors
gap (float) – Absolute distance between segments (parallel)
- Returns:
List of solids for each segment (ordered anti-clockwise)
- Return type:
- bluemira.builders.tools.pattern_lofted_silhouette(face: bluemira.geometry.face.BluemiraFace, n_seg_p_sector: int, n_sectors: int, gap: float) list[bluemira.geometry.solid.BluemiraSolid]
Pattern a silhouette with lofts about the z-axis, inter-spaced with parallel gaps between solids.
- Parameters:
face (bluemira.geometry.face.BluemiraFace) – x-z silhouette of the geometry to loft and pattern
n_seg_p_sector (int) – Number of segments per sector
n_sectors (int) – Number of sectors
gap (float) – Absolute distance between segments (parallel)
- Return type:
List of solids for each segment (ordered anti-clockwise)
- bluemira.builders.tools.find_xy_plane_radii(wire: bluemira.geometry.wire.BluemiraWire, plane: bluemira.geometry.plane.BluemiraPlane) list[float]
Get the radial coordinates of a wire’s intersection points with a plane.
- Parameters:
wire (bluemira.geometry.wire.BluemiraWire) – Wire to get the radii for in the plane
plane (bluemira.geometry.plane.BluemiraPlane) – Plane to slice with
- Returns:
The radii of intersections, sorted from smallest to largest
- Return type:
list[float]
- bluemira.builders.tools.make_circular_xy_ring(r_inner: float, r_outer: float) bluemira.geometry.face.BluemiraFace
Make a circular annulus in the x-y plane (z=0)
- Returns:
The circular face
- Raises:
BuilderError – Radii must not be negative and thicker than D_TOLERANCE
- Parameters:
r_inner (float)
r_outer (float)
- Return type:
- bluemira.builders.tools.build_sectioned_xy(face: bluemira.geometry.face.BluemiraFace, plot_colour: tuple[float], material: matproplib.material.Material | None = None) list[bluemira.base.components.PhysicalComponent]
Build the x-y components of sectioned component
- Parameters:
face (bluemira.geometry.face.BluemiraFace) – xz face to build xy component
plot_colour (tuple[float]) – colour tuple for component
material (matproplib.material.Material | None) – Optional material to apply to physical component
- Returns:
List of PhysicalComponents with colours applied
- Return type:
- bluemira.builders.tools.build_sectioned_xyz(face: bluemira.geometry.face.BluemiraFace | list[bluemira.geometry.face.BluemiraFace], name: str | list[str], n_TF: int, plot_colour: tuple[float] | list[tuple[float]], degree: float = 360, *, enable_sectioning: bool = True, material: matproplib.material.Material | list[matproplib.material.Material | None] | None = None) list[bluemira.base.components.PhysicalComponent]
Build the x-y-z components of sectioned component
- Parameters:
face (bluemira.geometry.face.BluemiraFace | list[bluemira.geometry.face.BluemiraFace]) – xz face to build xyz component
name (str | list[str]) – PhysicalComponent name
n_TF (int) – number of TF coils
plot_colour (tuple[float] | list[tuple[float]]) – colour tuple for component
degree (float) – angle to sweep through
enable_sectioning (bool) – Switch on/off sectioning (#1319 Topology issue)
material (matproplib.material.Material | list[matproplib.material.Material | None] | None) – Optional material to apply to physical component
- Returns:
List of PhysicalComponents
- Raises:
ValueError – The lengths of face, name, plot_colour, and material must be equal
- Return type:
Notes
When enable_sectioning=False a list with a single component rotated a maximum of 359 degrees will be returned. This is a workaround for two issues from the topology naming issue #1319:
Some objects fail to be rebuilt when rotated
Some objects cant be rotated 360 degrees due to DisjointedFaceError