mirror of
https://github.com/DJSundog/NopSCADlib.git
synced 2024-11-23 15:23:51 -05:00
Now shows the CNC routed parts in the master BOM and total parts count.
This commit is contained in:
parent
881a032aa3
commit
5ae040079e
@ -31,6 +31,7 @@ Earth leakage can be measured Canadian CSA style by disconnected the neutral lin
|
||||
## Parts list
|
||||
| <span style="writing-mode: vertical-rl; text-orientation: mixed;">Base</span> | <span style="writing-mode: vertical-rl; text-orientation: mixed;">Feet</span> | <span style="writing-mode: vertical-rl; text-orientation: mixed;">Mains In</span> | <span style="writing-mode: vertical-rl; text-orientation: mixed;">Main</span> | <span style="writing-mode: vertical-rl; text-orientation: mixed;">TOTALS</span> | |
|
||||
|--:|--:|--:|--:|--:|:--|
|
||||
| | | | | | **Vitamins** |
|
||||
| . | . | . | 2 | 2 | 4mm shielded jack socket blue |
|
||||
| . | . | . | 1 | 1 | 4mm shielded jack socket brown |
|
||||
| . | . | . | 2 | 2 | 4mm shielded jack socket green |
|
||||
@ -47,9 +48,11 @@ Earth leakage can be measured Canadian CSA style by disconnected the neutral lin
|
||||
| . | . | 1 | 1 | 2 | Wire blue 30/0.25mm strands, length 150mm - not shown |
|
||||
| . | . | 2 | . | 2 | Wire brown 30/0.25mm strands, length 150mm - not shown |
|
||||
| . | . | 1 | 1 | 2 | Wire green & yellow 30/0.25mm strands, length 150mm - not shown |
|
||||
| | | | | | **3D Printed parts** |
|
||||
| . | 4 | . | . | 4 | foot.stl |
|
||||
| 1 | . | . | . | 1 | socket_box.stl |
|
||||
| 2 | 16 | 14 | 18 | 50 | Total vitamins count |
|
||||
| | | | | | **3D printed parts** |
|
||||
| . | 4 | . | . | 4 | foot.stl |
|
||||
| 1 | . | . | . | 1 | socket_box.stl |
|
||||
| 1 | 4 | . | . | 5 | Total 3D printed parts count |
|
||||
|
||||
[Top](#TOP)
|
||||
|
||||
|
@ -219,36 +219,49 @@ def views(target, do_assemblies = None):
|
||||
# Global BOM
|
||||
#
|
||||
print('<a name="Parts_list"></a>\n## Parts list', file = doc_file)
|
||||
vitamins = {}
|
||||
printed = {}
|
||||
routed = {}
|
||||
types = ["vitamins", "printed", "routed"]
|
||||
headings = {"vitamins" : "vitamins", "printed" : "3D printed parts", "routed" : "CNC routed parts"}
|
||||
things = {}
|
||||
for t in types:
|
||||
things[t] = {}
|
||||
for ass in flat_bom:
|
||||
for v in ass["vitamins"]:
|
||||
if v in vitamins:
|
||||
vitamins[v] += ass["vitamins"][v]
|
||||
else:
|
||||
vitamins[v] = ass["vitamins"][v]
|
||||
for p in ass["printed"]:
|
||||
if p in printed:
|
||||
printed[p] += ass["printed"][p]
|
||||
else:
|
||||
printed[p] = ass["printed"][p]
|
||||
for t in types:
|
||||
for thing in ass[t]:
|
||||
if thing in things[t]:
|
||||
things[t][thing] += ass[t][thing]
|
||||
else:
|
||||
things[t][thing] = ass[t][thing]
|
||||
for ass in flat_bom:
|
||||
name = ass["name"][:-9].replace('_', ' ').title().replace(' ',' ')
|
||||
print('| <span style="writing-mode: vertical-rl; text-orientation: mixed;">%s</span> ' % name, file = doc_file, end = '')
|
||||
print('| <span style="writing-mode: vertical-rl; text-orientation: mixed;">TOTALS</span> | |', file = doc_file)
|
||||
|
||||
print(('|--:' * len(flat_bom) + '|--:|:--|'), file = doc_file)
|
||||
for v in sorted(vitamins, key = lambda s: s.split(":")[-1]):
|
||||
for ass in flat_bom:
|
||||
count = ass["vitamins"][v] if v in ass["vitamins"] else '.'
|
||||
print('| %s ' % pad(count, 2, 1), file = doc_file, end = '')
|
||||
print('| %s | %s |' % (pad(vitamins[v], 2, 1), pad(v.split(":")[1], 2)), file = doc_file)
|
||||
print(('| ' * len(flat_bom) + '| | **3D Printed parts** |'), file = doc_file)
|
||||
for p in sorted(printed):
|
||||
for ass in flat_bom:
|
||||
count = ass["printed"][p] if p in ass["printed"] else '.'
|
||||
print('| %s ' % pad(count, 2, 1), file = doc_file, end = '')
|
||||
print('| %s | %s |' % (pad(printed[p], 2, 1), pad(p, 3)), file = doc_file)
|
||||
|
||||
for t in types:
|
||||
if things[t]:
|
||||
totals = {}
|
||||
heading = headings[t][0:1].upper() + headings[t][1:]
|
||||
print(('| ' * len(flat_bom) + '| | **%s** |') % heading, file = doc_file)
|
||||
for thing in sorted(things[t], key = lambda s: s.split(":")[-1]):
|
||||
for ass in flat_bom:
|
||||
count = ass[t][thing] if thing in ass[t] else 0
|
||||
print('| %s ' % pad(count if count else '.', 2, 1), file = doc_file, end = '')
|
||||
name = ass["name"]
|
||||
if name in totals:
|
||||
totals[name] += count
|
||||
else:
|
||||
totals[name] = count
|
||||
print('| %s | %s |' % (pad(things[t][thing], 2, 1), pad(thing.split(":")[-1], 2)), file = doc_file)
|
||||
|
||||
grand_total = 0
|
||||
for ass in flat_bom:
|
||||
name = ass["name"]
|
||||
total = totals[name] if name in totals else 0
|
||||
print('| %s ' % pad(total if total else '.', 2, 1), file = doc_file, end = '')
|
||||
grand_total += total
|
||||
print("| %s | %s |" % (pad(grand_total, 2, 1), pad('Total %s count' % headings[t], 2)), file = doc_file)
|
||||
|
||||
print(file = doc_file)
|
||||
eop(print_mode, doc_file)
|
||||
#
|
||||
|
Loading…
Reference in New Issue
Block a user