def update_boom_3D(workflow=None):
    boom_list = read_boom_objects()
    for l in boom_list:
        design_type_, boom_type_ = get_boom_object_data(l)
        generate_boom_3D_model(workflow,
                               name=l,
                               boom_type_=boom_type_,
                               design_type_=design_type_)
def update_boom_3d(config=None):
    boom_list = read_boom_objects()
    lofts = {}
    try:
        for l in boom_list:
            design_type_, boom_type_ = get_boom_object_data(l)
            lofts.update({
                l:
                generate_boom_3D_model(config,
                                       name=l,
                                       boom_type_=boom_type_,
                                       design_type_=design_type_)
            })
    except:
        pass
    return lofts
    def __init__(self):
        super().__init__()

        self.selection_ = None
        self.layout = QFormLayout(self)

        self.itemsComboBox = QComboBox()
        self.itemsComboBox.addItems(read_boom_objects())
        self.itemsComboBox.currentIndexChanged.connect(self.selectionChanged)
        self.layout.addRow(self.itemsComboBox)
        self.buttons = QDialogButtonBox(
            QDialogButtonBox.Ok | QDialogButtonBox.Cancel, Qt.Horizontal, self)
        self.buttons.accepted.connect(self.accept)
        self.buttons.rejected.connect(self.reject)
        self.layout.addRow(self.buttons)
        self.setLayout(self.layout)
    def load_booms(self):
        try:
            boom_list = read_boom_objects()
            if len(boom_list) == 0:
                self.new_boom()
            for l in boom_list:
                design_type_, boom_type_ = get_boom_object_data(l)
                if design_type_ == unconventional_design:
                    self.boom_tab_ = boom_tab(l, boom_type_, design_type_)
                    self.booms.append(self.boom_tab_)
                    self.booms.append(self.boom_tab_)
                    self.inputArea.addTab(self.boom_tab_, l)
                    self.indexes.append(l)
                elif design_type_ == conventional_design:
                    self.boom_tab_ = fuselage_tab(l, boom_type_, design_type_)
                    self.booms.append(self.boom_tab_)
                    self.booms.append(self.boom_tab_)
                    self.inputArea.addTab(self.boom_tab_, l)
                    self.indexes.append(l)

        except:
            self.new_boom()
def get_booms():
    try:
        boom_list = read_boom_objects()
        fuselages = []
        for l in boom_list:
            design_type_, surface_type_ = get_boom_object_data(l)
            xsecs = []
            root_position_x_, root_position_y_, root_position_z_ = 0, 0, 0
            xz_mirror_ = False
            if design_type_ == conventional_design:
                radii, x, z, root_position_x_, root_position_y_, root_position_z_, xz_mirror_ = get_parameters_for_fuselage(
                    l)
                for radius, x_, z_ in zip(radii, x, z):
                    xsecs.append(
                        FuselageXSec(x_c=x_, y_c=0, z_c=z_, radius=radius))
                    fuselages.append(
                        Fuselage(name=l,
                                 x_le=root_position_x_,
                                 y_le=root_position_y_,
                                 z_le=root_position_z_,
                                 symmetric=xz_mirror_,
                                 xsecs=xsecs))
            elif design_type_ == unconventional_design:
                radii, x, z, root_position_x_, root_position_y_, root_position_z_, xz_mirror_ = get_parameters_for_boom(
                    l)
                for radius, x_, z_ in zip(radii, x, z):
                    xsecs.append(
                        FuselageXSec(x_c=x_, y_c=0, z_c=z_, radius=radius))
                fuselages.append(
                    Fuselage(name=l,
                             x_le=root_position_x_,
                             y_le=root_position_y_,
                             z_le=root_position_z_,
                             symmetric=xz_mirror_,
                             xsecs=xsecs))
                return fuselages
    except:
        return []
 def save_all(self):
     for l in self.booms:
         l.init_action()
         print('dialog-init', read_boom_objects())
def build_datcom_input():

    surface_list = read_lifting_surface_objects()
    ls_statements = []
    boom_statements = []
    synths={}
    for l in surface_list:
        design_type_, surface_type_ = get_surface_object_data(l)
        span_, tip_chord, root_chord, dihedral_, sweep_ = 0, 0, 0, 0, 0
        profile_="0012"
        if design_type_ == unconventional_design:
            span_, tip_chord, root_chord, dihedral_, sweep_,profile_ = get_parameters_from_sections_lifting_surface(l)
        elif design_type_ == conventional_design:
            print(l)
            span_, tip_chord, root_chord, dihedral_, sweep_,profile_ = get_parameters_from_conventional_wing(l)
        print(profile_.split("naca"))
        if surface_type_ == wing:
            synths.update({"wing": span_ / 2})
            ls_statements.append(set_planform_parameters(
                type_1="W,G", tip_chord=tip_chord,
                root_chord=root_chord, semi_span=(span_ / 2), sweep_angle=sweep_,
                dihedral_=1.2,
                profile=profile_.split("naca")[1]
            ))
        elif surface_type_ == fin:
            synths.update({"vtp":span_ / 2})
            ls_statements.append(set_planform_parameters(
                type_1="V,T", tip_chord=tip_chord,
                root_chord=root_chord, semi_span=(span_ / 2), sweep_angle=sweep_,
                dihedral_=1.3,
                profile=profile_.split("naca")[1]
            ))
        else:
            synths.update({"vtp": span_ / 2})
            ls_statements.append(set_planform_parameters(
                type_1="H,T", tip_chord=tip_chord,
                root_chord=root_chord, semi_span=(span_ / 2), sweep_angle=sweep_,
                dihedral_=1.3,
                profile=profile_.split("naca")[1]
            ))

    try:
        boom_list = read_boom_objects()
        for l in boom_list:
            design_type_, surface_type_ = get_boom_object_data(l)
            if design_type_ == unconventional_design:
                pass
            elif design_type_ == conventional_design:
                radii, x, z = get_parameters_from_conventional_boom(l)
                boom_statements.append(set_body_parameters_radius(section_positions=x, radius_of_sections=radii,
                                                                  iter_=(boom_list.index(l) + 1)))
    except:
        pass

    mesh = get_center_of_mass()
    try:
        value=synths["vtp"]
    except:
        synths.update({"vtp":0})
    try:
        value=synths["htp"]
    except:
        synths.update({"htp":0})

    input_ = "".join([set_flight_conditions(mach_numbers=get_mach_number(), angle_of_attack=get_aoa_range(), altitude=get_altitude()),
                      set_synths_parameters(center_of_gravity_x=round(mesh["x"],2),center_of_gravity_z=round(mesh["z"],2),
                                            vtp_tip_position_x=round(synths.get("vtp"),2),
                                            htp_tip_position_x=round(synths.get("htp"),2)),

                      "".join(ls_statements),
                      "".join(boom_statements),
                      create_footer()])
    database.write_datcom_input(input=input_)
 def accept_inputs(self):
     if self.selection_ is None:
         self.selection_ = read_boom_objects()[
             self.itemsComboBox.currentIndex()]
     return (self.selection_)
 def selectionChanged(self, i):
     self.selection_ = read_boom_objects()[i]