mirror of
https://github.com/nophead/Mendel90.git
synced 2025-08-28 15:29:48 +02:00
bom.py parsing of OpenScad echo made more robust to get around bug in the MAC version of OpenScad.
This commit is contained in:
12
bom.py
12
bom.py
@@ -44,14 +44,15 @@ class BOM:
|
|||||||
name = ass.replace("_assembly","")
|
name = ass.replace("_assembly","")
|
||||||
longest = max(longest, len(name))
|
longest = max(longest, len(name))
|
||||||
for i in range(longest):
|
for i in range(longest):
|
||||||
|
line = ""
|
||||||
for ass in sorted(self.assemblies):
|
for ass in sorted(self.assemblies):
|
||||||
name = ass.replace("_assembly","").replace("_"," ").capitalize()
|
name = ass.replace("_assembly","").replace("_"," ").capitalize()
|
||||||
index = i - (longest - len(name))
|
index = i - (longest - len(name))
|
||||||
if index < 0:
|
if index < 0:
|
||||||
print(" ", end=" ", file=file)
|
line += " "
|
||||||
else:
|
else:
|
||||||
print(" %s" % name[index], end=" ", file=file)
|
line += (" %s " % name[index])
|
||||||
print(file=file)
|
print(line[:-1], file=file)
|
||||||
|
|
||||||
for part in sorted(self.vitamins):
|
for part in sorted(self.vitamins):
|
||||||
if ': ' in part:
|
if ': ' in part:
|
||||||
@@ -102,8 +103,9 @@ def boms(machine):
|
|||||||
stack = []
|
stack = []
|
||||||
|
|
||||||
for line in open("openscad.log"):
|
for line in open("openscad.log"):
|
||||||
if line[:7] == 'ECHO: "':
|
pos = line.find('ECHO: "')
|
||||||
s = line[7:-2]
|
if pos > -1:
|
||||||
|
s = line[pos + 7 : line.rfind('"')]
|
||||||
if s[-1] == '/':
|
if s[-1] == '/':
|
||||||
ass = s[:-1]
|
ass = s[:-1]
|
||||||
if stack:
|
if stack:
|
||||||
|
Reference in New Issue
Block a user