diff --git a/CHANGELOG.md b/CHANGELOG.md index 51eb473d..7b1b6dbf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -39,6 +39,11 @@ Also, for at least one version before a breaking change, AeroSandbox development # Latest (master / release), and previous versions +#### 4.2.1 + +- Added geometry export capabilities to OpenVSP using the *.vspscript interface. Accessible via `asb.Airplane.export_OpenVSP_vspscript(filename="/path/to/my/file.vspscript")`. To import into OpenVSP, use this function to generate a VSPscript file, and then import it via File -> Run Script... in OpenVSP. +- Overhaul of the airfoil database at `aerosandbox.geometry.airfoil.airfoil_database`. This includes the addition of around 500 new high-quality airfoils, the removal of around 15 exceptionally-low-quality airfoils from the UIUC database, the correction of some airfoil coordinates for transcription errors, and fixes for file encodings that caused errors on Linux. + #### 4.2.0 - Fixed I/O error with XFoil. XFoil outputs may have mislabeled columns if both CP and hinge moments are requested. This is a bug in XFoil, but AeroSandbox now detects and corrects for it. diff --git a/aerosandbox/geometry/airplane.py b/aerosandbox/geometry/airplane.py index 4bf2bcbc..9f2f19de 100644 --- a/aerosandbox/geometry/airplane.py +++ b/aerosandbox/geometry/airplane.py @@ -7,7 +7,7 @@ from aerosandbox.geometry.propulsor import Propulsor from aerosandbox.weights.mass_properties import MassProperties import copy - +from pathlib import Path class Airplane(AeroSandboxObject): """ @@ -900,7 +900,7 @@ def generate_cadquery_geometry(self, return solid.clean() def export_cadquery_geometry(self, - filename: str, + filename: Union[Path, str], minimum_airfoil_TE_thickness: float = 0.001 ) -> None: """ @@ -961,7 +961,7 @@ def export_XFLR(self, *args, **kwargs) -> str: return self.export_XFLR5_xml(*args, **kwargs) def export_XFLR5_xml(self, - filename, + filename: Union[Path, str], mass_props: MassProperties = None, include_fuselages: bool = False, mainwing: Wing = None, @@ -969,7 +969,8 @@ def export_XFLR5_xml(self, fin: Wing = None, ) -> str: """ - Exports the airplane geometry to an XFLR5 `.xml` file. + Exports the airplane geometry to an XFLR5 `.xml` file. To import the `.xml` file into XFLR5, go to File -> + Import -> Import from XML. Args: filename: The filename to export to. Should include the ".xml" extension. @@ -1271,8 +1272,19 @@ def indent(elem, level=0): return xml_string def export_OpenVSP_vspscript(self, - filename, - ): + filename: Union[Path, str], + ) -> str: + """ + 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. + + Args: + 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 + """ from aerosandbox.geometry.openvsp_io.asb_to_openvsp.airplane_vspscript_generator import generate_airplane vspscript_code = generate_airplane(self) @@ -1282,6 +1294,7 @@ def export_OpenVSP_vspscript(self, return vspscript_code + if __name__ == '__main__': import aerosandbox as asb # import aerosandbox.numpy as np