diff --git a/kibot/bom/bom.py b/kibot/bom/bom.py index af5a8052..0ae5ac3d 100644 --- a/kibot/bom/bom.py +++ b/kibot/bom/bom.py @@ -11,6 +11,7 @@ All the logic to convert a list of components into the rows and columns used to """ import locale from copy import deepcopy +from math import ceil from .units import compare_values, comp_match from .bom_writer import write_bom from .columnlist import ColumnList @@ -185,9 +186,11 @@ class ComponentGroup(object): def get_count(self, project=None): if project is None: # Total components - return len(self.components) - # Only for the specified project - return sum(map(lambda c: c.project == project, self.components)) + c = sum(map(lambda c: c.qty, self.components)) + else: + # Only for the specified project + c = sum(map(lambda c: c.qty if c.project == project else 0, self.components)) + return int(ceil(c)) def get_build_count(self): if not self.is_fitted(): @@ -195,9 +198,11 @@ class ComponentGroup(object): return 0 if len(self.cfg.aggregate) == 1: # Just one project - return len(self.components)*self.cfg.number - # Multiple projects, count them using the number of board for each project - return sum(map(lambda c: self.cfg.qtys[c.project], self.components)) + c = sum(map(lambda c: c.qty, self.components))*self.cfg.number + else: + # Multiple projects, count them using the number of board for each project + c = sum(map(lambda c: self.cfg.qtys[c.project]*c.qty, self.components)) + return int(ceil(c)) def get_sources(self): sources = {} diff --git a/kibot/kicad/v5_sch.py b/kibot/kicad/v5_sch.py index a08a66c0..8bbbc13d 100644 --- a/kibot/kicad/v5_sch.py +++ b/kibot/kicad/v5_sch.py @@ -798,6 +798,8 @@ class SchematicComponent(object): - BoM DNF: only if True (and fitted is False) - fixed: means you can't change it by a replacement without authorization Is just a flag and doesn't affect much. + - footprint_rot: angle to rotate the part in the pick & place. + - qty: ammount of this part used. """ ref_re = re.compile(r'([^\d]+)([\?\d]+)') @@ -818,6 +820,7 @@ class SchematicComponent(object): self.fixed = False self.bottom = False self.footprint_rot = 0.0 + self.qty = 1 # KiCad 5 PCB flags (mutually exclusive) self.smd = False self.virtual = False