Skip to content

Commit 9cbef3f

Browse files
committed
Improve default sorting order
#14
1 parent 86fd6e0 commit 9cbef3f

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

InteractiveHtmlBom/generate_interactive_bom.py

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,20 @@ def generate_bom(pcb, filter_layer=None):
7272
def sort_func(row):
7373
qty, _, _, rf = row
7474
ref_ord = {
75-
"R": 3, "C": 3, "L": 1, "D": 1,
76-
"J": -1, "P": -1
77-
}.get(rf[0][0], 0)
78-
return -ref_ord, -qty
75+
"C": 1,
76+
"R": 2,
77+
"L": 3,
78+
"D": 4,
79+
"Q": 5,
80+
"U": 6,
81+
"Y": 7,
82+
"X": 8,
83+
"F": 9,
84+
"S": 10,
85+
"J": 1001,
86+
"P": 1002
87+
}.get(rf[0][0], 1000)
88+
return ref_ord, -qty
7989

8090
bom_table = sorted(bom_table, key=sort_func)
8191

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

0 commit comments

Comments
 (0)