aerosandbox.geometry.airplane ============================= .. py:module:: aerosandbox.geometry.airplane Classes ------- .. autoapisummary:: aerosandbox.geometry.airplane.Airplane Functions --------- .. autoapisummary:: aerosandbox.geometry.airplane.ft Module Contents --------------- .. py:class:: Airplane(name = None, xyz_ref = None, wings = None, fuselages = None, propulsors = None, s_ref = None, c_ref = None, b_ref = None, analysis_specific_options = None) Bases: :py:obj:`aerosandbox.AeroSandboxObject` Definition for an airplane. Anatomy of an Airplane: An Airplane consists chiefly of a collection of wings and fuselages. These can be accessed with `Airplane.wings` and `Airplane.fuselages`, which gives a list of those respective components. Each wing is a Wing object, and each fuselage is a Fuselage object. .. py:attribute:: name :value: None .. py:attribute:: xyz_ref .. py:attribute:: wings :value: None .. py:attribute:: fuselages :value: None .. py:attribute:: propulsors :value: None .. py:attribute:: analysis_specific_options :value: None .. py:method:: __repr__() .. py:method:: mesh_body(method='quad', thin_wings=False, stack_meshes=True) Returns a surface mesh of the Airplane, in (points, faces) format. For reference on this format, see the documentation in `aerosandbox.geometry.mesh_utilities`. :param method: :param thin_wings: Controls whether wings should be meshed as thin surfaces, rather than full 3D bodies. :param stack_meshes: Controls whether the meshes should be merged into a single mesh or not. * If True, returns a (points, faces) tuple in standard mesh format. * If False, returns a list of (points, faces) tuples in standard mesh format. Returns: .. py:method:: draw(backend = 'pyvista', thin_wings = False, ax=None, use_preset_view_angle = None, set_background_pane_color = None, set_background_pane_alpha = None, set_lims = True, set_equal = True, set_axis_visibility = None, show = True, show_kwargs = None) Produces an interactive 3D visualization of the airplane. :param backend: The visualization backend to use. Options are: * "matplotlib" for a Matplotlib backend * "pyvista" for a PyVista backend * "plotly" for a Plot.ly backend * "trimesh" for a trimesh backend :param thin_wings: A boolean that determines whether to draw the full airplane (i.e. thickened, 3D bodies), or to use a :param thin-surface representation for any Wing objects.: :param show: A boolean that determines whether to display the object after plotting it. If False, the object is :param returned but not displayed. If True: :param the object is displayed and returned.: Returns: The plotted object, in its associated backend format. Also displays the object if `show` is True. .. py:method:: draw_wireframe(ax=None, color='k', thin_linewidth=0.2, thick_linewidth=0.5, fuselage_longeron_theta=None, use_preset_view_angle = None, set_background_pane_color = None, set_background_pane_alpha = None, set_lims = True, set_equal = True, set_axis_visibility = None, show = True) Draws a wireframe of the airplane on a Matplotlib 3D axis. :param ax: The axis to draw on. Must be a 3D axis. If None, creates a new axis. :param color: The color of the wireframe. :param thin_linewidth: The linewidth of the thin lines. .. py:method:: draw_three_view(axs=None, style = 'shaded', show = True) Draws a standard 4-panel three-view diagram of the airplane using Matplotlib backend. Creates a new figure. :param axs: A 2D numpy array of Matplotlib axes objects, with shape at least (2, 2). Each subplot must be 3D. If :param None: :param creates a new figure with the required axes.: :param style: Determines what drawing style to use for the three-view. A string, one of: * "shaded" * "wireframe" :param show: A Boolean of whether to show the figure after creating it, or to hold it so that the user can :param modify the figure further before showing.: Returns: A 2D NumPy array of Matplotlib axes objects, with shape (2, 2). The axes are arranged as follows: * axs[0, 0]: Top view * axs[0, 1]: Front view * axs[1, 0]: Side view * axs[1, 1]: Isometric view .. py:method:: is_entirely_symmetric() Returns a boolean describing whether the airplane is geometrically entirely symmetric across the XZ-plane. :return: [boolean] .. py:method:: aerodynamic_center(chord_fraction = 0.25) Computes the approximate location of the aerodynamic center of the wing. Uses the generalized methodology described here: https://core.ac.uk/download/pdf/79175663.pdf :param chord_fraction: The position of the aerodynamic center along the MAC, as a fraction of MAC length. :param Typically: :type Typically: denoted `h_0` in the literature :param this value: :type this value: denoted `h_0` in the literature :param wing-fuselage interactions can cause a forward shift to a value more like 0.1 or less. Citing Cook: :param : :param Michael V.: :param "Flight Dynamics Principles": :param 3rd Ed.: :param Sect. 3.5.3 "Controls-fixed static stability". PDF: :param https: //www.sciencedirect.com/science/article/pii/B9780080982427000031 Returns: The (x, y, z) coordinates of the aerodynamic center of the airplane. .. py:method:: with_control_deflections(control_surface_deflection_mappings) Returns a copy of the airplane with the specified control surface deflections applied. :param control_surface_deflection_mappings: A dictionary mapping control surface names to deflections. * Keys: Control surface names. * Values: Deflections, in degrees. Downwards-positive, following typical convention. Returns: A copy of the airplane with the specified control surface deflections applied. .. py:method:: generate_cadquery_geometry(minimum_airfoil_TE_thickness = 0.001, fuselage_tol = 0.0001) Uses the CADQuery library (OpenCASCADE backend) to generate a 3D CAD model of the airplane. :param minimum_airfoil_TE_thickness: The minimum thickness of the trailing edge of the airfoils, as a fraction :param of each airfoil's chord. This will be enforced by thickening the trailing edge of the airfoils if: :param necessary. This is useful for avoiding numerical issues in CAD software that can arise from extremely: :param thin: :type thin: i.e., <1e-6 meters :param tol: The geometric tolerance (meters) to use when generating the CAD geometry. This is passed directly to the CADQuery Returns: A CADQuery Workplane object containing the CAD geometry of the airplane. .. py:method:: export_cadquery_geometry(filename, minimum_airfoil_TE_thickness = 0.001) Exports the airplane geometry to a STEP file. :param filename: The filename to export to. Should include the ".step" extension. :param minimum_airfoil_TE_thickness: The minimum thickness of the trailing edge of the airfoils, as a fraction :param of each airfoil's chord. This will be enforced by thickening the trailing edge of the airfoils if: :param necessary. This is useful for avoiding numerical issues in CAD software that can arise from extremely: :param thin: :type thin: i.e., <1e-6 meters Returns: None, but exports the airplane geometry to a STEP file. .. py:method:: export_AVL(filename, include_fuselages = True) .. py:method:: export_XFLR(*args, **kwargs) .. py:method:: export_XFLR5_xml(filename, mass_props = None, include_fuselages = False, mainwing = None, elevator = None, fin = None) Exports the airplane geometry to an XFLR5 `.xml` file. To import the `.xml` file into XFLR5, go to File -> Import -> Import from XML. :param filename: The filename to export to. Should include the ".xml" extension. :param mass_props: The MassProperties object to use when exporting the airplane. If not specified, will default to a 1 kg point mass at the origin. - Note: XFLR5 does not natively support user-defined inertia tensors, so we have to synthesize an equivalent set of point masses to represent the inertia tensor. :param include_fuselages: Whether to include fuselages in the export. :param mainwing: The main wing of the airplane. If not specified, will default to the first wing in the airplane. :param elevator: The elevator of the airplane. If not specified, will default to the second wing in the airplane. :param fin: The fin of the airplane. If not specified, will default to the third wing in the airplane. Returns: None, but exports the airplane geometry to an XFLR5 `.xml` file. To import the `.xml` file into XFLR5, go to File -> Import -> Import from XML. .. py:method:: export_OpenVSP_vspscript(filename) Exports the airplane geometry to a `*.vspscript` file compatible with OpenVSP. To import the `.vspscript` file into OpenVSP: Open OpenVSP, then File -> Run Script -> Select the `.vspscript` file. :param filename: The filename to export to, given as a string or Path. Should include the ".vspscript" extension. Returns: A string of the file contents, and also saves the file to the specified filename .. py:function:: ft(feet, inches=0)