@@ -38,7 +38,7 @@ def search_trapezoidal_fins(bs, elements):
3838 "Starting collecting the settings for the trapezoidal fin set number '%d'" ,
3939 idx ,
4040 )
41- label = fin .find ("name" ). text
41+ label = getattr ( fin .find ("name" ), " text" , "" )
4242 try :
4343
4444 def get_element_by_name (name ):
@@ -57,32 +57,36 @@ def get_element_by_name(name):
5757 logger .error (message )
5858 raise KeyError (message )
5959
60- n_fin = int (fin .find ("fincount" ). text )
60+ n_fin = int (getattr ( fin .find ("fincount" ), " text" , "0" ) )
6161 logger .info ("Number of fins retrieved: %d" , n_fin )
6262
63- root_chord = float (fin .find ("rootchord" ). text )
63+ root_chord = float (getattr ( fin .find ("rootchord" ), " text" , "0" ) )
6464 logger .info ("Root chord retrieved: %f" , root_chord )
6565
66- tip_chord = float (fin .find ("tipchord" ). text )
66+ tip_chord = float (getattr ( fin .find ("tipchord" ), " text" , "0" ) )
6767 logger .info ("Tip chord retrieved: %f" , tip_chord )
6868
69- span = float (fin .find ("height" ). text )
69+ span = float (getattr ( fin .find ("height" ), " text" , "0" ) )
7070 logger .info ("Span retrieved: %f" , span )
7171
7272 sweep_length = (
73- float (fin .find ("sweeplength" ).text ) if fin .find ("sweeplength" ) else None
73+ float (getattr (fin .find ("sweeplength" ), "text" , "0" ))
74+ if fin .find ("sweeplength" )
75+ else None
7476 )
7577 sweep_angle = (
76- float (fin .find ("sweepangle" ).text ) if fin .find ("sweepangle" ) else None
78+ float (getattr (fin .find ("sweepangle" ), "text" , "0" ))
79+ if fin .find ("sweepangle" )
80+ else None
7781 )
7882 logger .info (
7983 "Sweep length and angle retrieved: %s, %s" , sweep_length , sweep_angle
8084 )
8185
82- cant_angle = float (fin .find ("cant" ). text )
86+ cant_angle = float (getattr ( fin .find ("cant" ), " text" , "0" ) )
8387 logger .info ("Cant angle retrieved: %f" , cant_angle )
8488
85- section = fin .find ("crosssection" ). text
89+ section = getattr ( fin .find ("crosssection" ), " text" , "" )
8690 logger .info ("Crosssection format retrieved" )
8791
8892 fin_settings = {
@@ -145,7 +149,7 @@ def search_elliptical_fins(bs, elements):
145149 "Starting collecting the settings for the elliptical fin set number '%d'" ,
146150 idx ,
147151 )
148- label = fin .find ("name" ). text
152+ label = getattr ( fin .find ("name" ), " text" , "" )
149153 try :
150154
151155 def get_element_by_name (name ):
@@ -164,19 +168,19 @@ def get_element_by_name(name):
164168 logger .error (message )
165169 raise KeyError (message )
166170
167- n_fin = int (fin .find ("fincount" ). text )
171+ n_fin = int (getattr ( fin .find ("fincount" ), " text" , "0" ) )
168172 logger .info ("Number of fins retrieved: %d" , n_fin )
169173
170- root_chord = float (fin .find ("rootchord" ). text )
174+ root_chord = float (getattr ( fin .find ("rootchord" ), " text" , "0" ) )
171175 logger .info ("Root chord retrieved: %f" , root_chord )
172176
173- span = float (fin .find ("height" ). text )
177+ span = float (getattr ( fin .find ("height" ), " text" , "0" ) )
174178 logger .info ("Span retrieved: %f" , span )
175179
176- cant_angle = float (fin .find ("cant" ). text )
180+ cant_angle = float (getattr ( fin .find ("cant" ), " text" , "0" ) )
177181 logger .info ("Cant angle retrieved: %f" , cant_angle )
178182
179- section = fin .find ("crosssection" ). text
183+ section = getattr ( fin .find ("crosssection" ), " text" , "" )
180184 logger .info ("Crosssection format retrieved" )
181185
182186 fin_settings = {
0 commit comments