コード例 #1
0
ファイル: intersect_wing.py プロジェクト: DLR-SL/CPACS-IFARX
def main():

    # Init TiXI
    tixi_h = tixiwrapper.Tixi()
    tixi_h.open('toolOutput.xml')

    # Init TiGL
    tigl_h = tiglwrapper.Tigl()
    tigl_h.open(tixi_h, 'AircraftModel')

    # Extract wing:
    mgr = CCPACSConfigurationManager_get_instance()
    aircraft_config = mgr.get_configuration(tigl_h._handle.value)
    wing = aircraft_config.get_wing("wing")
    wing_shape = wing.get_loft().shape()

    # Do the slicing:
    wing_section = slicing(wing_shape, 0.5)

    # Discretize the section:
    pnts, face_ids = discretize(wing_section, 1e-5)

    # Plot results:
    display, start_display, add_menu, add_function_to_menu = init_display()
    display.DisplayShape(wing_shape, transparency=0.8, update=True)
    display.DisplayShape(wing_section, color='red', update=True)
    start_display()

    plt.plot(pnts[:, 0], pnts[:, 2], '.')
    plt.show()
コード例 #2
0
ファイル: __init__.py プロジェクト: DLR-SL/CPACS-IFARX
def initialize(file):
    global tixi, tigl
    from tixi import tixiwrapper
    from tigl import tiglwrapper
    tixi = tixiwrapper.Tixi()
    tixi.open(file)
    tigl = tiglwrapper.Tigl()
    tigl.open(tixi, 'AircraftModel')
    from . import utils
    global_namespace = globals()
    for function in __all__:
        global_namespace[function] = getattr(utils, function)
    return tixi, tigl
コード例 #3
0
def convert_geometry(filename, new_cpacs_file, old_cpacs_file):
    """
    Geometric conversion main routine
    :return:
    """

    tigl2 = tiglwrapper.Tigl()
    logging.info("Loading CPACS-2 file '" + filename + "' with TiGL 2")
    tigl2.open(old_cpacs_file, "")
    logging.info("Loading CPACS-3 file with TiGL 3")
    tigl3 = tigl3wrapper.Tigl3()
    tigl3.open(new_cpacs_file, "")

    convert_guide_curve_points(new_cpacs_file, old_cpacs_file, tigl2, tigl3)
    convert_eta_xsi_values(new_cpacs_file, tigl2, tigl3)
コード例 #4
0
# -*- coding: utf-8 -*-
"""
Please read the function`s docstring :)
"""
import math
import bisect
import numpy as np

from tixi import tixiwrapper
from tigl import tiglwrapper

tixi = tixiwrapper.Tixi()
tixi.open('./aircraft.xml')
tigl = tiglwrapper.Tigl()
tigl.open(tixi, 'AircraftModel')


def get_airfoil_points(wing_uid, eta, npoints=25, *, method='geometric',
                       joint=True, normalize=False):
    """
    Extracts an airfoil of the wing section defined by a relative coordinate eta.

    Parameters
    ----------
    wing_uid : string
        uID of the wing ('wing', 'htp', 'vtp').
    eta : float
        Relative coordinate in spanwise direction, must be in range of [0, 1].
    npoints : integer, optional
        Number of points along upper/lower airfoil curve. (Default: 25)
    method : string, optional
コード例 #5
0
            mirrored_shape = segment.get_mirrored_loft()
            if mirrored_shape is not None:
                display.DisplayShape(mirrored_shape.shape(), update=True)

    for iobj in range(1, config.get_external_object_count() + 1):
        obj = config.get_external_object(iobj)
        shape = obj.get_loft()

        if shape is not None:
            display.DisplayShape(shape.shape(), update=True)

        mirrored_shape = obj.get_mirrored_loft()

        if mirrored_shape is not None:
            display.DisplayShape(mirrored_shape.shape(), update=True)

    display.FitAll()

    start_display()


if __name__ == '__main__':
    tixi_h = tixiwrapper.Tixi()
    tigl_h = tiglwrapper.Tigl()

    dir_path = os.path.dirname(os.path.realpath(__file__))
    tixi_h.open(dir_path + "/../../tests/TestData/D150_v201.xml")
    tigl_h.open(tixi_h, "")

    display_configuration(tigl_h)