@@ -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,32 @@ 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" ) ) if fin .find ("sweeplength" ) else None
7474 )
7575 sweep_angle = (
76- float (fin .find ("sweepangle" ). text ) if fin .find ("sweepangle" ) else None
76+ float (getattr ( fin .find ("sweepangle" ), " text" , "0" ) ) if fin .find ("sweepangle" ) else None
7777 )
7878 logger .info (
7979 "Sweep length and angle retrieved: %s, %s" , sweep_length , sweep_angle
8080 )
8181
82- cant_angle = float (fin .find ("cant" ). text )
82+ cant_angle = float (getattr ( fin .find ("cant" ), " text" , "0" ) )
8383 logger .info ("Cant angle retrieved: %f" , cant_angle )
8484
85- section = fin .find ("crosssection" ). text
85+ section = getattr ( fin .find ("crosssection" ), " text" , "" )
8686 logger .info ("Crosssection format retrieved" )
8787
8888 fin_settings = {
@@ -145,7 +145,7 @@ def search_elliptical_fins(bs, elements):
145145 "Starting collecting the settings for the elliptical fin set number '%d'" ,
146146 idx ,
147147 )
148- label = fin .find ("name" ). text
148+ label = getattr ( fin .find ("name" ), " text" , "" )
149149 try :
150150
151151 def get_element_by_name (name ):
@@ -164,19 +164,19 @@ def get_element_by_name(name):
164164 logger .error (message )
165165 raise KeyError (message )
166166
167- n_fin = int (fin .find ("fincount" ). text )
167+ n_fin = int (getattr ( fin .find ("fincount" ), " text" , "0" ) )
168168 logger .info ("Number of fins retrieved: %d" , n_fin )
169169
170- root_chord = float (fin .find ("rootchord" ). text )
170+ root_chord = float (getattr ( fin .find ("rootchord" ), " text" , "0" ) )
171171 logger .info ("Root chord retrieved: %f" , root_chord )
172172
173- span = float (fin .find ("height" ). text )
173+ span = float (getattr ( fin .find ("height" ), " text" , "0" ) )
174174 logger .info ("Span retrieved: %f" , span )
175175
176- cant_angle = float (fin .find ("cant" ). text )
176+ cant_angle = float (getattr ( fin .find ("cant" ), " text" , "0" ) )
177177 logger .info ("Cant angle retrieved: %f" , cant_angle )
178178
179- section = fin .find ("crosssection" ). text
179+ section = getattr ( fin .find ("crosssection" ), " text" , "" )
180180 logger .info ("Crosssection format retrieved" )
181181
182182 fin_settings = {
0 commit comments