1
0
mirror of https://github.com/nophead/NopSCADlib.git synced 2025-08-06 07:27:23 +02:00

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,23 +40,26 @@ def is_assembly(s):
return s[-9:] == '_assembly' or s[-11:] == '_assemblies' return s[-9:] == '_assembly' or s[-11:] == '_assemblies'
def add_assembly(flat_bom, bom, bounds_map): def add_assembly(flat_bom, bom, bounds_map):
if not bom in flat_bom: for b in flat_bom:
big = False if b["name"] == bom["name"]:
for ass in bom["assemblies"]: return b
add_assembly(flat_bom, ass, bounds_map) big = False
if ass["big"]: for ass in bom["assemblies"]:
b = add_assembly(flat_bom, ass, bounds_map)
if b["big"]:
big = True
if not big:
for stl in bom["printed"]:
bounds = bounds_map[stl]
width = bounds[1][0] - bounds[0][0]
depth = bounds[1][1] - bounds[0][1]
if max(width, depth) > 80:
big = True big = True
if not big: break
for stl in bom["printed"]:
bounds = bounds_map[stl]
width = bounds[1][0] - bounds[0][0]
depth = bounds[1][1] - bounds[0][1]
if max(width, depth) > 80:
big = True
break
bom["big"] = big or bom["routed"] bom["big"] = big or bom["routed"]
flat_bom.append(bom) flat_bom.append(bom)
return bom
def bom_to_assemblies(bom_dir, bounds_map): def bom_to_assemblies(bom_dir, bounds_map):
global flat_bom global flat_bom