Example #1
0
from afem.config import Settings
from afem.exchange import ImportVSP
from afem.graphics import Viewer
from afem.structure import *

Settings.log_to_console()

# Set units to inch.
Settings.set_units('in')

# Import model
fn = r'../models/simple_wing.stp'
vsp_import = ImportVSP(fn)
wing = vsp_import.get_body('WingGeom')

# Build structure
wingbox = GroupAPI.create_group('wing box')
fspar = SparByParameters('front spar', 0.15, 0., 0.15, 1., wing).part
rspar = SparByParameters('rear spar', 0.70, 0., 0.70, 1., wing).part
RibByPoints('root rib', fspar.p1, rspar.p1, wing)
RibByPoints('tip rib', fspar.p2, rspar.p2, wing)
RibsAlongCurveByDistance('rib',
                         rspar.cref,
                         30,
                         fspar.shape,
                         rspar.shape,
                         wing,
                         d1=30,
                         d2=-30)
internal_parts = wingbox.get_parts()
skin = SkinByBody('skin', wing).part
Example #2
0
    #   2) The import process attempts to sew the faces of the OpenVSP
    #      components together to form solids.
    #   3) If a surface is found to be planar, it is replaced with a plane
    #      before sewing. This helps eliminate some degenerated edges.
    #   4) Faces sharing the same domain are unified. If flat wing caps are
    #      used, this usually results in a single face for the entire cap
    #      rather than two faces split between the upper and lower surface.

    # View the model
    v = Viewer()
    v.add(*vsp_import.all_bodies)
    v.start()
    v.clear()

    # Retrieve relative components by name and set transparency for viewing
    wing_ = vsp_import.get_body('wing')
    fuse_ = vsp_import.get_body('fuse')
    wing_.set_transparency(0.5)
    fuse_.set_transparency(0.5)

    # OpenVSP 3.5 was modified by Laughlin Research to construct and export
    # metadata and reference geometry in the STEP file. For a wing component,
    # the reference geometry includes a surface that is lofted through the
    # chord lines at each wing station. This surface is used to define
    # structure in terms of percent chord and/or semispan. Currently, the
    # u-direction of the surface is in the chordwise and the v-direction is
    # spanwise. Show this surface.
    v.add(wing_)
    v.add(wing_.sref)
    v.start()
    v.clear()
Example #3
0
# Inputs
fname = r'..\models\hwb_nosplit.stp'
# Length of flight deck from nose.
fd_length = 10. * 12.
# Cabin length as absolute value (> 1) or percent root chord ( < 1)
cabin_length = 0.7
# Cabin width
cabin_width = 50. * 12.
# Bay width
bay_width = 8. * 12.

# Import model
vsp_import = ImportVSP()
vsp_import.import_step(fname)
wing = vsp_import.get_body('Wing_Body')
other_wing = vsp_import.get_body('Wing_Body.1')
vtail = vsp_import.get_body('Vertical_Tails')
other_vtail = vsp_import.get_body('Vertical_Tails.2')
for body in [wing, other_wing, vtail, other_vtail]:
    body.set_transparency(0.5)
    body.set_color(0.5, 0.5, 0.5)

# Construction geometry
root_chord = wing.sref.v_iso(0.)

GroupAPI.create_group('wing group')

# Centerbody structure
pln = PlaneByAxes((fd_length, 0, 0), 'yz').plane
fd_bh = SparByShape('flight deck bh', pln, wing).part
Example #4
0
from afem.config import Settings
from afem.exchange import ImportVSP
from afem.geometry import *
from afem.graphics import Viewer
from afem.smesh import *
from afem.structure import *
from afem.topology import *

Settings.log_to_console()

# Import model
fname = '../models/uniform_wing.stp'
vsp = ImportVSP(fname)
wing = vsp.get_body('Wing')

# Reference curves using wing reference surface generated from modified
# OpenVSP
cref1 = wing.sref.u_iso(0.25)
cref2 = wing.sref.u_iso(0.65)

# Plane at rear spar to cut ribs with. The will enable the 1-D beam to be
# properly fused.
aft_pln = wing.extract_plane(0.65, 0., 0.65, 1.)

# Ribs
xz_pln = PlaneByAxes(axes='xz').plane
ribs = RibsAlongCurveByDistance('Rib',
                                cref1,
                                16.,
                                cref1,
                                cref2,