From 4baa99bcf568f91ffe9ce961e86185cf42a75a4b Mon Sep 17 00:00:00 2001 From: Marius Peter Date: Sun, 9 Jun 2019 11:50:49 -0700 Subject: class Stringer --- creator.py | 16 ++++++---------- main.py | 12 +++++++++++- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/creator.py b/creator.py index b1a58a9..953f088 100644 --- a/creator.py +++ b/creator.py @@ -236,7 +236,7 @@ class Airfoil(Coordinates): class Spar(Coordinates): - """Contains a single spar's location and material.""" + """Contains a single spar's location.""" global parent def __init__(self): @@ -275,17 +275,13 @@ class Spar(Coordinates): class Stringer(): - """Contains the coordinates of stringer(s) location and material.""" + """Contains the coordinates of stringer(s).""" + global parent def __init__(self): - # Stringer attributes - self.stringer_x_u = [] - self.stringer_y_u = [] - self.stringer_x_l = [] - self.stringer_y_l = [] - self.stringer_mat = [] - - def add_stringers(self, *density): + super().__init__(parent.chord, parent.semi_span) + + def add_stringer(self, *density): """ Add stringers to the wing from their distribution density between spars. First half of density[] concerns stringer distribution on diff --git a/main.py b/main.py index f62a88a..4bbd7a9 100644 --- a/main.py +++ b/main.py @@ -38,6 +38,7 @@ def main(): af.naca(2412) # Print coordinates of af to terminal af.print_coord(4) + # Create spar instance af.spar = creator.Spar() # Define the spar coordinates @@ -45,8 +46,17 @@ def main(): af.spar.add_spar(af.coordinates, 0.55) # Print coordinates of af.spar to terminal af.spar.print_coord(4) + + # Create stringer instance + af.stringer = creator.Stringer() + # Define the stringer coordinates + af.stringer.add_stringer(af.coordinates, 0.15) + af.stringer.add_stringer(af.coordinates, 0.55) + # Print coordinates of af.stringer to terminal + af.stringer.print_coord(4) + # Plot components with matplotlib - creator.plot(af, af.spar) + creator.plot(af, af.spar, af.stringer) # Save component coordinates af.save_coord(SAVE_PATH) -- cgit v1.2.3