@@ -158,14 +158,19 @@ def _to_fields_group(card_lines: list[str]) -> list[str]:
158158 | | ELEM | 30 | THRU | 40 | | | | |
159159 +-------+------+-----+------+-----+-----+---+---+---+
160160 | | PROP | ALL | | | | | | |
161- +-------+------+-----+------+-----+-----+---+---+---+
161+ +-------+------+-----+------+-----+-----+---+---+---+
162+
163+ # TODO: buggy
164+ GROUP 991001 Description +
165+ + GRID 291 293 301 302 303 304 305 +
166+ + 306 1301 68408 68409 69144 69145 69146
162167 """
163- #for iline, line in enumerate(card_lines):
164- # print(f'GROUP {iline}: {line!r}')
168+ # for iline, line in enumerate(card_lines):
169+ # print(f'GROUP {iline}: {line!r}')
165170
166171 fields = _monpnt_line1_fields (card_lines [0 ])
167172 for j , line in enumerate (card_lines [1 :]):
168- line_strip = line .lstrip ()
173+ line_strip = line .lstrip ('+ ' )
169174 line = line .rstrip ()
170175 if line_strip .startswith ('META' ):
171176 fieldsi = [
@@ -180,10 +185,15 @@ def _to_fields_group(card_lines: list[str]) -> list[str]:
180185 # fieldsi = _expand_2_values_name(line)
181186 # #print(fieldsi)
182187 else :
183- raise NotImplementedError (line )
184- #print(f'GROUP fields[{j}]: fields={fieldsi}')
188+ fieldsi = [
189+ line [8 :16 ], line [16 :24 ], line [24 :32 ], line [32 :40 ], line [40 :48 ],
190+ line [48 :56 ], line [56 :64 ], line [64 :72 ],
191+ ]
192+ # msg = f'line:\n{line!r}\nline_strip:\n{line_strip!r}'
193+ # raise NotImplementedError(msg)
194+ # print(f'GROUP fields[{j}]: fields={fieldsi}')
185195 fields .extend (fieldsi )
186- #print(f'GROUP: fields={fields}')
196+ # print(f'GROUP: fields={fields}')
187197 return fields
188198
189199
@@ -218,36 +228,36 @@ def _to_fields_set1(card_lines: list[str], card_name: str) -> list[str]:
218228 for iline , line in enumerate (card_lines ):
219229 if '\t ' in line :
220230 line = expand_tabs (line )
221- #print(f'line = {line}')
231+ # print(f'line = {line}')
222232 line = line .rstrip ('\n \r ,' )
223- #print(f'line2 = {line}')
233+ # print(f'line2 = {line}')
224234 if '*' in line : # large field
225235 if ',' in line : # csv
226- new_fields = line .split (',' ) #[:5]
236+ new_fields = line .split (',' ) # [:5]
227237 new_fields = [field .strip () for field in new_fields if field .strip ()]
228238 if iline > 0 :
229239 new_fields = ['' ] + new_fields
230240 assert len (new_fields ) <= 5 , new_fields
231- #for unused_i in range(5 - len(new_fields)):
232- # new_fields.append('')
241+ # for unused_i in range(5 - len(new_fields)):
242+ # new_fields.append('')
233243 assert len (new_fields ) == 5 , new_fields
234244 else : # standard
235245 new_fields = [line [0 :8 ], line [8 :24 ], line [24 :40 ], line [40 :56 ],
236246 line [56 :72 ]]
237247 end = line [72 :].rstrip ('+ ' )
238248 assert len (end ) == 0 , line
239249 else : # small field
240- length_max = 9 #if iline == 0 else 8
250+ length_max = 9 # if iline == 0 else 8
241251 if ',' in line : # csv
242- new_fields = line .split (',' ) # [:9]
252+ new_fields = line .split (',' ) # [:9]
243253 new_fields = [field .strip () for field in new_fields if field .strip ()]
244254 if iline > 0 :
245255 new_fields = ['' ] + new_fields
246256 if len (new_fields ) >= length_max :
247257 throw_length_warning = True
248258 for unused_i in range (9 - len (new_fields )):
249259 new_fields .append ('' )
250- #assert len(new_fields) == 9, f'{new_fields}; {len(new_fields)}'
260+ # assert len(new_fields) == 9, f'{new_fields}; {len(new_fields)}'
251261 else : # standard
252262 new_fields = [line [0 :8 ], line [8 :16 ], line [16 :24 ], line [24 :32 ],
253263 line [32 :40 ], line [40 :48 ], line [48 :56 ], line [56 :64 ],
@@ -557,27 +567,28 @@ def _parse_pynastran_header(line: str) -> tuple[Optional[str], Optional[str]]:
557567 return key , value
558568
559569
560- #def clean_empty_lines(lines: list[str]) -> list[str]:
561- #"""
562- #Removes leading and trailing empty lines
563- #don't remove internally blank lines
564- #"""
565- #found_lines = False
566- #if len(lines) < 2:
567- #return lines
568-
569- #for i, line in enumerate(lines):
570- #if not found_lines and line:
571- #found_lines = True
572- #n1 = i
573- #n2 = i + 1
574- #elif found_lines and line:
575- #n2 = i + 1
576- #lines2 = lines[n1:n2]
577- #return lines2
578-
579-
580- def print_filename (filename : PathLike | StringIO , relpath : bool = True ) -> str :
570+ # def clean_empty_lines(lines: list[str]) -> list[str]:
571+ # """
572+ # Removes leading and trailing empty lines
573+ # don't remove internally blank lines
574+ # """
575+ # found_lines = False
576+ # if len(lines) < 2:
577+ # return lines
578+ #
579+ # for i, line in enumerate(lines):
580+ # if not found_lines and line:
581+ # found_lines = True
582+ # n1 = i
583+ # n2 = i + 1
584+ # elif found_lines and line:
585+ # n2 = i + 1
586+ # lines2 = lines[n1:n2]
587+ # return lines2
588+
589+
590+ def print_filename (filename : PathLike | StringIO ,
591+ relpath : bool = True ) -> str :
581592 """
582593 Takes a path such as C:/work/fem.bdf and locates the file using
583594 relative paths. If it's on another drive, the path is not modified.
@@ -586,13 +597,13 @@ def print_filename(filename: PathLike | StringIO, relpath: bool=True) -> str:
586597 ----------
587598 filename : str
588599 a filename string
600+ relpath: bool; default=True
601+ should the relative path be returned
589602
590603 Returns
591604 -------
592605 filename_string : str
593606 a shortened representation of the filename
594- relpath: bool; default=True
595- should the relative path be returned
596607
597608 """
598609 if isinstance (filename , StringIO ):
@@ -705,9 +716,9 @@ def fill_dmigs(model: BDF) -> None:
705716def _prep_comment (comment : str ) -> str :
706717 """cleans up the comment"""
707718 return comment .rstrip ()
708- #print('comment = %r' % comment)
709- #comment = ' this\n is\n a comment\n'
710- #print(comment.rstrip('\n').split('\n'))
711- #sline = [comment[1:] if len(comment) and comment[0] == ' ' else comment
712- # for comment in comment.rstrip().split('\n')]
713- #print('sline = ', sline)
719+ # print('comment = %r' % comment)
720+ # comment = ' this\n is\n a comment\n'
721+ # print(comment.rstrip('\n').split('\n'))
722+ # sline = [comment[1:] if len(comment) and comment[0] == ' ' else comment
723+ # for comment in comment.rstrip().split('\n')]
724+ # print('sline = ', sline)
0 commit comments