@@ -212,6 +212,9 @@ def draw(self, vis_args=None, plane="xz", *, filename=None):
212212 eps, jpg, jpeg, pdf, pgf, png, ps, raw, rgba, svg, svgz, tif, tiff
213213 and webp (these are the formats supported by matplotlib).
214214 """
215+
216+ self .__validate_aerodynamic_surfaces ()
217+
215218 if vis_args is None :
216219 vis_args = {
217220 "background" : "#EEEEEE" ,
@@ -248,6 +251,12 @@ def draw(self, vis_args=None, plane="xz", *, filename=None):
248251 plt .tight_layout ()
249252 show_or_save_plot (filename )
250253
254+ def __validate_aerodynamic_surfaces (self ):
255+ if not self .rocket .aerodynamic_surfaces :
256+ raise ValueError (
257+ "The rocket must have at least one aerodynamic surface to be drawn."
258+ )
259+
251260 def _draw_aerodynamic_surfaces (self , ax , vis_args , plane ):
252261 """Draws the aerodynamic surfaces and saves the position of the points
253262 of interest for the tubes."""
@@ -399,6 +408,8 @@ def _draw_generic_surface(
399408
400409 def _draw_tubes (self , ax , drawn_surfaces , vis_args ):
401410 """Draws the tubes between the aerodynamic surfaces."""
411+ radius = 0
412+ last_x = 0
402413 for i , d_surface in enumerate (drawn_surfaces ):
403414 # Draw the tubes, from the end of the first surface to the beginning
404415 # of the next surface, with the radius of the rocket at that point
0 commit comments