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
|
## 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> | |
|
| <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 |
|
| . | . | . | 2 | 2 | 4mm shielded jack socket blue |
|
||||||
| . | . | . | 1 | 1 | 4mm shielded jack socket brown |
|
| . | . | . | 1 | 1 | 4mm shielded jack socket brown |
|
||||||
| . | . | . | 2 | 2 | 4mm shielded jack socket green |
|
| . | . | . | 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 |
|
| . | . | 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 |
|
| . | . | 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 |
|
| . | . | 1 | 1 | 2 | Wire green & yellow 30/0.25mm strands, length 150mm - not shown |
|
||||||
| | | | | | **3D Printed parts** |
|
| 2 | 16 | 14 | 18 | 50 | Total vitamins count |
|
||||||
| . | 4 | . | . | 4 | foot.stl |
|
| | | | | | **3D printed parts** |
|
||||||
| 1 | . | . | . | 1 | socket_box.stl |
|
| . | 4 | . | . | 4 | foot.stl |
|
||||||
|
| 1 | . | . | . | 1 | socket_box.stl |
|
||||||
|
| 1 | 4 | . | . | 5 | Total 3D printed parts count |
|
||||||
|
|
||||||
[Top](#TOP)
|
[Top](#TOP)
|
||||||
|
|
||||||
|
@ -219,36 +219,49 @@ def views(target, do_assemblies = None):
|
|||||||
# Global BOM
|
# Global BOM
|
||||||
#
|
#
|
||||||
print('<a name="Parts_list"></a>\n## Parts list', file = doc_file)
|
print('<a name="Parts_list"></a>\n## Parts list', file = doc_file)
|
||||||
vitamins = {}
|
types = ["vitamins", "printed", "routed"]
|
||||||
printed = {}
|
headings = {"vitamins" : "vitamins", "printed" : "3D printed parts", "routed" : "CNC routed parts"}
|
||||||
routed = {}
|
things = {}
|
||||||
|
for t in types:
|
||||||
|
things[t] = {}
|
||||||
for ass in flat_bom:
|
for ass in flat_bom:
|
||||||
for v in ass["vitamins"]:
|
for t in types:
|
||||||
if v in vitamins:
|
for thing in ass[t]:
|
||||||
vitamins[v] += ass["vitamins"][v]
|
if thing in things[t]:
|
||||||
else:
|
things[t][thing] += ass[t][thing]
|
||||||
vitamins[v] = ass["vitamins"][v]
|
else:
|
||||||
for p in ass["printed"]:
|
things[t][thing] = ass[t][thing]
|
||||||
if p in printed:
|
|
||||||
printed[p] += ass["printed"][p]
|
|
||||||
else:
|
|
||||||
printed[p] = ass["printed"][p]
|
|
||||||
for ass in flat_bom:
|
for ass in flat_bom:
|
||||||
name = ass["name"][:-9].replace('_', ' ').title().replace(' ',' ')
|
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;">%s</span> ' % name, file = doc_file, end = '')
|
||||||
print('| <span style="writing-mode: vertical-rl; text-orientation: mixed;">TOTALS</span> | |', file = doc_file)
|
print('| <span style="writing-mode: vertical-rl; text-orientation: mixed;">TOTALS</span> | |', file = doc_file)
|
||||||
|
|
||||||
print(('|--:' * len(flat_bom) + '|--:|:--|'), 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:
|
for t in types:
|
||||||
count = ass["vitamins"][v] if v in ass["vitamins"] else '.'
|
if things[t]:
|
||||||
print('| %s ' % pad(count, 2, 1), file = doc_file, end = '')
|
totals = {}
|
||||||
print('| %s | %s |' % (pad(vitamins[v], 2, 1), pad(v.split(":")[1], 2)), file = doc_file)
|
heading = headings[t][0:1].upper() + headings[t][1:]
|
||||||
print(('| ' * len(flat_bom) + '| | **3D Printed parts** |'), file = doc_file)
|
print(('| ' * len(flat_bom) + '| | **%s** |') % heading, file = doc_file)
|
||||||
for p in sorted(printed):
|
for thing in sorted(things[t], key = lambda s: s.split(":")[-1]):
|
||||||
for ass in flat_bom:
|
for ass in flat_bom:
|
||||||
count = ass["printed"][p] if p in ass["printed"] else '.'
|
count = ass[t][thing] if thing in ass[t] else 0
|
||||||
print('| %s ' % pad(count, 2, 1), file = doc_file, end = '')
|
print('| %s ' % pad(count if count else '.', 2, 1), file = doc_file, end = '')
|
||||||
print('| %s | %s |' % (pad(printed[p], 2, 1), pad(p, 3)), file = doc_file)
|
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)
|
print(file = doc_file)
|
||||||
eop(print_mode, doc_file)
|
eop(print_mode, doc_file)
|
||||||
#
|
#
|
||||||
|
Loading…
Reference in New Issue
Block a user