bluemira.builders.tools ======================= .. py:module:: bluemira.builders.tools .. autoapi-nested-parse:: A collection of tools used in the EU-DEMO design. Functions --------- .. autoapisummary:: bluemira.builders.tools.apply_component_display_options bluemira.builders.tools.get_n_sectors bluemira.builders.tools.circular_pattern_component bluemira.builders.tools.pattern_revolved_silhouette bluemira.builders.tools.pattern_lofted_silhouette bluemira.builders.tools.find_xy_plane_radii bluemira.builders.tools.make_circular_xy_ring bluemira.builders.tools.build_sectioned_xy bluemira.builders.tools.build_sectioned_xyz Module Contents --------------- .. py:function:: 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. .. py:function:: 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. :param no_obj: total number of components (eg TF coils) :param degree: angle to view of reactor :returns: * *sector_degree* -- number of degrees per sector * *n_sectors* -- number of sectors .. py:function:: 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. :param component: The original Component to use as the template for copying around the circle. :param n_children: The number of children to produce around the circle. :param parent_prefix: The prefix to provide to the new parent component, having a name of the form "{parent_prefix} {idx}", by default "Sector". :param origin: The origin of the circle to pattern around, by default (0., 0., 0.). :param direction: 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. :param degree: 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 .. py:function:: 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. :param face: x-z silhouette of the geometry to revolve and pattern :param n_seg_p_sector: Number of segments per sector :param n_sectors: Number of sectors :param gap: Absolute distance between segments (parallel) :returns: List of solids for each segment (ordered anti-clockwise) .. py:function:: 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. :param face: x-z silhouette of the geometry to loft and pattern :param n_seg_p_sector: Number of segments per sector :param n_sectors: Number of sectors :param gap: Absolute distance between segments (parallel) :rtype: List of solids for each segment (ordered anti-clockwise) .. py:function:: 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. :param wire: Wire to get the radii for in the plane :param plane: Plane to slice with :returns: The radii of intersections, sorted from smallest to largest .. py:function:: 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 .. py:function:: 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 :param face: xz face to build xy component :param plot_colour: colour tuple for component :param material: Optional material to apply to physical component :returns: List of PhysicalComponents with colours applied .. py:function:: 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 :param face: xz face to build xyz component :param name: PhysicalComponent name :param n_TF: number of TF coils :param plot_colour: colour tuple for component :param degree: angle to sweep through :param enable_sectioning: Switch on/off sectioning (#1319 Topology issue) :param material: 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 .. rubric:: 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