summaryrefslogtreecommitdiff
path: root/creator.py
diff options
context:
space:
mode:
authorMarius Peter <blendoit@gmail.com>2019-06-30 15:52:03 -0700
committerMarius Peter <blendoit@gmail.com>2019-06-30 15:52:03 -0700
commit21678d4029eab07ed831b7a55289dc1b750bb3f9 (patch)
treefa71fc8c40f64aa059e7fe0f1e487f0cababe5ae /creator.py
parent899d36f49d1170e819c17ee3ec6cf4de0cc37707 (diff)
square plots + shorter info_print() + enforce minimum chord length
Diffstat (limited to 'creator.py')
-rw-r--r--creator.py34
1 files changed, 19 insertions, 15 deletions
diff --git a/creator.py b/creator.py
index 8277b10..22449bd 100644
--- a/creator.py
+++ b/creator.py
@@ -64,7 +64,11 @@ class Airfoil:
@classmethod
def from_dimensions(cls, chord, semi_span):
- cls.chord = chord
+ if chord > 20:
+ cls.chord = chord
+ else:
+ cls.chord = 20
+ print('Chord too small, using minimum value of 20.')
cls.semi_span = semi_span
return Airfoil()
@@ -163,24 +167,20 @@ class Airfoil:
self.mass = mass
def info_print(self, round):
- """
- Print all the component's coordinates to the terminal.
-
- This function's output is piped to the 'save_coord' function below.
- """
+ # TODO: implement this info getting method!
+ """Print all the component's coordinates to the terminal."""
- name = ' CREATOR DATA '
+ name = ' CREATOR DATA FOR {} '.format(str(self).upper())
num_of_dashes = len(name)
-
print(num_of_dashes * '-')
print(name)
- print('Component:', str(self))
- print('Chord length:', self.chord)
- print('Semi-span:', self.semi_span)
- print('Mass:', self.mass)
+ for k, v in self.__dict__.items():
+ if type(v) != list:
+ print('{}:\n'.format(k), v)
print(num_of_dashes * '-')
- print('x-coordinates:\n', np.around(self.x, round))
- print('z-coordinates:\n', np.around(self.z, round))
+ for k, v in self.__dict__.items():
+ if type(v) == list:
+ print('{}:\n'.format(k), np.around(v, round))
return None
def info_save(self, save_path, number):
@@ -398,9 +398,13 @@ def plot_geom(airfoil, view: False):
print('No stringers to plot.')
# Graph formatting
+ plot_bound = max(airfoil.x)
ax.set(title='NACA ' + str(airfoil.naca_num) + ' airfoil',
xlabel='X axis',
- ylabel='Z axis', ylim=[-50, 50])
+ xlim=[- 0.10 * plot_bound, 1.10 * plot_bound],
+ ylabel='Z axis',
+ ylim=[- (1.10 * plot_bound / 2), (1.10 * plot_bound / 2)])
+
plt.grid(axis='both', linestyle=':', linewidth=1)
plt.gca().set_aspect('equal', adjustable='box')
plt.gca().legend(bbox_to_anchor=(1, 1),
Copyright 2019--2024 Marius PETER