Fixed adding subassemblies more than once to build instructions and BOM.

This commit is contained in:
Chris Palmer 2019-06-17 17:36:28 +01:00
parent 23e6925091
commit ad8d7ae311

View File

@ -40,11 +40,13 @@ def is_assembly(s):
return s[-9:] == '_assembly' or s[-11:] == '_assemblies'
def add_assembly(flat_bom, bom, bounds_map):
if not bom in flat_bom:
for b in flat_bom:
if b["name"] == bom["name"]:
return b
big = False
for ass in bom["assemblies"]:
add_assembly(flat_bom, ass, bounds_map)
if ass["big"]:
b = add_assembly(flat_bom, ass, bounds_map)
if b["big"]:
big = True
if not big:
for stl in bom["printed"]:
@ -57,6 +59,7 @@ def add_assembly(flat_bom, bom, bounds_map):
bom["big"] = big or bom["routed"]
flat_bom.append(bom)
return bom
def bom_to_assemblies(bom_dir, bounds_map):
global flat_bom