Exemple #1
0
    def show_geometry(self):
        """ Display the geometry in the ParaPy GUI.

        :rtype: None
        """
        from parapy.gui import display
        display(self.aircraft)
Exemple #2
0
                        position=rotate(translate(self.position,
                                                  'x', self.hubLatPos - self.wheelRadius / 3,
                                                  'y', -1 * self.hubHeightPos,
                                                  'z', self.hubLongPos),
                                        Vector(0, 1, 0), radians(90)),
                        hidden=False,
                        color='gray')

    @Part
    def wheelLeft(self):
        return MirroredShape(shape_in=self.wheel,
                             reference_point=Point(),
                             vector1=self.wheel.position.Vy,
                             vector2=self.wheel.position.Vx,
                             color='black')

    @Part
    def hubLeft(self):
        return MirroredShape(shape_in=self.hub,
                             reference_point=Point(),
                             vector1=self.hub.position.Vy,
                             vector2=self.hub.position.Vx,
                             color='gray')


if __name__ == '__main__':
    from parapy.gui import display

    obj = LandingGear()
    display(obj)
Exemple #3
0
        spar_chordwise_positions_root=[0.2, 0.8],
        spar_chordwise_positions_tip=[0.2, 0.8],
        spar_aspect_ratios=[0.2, 0.2], spar_profiles=['I', 'C'],
        spar_spanwise_positions_end=[0.8, 0.8],
        position=translate(forward_wing.position,
                           'x', 10.,
                           'z', 3.))

    bw_vertical = LiftingSurface(
        'NACA0012', 1.5, 0., 'NACA0012', 1., 0.,
        rear_wing.tip_airfoil.position.distance(
            forward_wing.tip_airfoil.position) -
        rear_wing.tip_airfoil.max_thickness -
        forward_wing.tip_airfoil.max_thickness - 0.35,
        degrees((rear_wing.position - forward_wing.position).angle(
            forward_wing.orientation.Vx)),
        0., 0,
        position=rotate90(
            translate(
                forward_wing.tip_airfoil.position,
                forward_wing.leading_edge.direction_vector,
                forward_wing.tip_airfoil.max_thickness,
                forward_wing.orientation.Vx,
                forward_wing.tip_airfoil.chord - 1.5,
                forward_wing.orientation.Vz,
                forward_wing.tip_airfoil.max_thickness),
            'x'
        ))

    display([forward_wing, bw_vertical, connecting_element, rear_wing])
    def mix_airfoils(self, mixing_factor):
        """ Linearly interpolates two airfoils that may have a different
        orientation with respect to each other. :any:`airfoil2` is transformed
        onto the position of :any:`airfoil1`, and attains the same
        orientation. Then, the mixing factor interpolates towards one of the
        two airfoils. A factor of 1 will yield the original :any:`airfoil2`,
        while a factor of 0 will yield the original :any:`airfoil1`.

        :param mixing_factor:
        :type mixing_factor: float
        :rtype: parapy.geom.occ.curve.FittedCurve
        """
        airfoil2 = self.airfoil2.transformed(
            new_position=self.airfoil1.position,
            old_position=self.airfoil2.position)
        pnts1 = self.airfoil1.equispaced_points(100)
        pnts2 = airfoil2.equispaced_points(100)
        mixed_points = [
            pt1.interpolate(pt2, frac=mixing_factor)
            for pt1, pt2 in zip(pnts1, pnts2)
        ]

        return FittedCurve(mixed_points)


if __name__ == '__main__':
    from parapy.gui import display
    obj3 = ConnectingElement()
    display(obj3)
Exemple #5
0
                   iterate=True,
                   n_passengers=passengers,
                   range_in_km=range_in_km,
                   max_span=max_span,
                   quality_choice=quality_choice,
                   wheels_choice=wheels_choice,
                   cruise_speed=cruise_speed,
                   primary_colour=primary_colour_in,
                   secondary_colour=secondary_colour_in)

    # As the client is assumed to be a non-expert, they are not provided
    # with the AVL analysis that is being run behind the scenes. They get
    # the GUI as clean as possible. If the client does not need to see the
    # vehicle at all, the following line can be commented out.

    display(pav)

    # However, if required, one of the following lines can be uncommented to
    # either show the AVL results for the initial aircraft or the iterated
    # aircraft

    # display(pav.initial_aircraft.analysis)

    # display(pav.new_aircraft.analysis)

    # -----------------------------------------------------------------------------
    # Generate a .stp output
    # -----------------------------------------------------------------------------

    pav.step_part.write()
Exemple #6
0
    # --- Primitives: -------------------------------------------------------------------------------------------------

    @Part(in_tree=__show_primitives)
    def unit_curve_import(self):
        return InterpolatedCurve(points=self.curvepoints,
                                 tangents=self.tangents)

    @Part(in_tree=__show_primitives)
    def unit_curve(self):
        return ScaledCurve(curve_in=self.unit_curve_import,
                           reference_point=YOZ,
                           factor=(1, self.width, self.height * 2.0))

    @Part(in_tree=__show_primitives)
    def visualize_bounds(self):
        return Rectangle(
            width=self.width,
            length=self.height,
            # x is y, y is z, z is x
            position=translate(YOZ, 'x', self.position.y, 'y',
                               (self.height / 2.0) + self.position.z, 'z',
                               self.position.x),
            color='red')


if __name__ == '__main__':
    from parapy.gui import display

    obj = FFrame()
    display(obj, view='left')
Exemple #7
0
    @Part
    def internal_shape(self):
        return TranslatedShape(shape_in=self.battery_import, displacement=Vector(self.position.x,
                                                                                 self.position.y,
                                                                                 (self.height / 2.0) + self.position.z),
                               color=MyColors.battery,
                               transparency=0.7)

    # --- Primitives: -------------------------------------------------------------------------------------------------

    @Part(in_tree=show_primitives)
    def rectangle(self):
        return RectangularFace(width=self.max_width, length=self.max_height,
                               position=YOZ)

    @Part(in_tree=show_primitives)
    def battery_profile(self):
        return FilletedFace(built_from=self.rectangle, radius=self.radius)

    @Part(in_tree=show_primitives)
    def battery_import(self):
        return ExtrudedSolid(face_in=self.battery_profile, distance=self.length, direction='x')


if __name__ == '__main__':
    from parapy.gui import display

    obj = Battery()
    display(obj, background_image=False)