def create_components(self):

        plasma = paramak.Plasma(major_radius=self.major_radius,
                                minor_radius=self.minor_radius,
                                elongation=self.elongation,
                                triangularity=self.triangularity,
                                rotation_angle=self.rotation_angle)
        plasma.create_solid()

        inboard_firstwall = paramak.BlanketConstantThicknessFP(
            plasma=plasma,
            start_angle=90,
            stop_angle=270,
            offset_from_plasma=self.offset_from_plasma,
            thickness=self.firstwall_thickness,
            rotation_angle=self.rotation_angle,
            stp_filename='inboard_firstwall.stp'
        )

        outboard_firstwall = paramak.BlanketConstantThicknessFP(
            plasma=plasma,
            stop_angle=-70,
            start_angle=70,
            offset_from_plasma=self.offset_from_plasma,
            thickness=self.firstwall_thickness,
            rotation_angle=self.rotation_angle,
            stp_filename='outboard_firstwall.stp'
        )

        # The height of this center column is calculated using CadQuery commands
        center_column_shield = paramak.CenterColumnShieldCylinder(
            height=2*(plasma.high_point[1] + self.offset_from_plasma),
            inner_radius=self.center_column_shield_inner_radius,
            outer_radius=self.center_column_shield_outer_radius,
            rotation_angle=self.rotation_angle,
            # color=centre_column_color,
            stp_filename="center_column_shield.stp",
            material_tag="center_column_material",
        )

        inboard_tf_coils = paramak.InnerTfCoilsCircular(
            height=2*(plasma.high_point[1] + self.offset_from_plasma),
            outer_radius = self.center_column_shield_inner_radius,
            inner_radius = self.inner_bore,
            number_of_coils = self.number_of_tf_coils,
            gap_size=5,
            stp_filename="inboard_tf_coils.stp",
            material_tag="inboard_tf_coils_material",
        )

        self.shapes_and_components = [center_column_shield, plasma, inboard_firstwall,
                                      inboard_tf_coils, outboard_firstwall]
 def test_BlanketConstantThicknessFP_physical_groups(self):
     """Creates default blanket and checks the exports of physical groups
     """
     test_shape = paramak.BlanketConstantThicknessFP(
         100, stop_angle=90,
         start_angle=270,)
     test_shape.export_physical_groups('tests/blanket.json')
    def test_BlanketConstantThicknessFP_creation_noplasma(self):
        """creates blanket from parametric shape and checks a solid is created"""

        test_shape = paramak.BlanketConstantThicknessFP(
            major_radius=300,
            minor_radius=50,
            triangularity=0.5,
            elongation=2,
            thickness=200,
            stop_angle=90,
            start_angle=270,
        )

        assert test_shape.solid is not None
        assert test_shape.volume > 1000
    def test_BlanketConstantThicknessFP_full_cov_stp_export(self):
        """creates blanket from parametric shape and checks the STP export
        with full coverage"""

        test_shape = paramak.BlanketConstantThicknessFP(
            major_radius=300,
            minor_radius=50,
            triangularity=0.5,
            elongation=2,
            thickness=200,
            stop_angle=360,
            start_angle=0,
            rotation_angle=180
        )

        test_shape.export_stp("tests/test_blanket_full_cov")
def main():

    rot_angle = 180
    all_components = []

    plasma = paramak.Plasma(
        # default parameters
        rotation_angle=rot_angle,
        stp_filename='plasma_shape.stp')
    all_components.append(plasma)

    component = paramak.BlanketConstantThicknessFP(
        plasma=plasma,
        thickness=100,
        stop_angle=90,
        start_angle=-90,
        offset_from_plasma=30,
        rotation_angle=180,
        stp_filename='blanket_constant_thickness_outboard_plasma.stp')
    all_components.append(component)

    component = paramak.BlanketConstantThicknessFP(
        plasma=plasma,
        thickness=100,
        stop_angle=90,
        start_angle=250,
        offset_from_plasma=30,
        rotation_angle=180,
        stp_filename='blanket_constant_thickness_inboard_plasma.stp')
    all_components.append(component)

    component = paramak.BlanketConstantThicknessFP(
        plasma=plasma,
        thickness=100,
        stop_angle=250,
        start_angle=-90,
        offset_from_plasma=30,
        rotation_angle=180,
        stp_filename='blanket_constant_thickness_plasma.stp')
    all_components.append(component)

    component = paramak.ToroidalFieldCoilCoatHanger(
        horizontal_start_point=(200, 500),
        horizontal_length=400,
        vertical_start_point=(700, 50),
        vertical_length=500,
        thickness=50,
        distance=50,
        stp_filename='toroidal_field_coil_coat_hanger.stp',
        number_of_coils=5)
    all_components.append(component)

    component = paramak.CenterColumnShieldCylinder(
        inner_radius=80,
        outer_radius=100,
        height=300,
        rotation_angle=rot_angle,
        stp_filename='center_column_shield_cylinder.stp')
    all_components.append(component)

    component = paramak.CenterColumnShieldHyperbola(
        inner_radius=50,
        mid_radius=75,
        outer_radius=100,
        height=300,
        rotation_angle=rot_angle,
        stp_filename='center_column_shield_hyperbola.stp')
    all_components.append(component)

    component = paramak.CenterColumnShieldCircular(
        inner_radius=50,
        mid_radius=75,
        outer_radius=100,
        height=300,
        rotation_angle=rot_angle,
        stp_filename='center_column_shield_circular.stp')
    all_components.append(component)

    component = paramak.CenterColumnShieldFlatTopHyperbola(
        inner_radius=50,
        mid_radius=75,
        outer_radius=100,
        arc_height=220,
        height=300,
        rotation_angle=rot_angle,
        stp_filename='center_column_shield_flat_top_hyperbola.stp')
    all_components.append(component)

    component = paramak.CenterColumnShieldFlatTopCircular(
        inner_radius=50,
        mid_radius=75,
        outer_radius=100,
        arc_height=220,
        height=300,
        rotation_angle=rot_angle,
        stp_filename='center_column_shield_flat_top_Circular.stp')
    all_components.append(component)

    component = paramak.CenterColumnShieldPlasmaHyperbola(
        inner_radius=150,
        mid_offset=50,
        edge_offset=40,
        height=800,
        rotation_angle=rot_angle,
        stp_filename='center_column_shield_plasma_hyperbola.stp')
    all_components.append(component)

    #

    # component = paramak.DivertorBlock(
    #     major_radius = 800,
    #     minor_radius = 400,
    #     triangularity = 1.2,
    #     elongation = 0.9,
    #     thickness = 50,
    #     offset_from_plasma = 20,
    #     start
    # )

    component = paramak.InnerTfCoilsCircular(
        inner_radius=25,
        outer_radius=100,
        number_of_coils=10,
        gap_size=5,
        height=300,
        stp_filename='inner_tf_coils_circular.stp')
    all_components.append(component)

    component = paramak.InnerTfCoilsFlat(
        inner_radius=25,
        outer_radius=100,
        number_of_coils=10,
        gap_size=5,
        height=300,
        stp_filename='inner_tf_coils_flat.stp')
    all_components.append(component)

    pf_coil = paramak.PoloidalFieldCoil(center_point=(100, 100),
                                        height=20,
                                        width=20,
                                        rotation_angle=rot_angle,
                                        stp_filename='poloidal_field_coil.stp')
    all_components.append(pf_coil)

    component = paramak.PoloidalFieldCoilCaseFC(
        pf_coil=pf_coil,
        casing_thickness=10,
        rotation_angle=rot_angle,
        stp_filename='poloidal_field_coil_case_fc.stp')
    all_components.append(component)

    component = paramak.PoloidalFieldCoilCase(
        center_point=(100, 100),
        coil_height=20,
        coil_width=20,
        casing_thickness=10,
        rotation_angle=rot_angle,
        stp_filename='poloidal_field_coil_case.stp')
    all_components.append(component)

    component = paramak.BlanketConstantThicknessArcV(
        inner_lower_point=(300, -200),
        inner_mid_point=(500, 0),
        inner_upper_point=(300, 200),
        thickness=100,
        rotation_angle=rot_angle,
        stp_filename='blanket_arc_v.stp')
    all_components.append(component)

    component = paramak.BlanketConstantThicknessArcH(
        inner_lower_point=(300, -200),
        inner_mid_point=(400, 0),
        inner_upper_point=(300, 200),
        thickness=100,
        rotation_angle=rot_angle,
        stp_filename='blanket_arc_h.stp')
    all_components.append(component)

    component = paramak.ToroidalFieldCoilRectangle(
        inner_upper_point=(100, 700),
        inner_mid_point=(800, 0),
        inner_lower_point=(100, -700),
        thickness=150,
        distance=60,
        stp_filename='tf_coil_rectangle.stp',
        number_of_coils=6)
    all_components.append(component)

    component = paramak.ITERtypeDivertor(
        # default parameters
        rotation_angle=rot_angle,
        stp_filename='ITER_type_divertor.stp')
    all_components.append(component)

    return all_components