@@ -147,23 +147,29 @@ def import_from_dat(cls, path):
147147 """
148148 Import an airfoil from a '.dat' file
149149 """
150- profile = []
151150 name = 'imported from {}' .format (path )
152151 with open (path , "r" ) as p_file :
153- for i , line in enumerate (p_file ):
154- if line .endswith ("," ):
155- line = line [:- 1 ]
156-
157- match = cls ._re_coord_line .match (line )
158-
159- if match :
160- profile .append ([float (i ) for i in match .groups ()])
161- elif i == 0 :
162- name = line
163- else :
164- logger .error (f"error in dat airfoil: { path } { i } :({ line .strip ()} )" )
152+ return cls ._import_dat (p_file )
153+
154+ @classmethod
155+ def _import_dat (cls , p_file , name = "unnamed" ):
156+ profile = []
157+ for i , line in enumerate (p_file ):
158+ if line .endswith ("," ):
159+ line = line [:- 1 ]
160+
161+ match = cls ._re_coord_line .match (line )
162+
163+ if match :
164+ profile .append ([float (i ) for i in match .groups ()])
165+ elif i == 0 :
166+ name = line .strip ()
167+ else :
168+ logger .error (f"error in dat airfoil: { name } { i } :({ line .strip ()} )" )
169+
165170 return cls (profile , name )
166171
172+
167173 def export_dat (self , pfad ):
168174 """
169175 Export airfoil to .dat Format
@@ -172,7 +178,7 @@ def export_dat(self, pfad):
172178 if self .name :
173179 out .write (str (self .name ).strip ())
174180 for p in self .data :
175- out .write ("\n {:.12f }\t {:.12 }" .format (* p ))
181+ out .write ("\n {: 10.8f }\t {: 10.8f }" .format (* p ))
176182 return pfad
177183
178184 @classmethod
0 commit comments