mirror of
https://github.com/nophead/NopSCADlib.git
synced 2025-01-17 13:38:16 +01:00
Fixed assembly counts in json nexted BOM.
Fixed assembly counts in build instructions.
This commit is contained in:
parent
ad8d7ae311
commit
8d49f2b564
@ -54,11 +54,11 @@ class BOM:
|
||||
self.routed = {}
|
||||
self.assemblies = {}
|
||||
|
||||
def data(self, main):
|
||||
def data(self, main, count = 1):
|
||||
return {
|
||||
"name" : self.name,
|
||||
"count" : self.count,
|
||||
"assemblies" : [main.assemblies[ass].data(main) for ass in self.assemblies],
|
||||
"count" : count,
|
||||
"assemblies" : [main.assemblies[ass].data(main, self.assemblies[ass].count) for ass in self.assemblies],
|
||||
"vitamins" : self.vitamins,
|
||||
"printed" : self.printed,
|
||||
"routed" : self.routed
|
||||
|
@ -35,6 +35,7 @@ import blurb
|
||||
import bom
|
||||
import shutil
|
||||
from colorama import Fore
|
||||
import copy
|
||||
|
||||
def is_assembly(s):
|
||||
return s[-9:] == '_assembly' or s[-11:] == '_assemblies'
|
||||
@ -42,6 +43,7 @@ def is_assembly(s):
|
||||
def add_assembly(flat_bom, bom, bounds_map):
|
||||
for b in flat_bom:
|
||||
if b["name"] == bom["name"]:
|
||||
b["count"] += bom["count"]
|
||||
return b
|
||||
big = False
|
||||
for ass in bom["assemblies"]:
|
||||
@ -58,7 +60,7 @@ def add_assembly(flat_bom, bom, bounds_map):
|
||||
break
|
||||
|
||||
bom["big"] = big or bom["routed"]
|
||||
flat_bom.append(bom)
|
||||
flat_bom.append(copy.deepcopy(bom))
|
||||
return bom
|
||||
|
||||
def bom_to_assemblies(bom_dir, bounds_map):
|
||||
|
Loading…
x
Reference in New Issue
Block a user