Example #1
0
 def test_import_thick_TE2(self):
     """
     Import and prepare a multi-section wing with a thick trailing edge
     along where the middle airfoil has no thick trailing edge.
     """
     fn = './test_io/vsp_wing_thick_TE2_v3.5.0.stp'
     vsp_import = ImportVSP(fn)
     self.assertFalse(vsp_import.has_invalid)
     self.assertEqual(vsp_import.num_bodies, 1)
Example #2
0
 def test_import_thick_TE1(self):
     """
     Import and prepare a multi-section wing with a thick trailing edge
     along the entire span.
     """
     fn = './test_io/vsp_wing_thick_TE1_v3.5.0.stp'
     vsp_import = ImportVSP(fn)
     self.assertFalse(vsp_import.has_invalid)
     self.assertEqual(vsp_import.num_bodies, 1)
Example #3
0
from afem.config import Settings
from afem.exchange import ImportVSP
from afem.graphics import Viewer

Settings.log_to_console()

fn = '../models/777-200LR.stp'

vsp_import = ImportVSP(fn)

gui = Viewer()
gui.add(*vsp_import.all_bodies)
gui.start()
Example #4
0
 def test_import_777_200LR(self):
     fn = './test_io/777-200LR.stp'
     vsp_import = ImportVSP(fn)
     self.assertFalse(vsp_import.has_invalid)
     self.assertEqual(vsp_import.num_bodies, 7)
Example #5
0
Settings.log_to_console()

# 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
Example #6
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 #7
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['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,
Example #8
0
Settings.log_to_console()

# 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['Wing_Body']
other_wing = vsp_import['Wing_Body.1']
vtail = vsp_import['Vertical_Tails']
other_vtail = vsp_import['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
Example #9
0
    step = StepWrite('AP203', 'in')
    step.transfer(the_mesh.shape)
    step.write('supersonic.step')

    # Export the mesh (nodes and elements) to a bulk data file
    the_mesh.export_nastran('supersonic.bdf')


if __name__ == '__main__':
    # Set units to inch and log to console
    Settings.set_units('in')
    Settings.log_to_console()

    # Import OpenVSP model
    fname = r'..\models\supersonic.stp'
    vsp_import = ImportVSP(fname)

    # A few notes about importing an OpenVSP STEP model:
    #   1) If the model comes from the modified version that includes metadata
    #      then the OpenVSP components can be identified by type and retrieved
    #      by name. Otherwise the import methods just tries to make solid
    #      bodies from the components and gives them a generic name.
    #   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
Example #10
0
    step = StepWrite('AP203', 'in')
    step.transfer(the_shape)
    step.write('supersonic.step')

    # Export the mesh (nodes and elements) to a bulk data file
    afem.exchange.nastran.export_bdf(the_mesh, 'supersonic.bdf')


if __name__ == '__main__':
    # Set units to inch and log to console
    Settings.set_units('in')
    Settings.log_to_console()

    # Import OpenVSP model
    fname = r'..\models\supersonic.stp'
    vsp_import = ImportVSP(fname)

    # A few notes about importing an OpenVSP STEP model:
    #   1) If the model comes from the modified version that includes metadata
    #      then the OpenVSP components can be identified by type and retrieved
    #      by name. Otherwise the import methods just tries to make solid
    #      bodies from the components and gives them a generic name.
    #   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
Example #11
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,