Skip to content

Commit

Permalink
Improve default sorting order
Browse files Browse the repository at this point in the history
  • Loading branch information
qu1ck committed Jul 29, 2018
1 parent 86fd6e0 commit 9cbef3f
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions InteractiveHtmlBom/generate_interactive_bom.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,20 @@ def generate_bom(pcb, filter_layer=None):
def sort_func(row):
qty, _, _, rf = row
ref_ord = {
"R": 3, "C": 3, "L": 1, "D": 1,
"J": -1, "P": -1
}.get(rf[0][0], 0)
return -ref_ord, -qty
"C": 1,
"R": 2,
"L": 3,
"D": 4,
"Q": 5,
"U": 6,
"Y": 7,
"X": 8,
"F": 9,
"S": 10,
"J": 1001,
"P": 1002
}.get(rf[0][0], 1000)
return ref_ord, -qty

bom_table = sorted(bom_table, key=sort_func)

Expand Down Expand Up @@ -411,4 +421,3 @@ def Run(self):
exit(1)
print("Loading %s" % args.file)
main(pcbnew.LoadBoard(os.path.abspath(args.file)), not args.nobrowser)

0 comments on commit 9cbef3f

Please sign in to comment.