- raise Exception(f'invalid ldraw reference: {filename}')
- studs_counted = 0
- for line in path.read_text(encoding='utf8').split(CHAR_NEWLINE):
- line = line.lstrip()
- if not line.startswith('1'):
- continue
- toks = line.split(maxsplit=14)
- target = toks[14].replace('\\', '/')
- matrix = tuple(tuple(toks[n:n+3]) for n in (5, 8, 11))
- do_ignore = False
- for row in [[float(x) for x in row] for row in matrix]:
- if do_ignore:
- break
- for idx in range(len(row)): # pylint: disable=C0200
+ path = self._root.joinpath('p', filename)
+ if not path.exists():
+ raise Exception(f'invalid ldraw reference: {filename}')
+ studs_counted = 0
+ for line in path.read_text(encoding='utf8').split(CHAR_NEWLINE):
+ line = line.lstrip()
+ if not line.startswith('1'):
+ continue
+ toks = line.split(maxsplit=14)
+ target = toks[14].replace('\\', '/')
+ matrix = tuple(tuple(toks[n:n+3]) for n in (5, 8, 11))
+ do_ignore = False
+ for row in [[float(x) for x in row] for row in matrix]: