Ejemplo n.º 1
0
    def parse_wing(self, node):
        wing = Wing(self.dirname)
        wing.units = self.units
        wing.airfoil_resample = self.airfoil_resample
        wing.circle_points=self.circle_points
        wing.name = node.getString('name')
        airfoil_root = node.getString('airfoil_root')
        airfoil_tip = node.getString('airfoil_tip')
        if airfoil_tip == "":
            airfoil_tip = None
        wing.load_airfoils( airfoil_root, airfoil_tip )
        wing.span = myfloat(node, 'span')
        station_list = map( float, str(node.getString('stations')).split())
        wing.set_stations( station_list )
        wing.twist = myfloat(node, 'twist')
        sweep_curve = self.make_curve( node.getString('sweep_curve') )
        if ( len(sweep_curve) >= 2 ):
            wing.set_sweep_curve( sweep_curve )
        else:
            wing.set_sweep_angle( myfloat(node, 'sweep') )
        chord_curve = self.make_curve( node.getString('chord_curve') )
        if ( len(chord_curve) >= 2 ):
            wing.set_taper_curve( chord_curve )
        else:
            chord_root = myfloat(node, 'chord_root')
            chord_tip = myfloat(node, 'chord_tip')
            wing.set_chord( chord_root, chord_tip )
        wing.dihedral = myfloat(node, 'dihedral')
        wing.link_name = node.getString('wing_link')

        # parse flaps first so we can use this info to partition the
        # trailing edge and possibly other structures too
        for i in range(node.getLen('flap')):
            self.parse_flap(wing, node.getChild('flap[%d]' % i))
        for i in range(node.getLen('leading_edge')):
            self.parse_leading_edge(wing, node.getChild('leading_edge[%d]' % i))
        for i in range(node.getLen('trailing_edge')):
            self.parse_trailing_edge(wing, node.getChild('trailing_edge[%d]' % i))
        for i in range(node.getLen('spar')):
            self.parse_spar(wing, node.getChild('spar[%d]' % i))
        for i in range(node.getLen('stringer')):
            self.parse_stringer(wing, node.getChild('stringer[%d]' % i))
        for i in range(node.getLen('sheet')):
            self.parse_sheet(wing, node.getChild('sheet[%d]' % i))
        for i in range(node.getLen('simple_hole')):
            self.parse_simple_hole(wing, node.getChild('simple_hole[%d]' % i))
        for i in range(node.getLen('shaped_hole')):
            self.parse_shaped_hole(wing, node.getChild('shaped_hole[%d]' % i))
        for i in range(node.getLen('build_tab')):
            self.parse_build_tab(wing, node.getChild('build_tab[%d]' % i))

        wing.build()
        wing.layout_parts_sheets( self.sheet_w, self.sheet_h, units=self.units,
                                  speed=self.nest_speed)
        #wing.layout_parts_templates( 8.5, 11 )
        wing.layout_plans( self.plans_w, self.plans_h, units=self.units )

        return wing