Skip to content

Commit 24ba8ba

Browse files
committed
Basic KiCad 9 support
1 parent fc1c58f commit 24ba8ba

File tree

4 files changed

+139
-62
lines changed

4 files changed

+139
-62
lines changed

debian/changelog

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
kikit (1.6.0-5) stable; urgency=medium
2+
3+
* KiCad 9 detection
4+
5+
-- Salvador Eduardo Tropea <salvador@inti.gob.ar> Tue, 14 Jan 2025 08:48:13 -0300
6+
17
kikit (1.6.0-4) stable; urgency=medium
28

39
* Fixed KiCad 8.0.6 issue when adding text using "tl" anchor

kikit/common.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from typing import List, Optional, Tuple, Union, Callable
55
from kikit.defs import Layer
66
from kikit.typing import Box
7-
from pcbnewTransition import pcbnew, isV7, isV8
7+
from pcbnewTransition import pcbnew, isV7, isV8, isV9
88
from kikit.intervals import AxialLine
99
from pcbnewTransition.pcbnew import BOX2I, VECTOR2I, EDA_ANGLE
1010
import os
@@ -44,7 +44,7 @@ def fitsIn(what: Union[BOX2I, VECTOR2I], where: BOX2I) -> bool:
4444
Return true iff 'what' (BOX2I or VECTOR2I) is fully contained in 'where'
4545
(BOX2I)
4646
"""
47-
if isV7() or isV8():
47+
if isV7() or isV8() or isV9():
4848
assert isinstance(what, (BOX2I, VECTOR2I, pcbnew.wxPoint))
4949
else:
5050
assert isinstance(what, (BOX2I, VECTOR2I, pcbnew.wxPoint, pcbnew.EDA_RECT))

kikit/defs.py

Lines changed: 130 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,79 +1,150 @@
11
from enum import Enum, IntEnum
22
from .units import mm, inch
3+
from pcbnewTransition import isV9
34

45
# These classes miss in the exported interface
56

67
class Layer(IntEnum):
7-
F_Cu = 0
8-
B_Cu = 31
9-
In1_Cu = 1
10-
In2_Cu = 2
11-
In3_Cu = 3
12-
In4_Cu = 4
13-
In5_Cu = 5
14-
In6_Cu = 6
15-
In7_Cu = 7
16-
In8_Cu = 8
17-
In9_Cu = 9
18-
In10_Cu = 10
19-
In11_Cu = 11
20-
In12_Cu = 12
21-
In13_Cu = 13
22-
In14_Cu = 14
23-
In15_Cu = 15
24-
In16_Cu = 16
25-
In17_Cu = 17
26-
In18_Cu = 18
27-
In19_Cu = 19
28-
In20_Cu = 20
29-
In21_Cu = 21
30-
In22_Cu = 22
31-
In23_Cu = 23
32-
In24_Cu = 24
33-
In25_Cu = 25
34-
In26_Cu = 26
35-
In27_Cu = 27
36-
In28_Cu = 28
37-
In29_Cu = 29
38-
In30_Cu = 30
39-
B_Adhes = 32
40-
F_Adhes = 33
41-
B_Paste = 34
42-
F_Paste = 35
43-
B_SilkS = 36
44-
F_SilkS = 37
45-
B_Mask = 38
46-
F_Mask = 39
47-
Dwgs_User = 40
48-
Cmts_User = 41
49-
Eco1_User = 42
50-
Eco2_User = 43
51-
Edge_Cuts = 44
52-
Margin = 45
53-
B_CrtYd = 46
54-
F_CrtYd = 47
55-
B_Fab = 48
56-
F_Fab = 49
57-
User_1 = 50
58-
User_2 = 51
59-
User_3 = 52
60-
User_4 = 53
61-
User_5 = 54
62-
User_6 = 55
63-
User_7 = 56
64-
User_8 = 57
65-
User_9 = 58
8+
if isV9():
9+
F_Cu = 0
10+
B_Cu = 2
11+
In1_Cu = 4
12+
In2_Cu = 6
13+
In3_Cu = 8
14+
In4_Cu = 10
15+
In5_Cu = 12
16+
In6_Cu = 14
17+
In7_Cu = 16
18+
In8_Cu = 18
19+
In9_Cu = 20
20+
In10_Cu = 22
21+
In11_Cu = 24
22+
In12_Cu = 26
23+
In13_Cu = 28
24+
In14_Cu = 30
25+
In15_Cu = 32
26+
In16_Cu = 34
27+
In17_Cu = 36
28+
In18_Cu = 38
29+
In19_Cu = 40
30+
In20_Cu = 42
31+
In21_Cu = 44
32+
In22_Cu = 46
33+
In23_Cu = 48
34+
In24_Cu = 50
35+
In25_Cu = 52
36+
In26_Cu = 54
37+
In27_Cu = 56
38+
In28_Cu = 58
39+
In29_Cu = 60
40+
In30_Cu = 62
41+
B_Adhes = 11
42+
F_Adhes = 9
43+
B_Paste = 15
44+
F_Paste = 13
45+
B_SilkS = 7
46+
F_SilkS = 5
47+
B_Mask = 3
48+
F_Mask = 1
49+
Dwgs_User = 17
50+
Cmts_User = 19
51+
Eco1_User = 21
52+
Eco2_User = 23
53+
Edge_Cuts = 25
54+
Margin = 27
55+
B_CrtYd = 29
56+
F_CrtYd = 31
57+
B_Fab = 33
58+
F_Fab = 35
59+
User_1 = 39
60+
User_2 = 41
61+
User_3 = 43
62+
User_4 = 45
63+
User_5 = 47
64+
User_6 = 49
65+
User_7 = 51
66+
User_8 = 53
67+
User_9 = 55
68+
else:
69+
F_Cu = 0
70+
B_Cu = 31
71+
In1_Cu = 1
72+
In2_Cu = 2
73+
In3_Cu = 3
74+
In4_Cu = 4
75+
In5_Cu = 5
76+
In6_Cu = 6
77+
In7_Cu = 7
78+
In8_Cu = 8
79+
In9_Cu = 9
80+
In10_Cu = 10
81+
In11_Cu = 11
82+
In12_Cu = 12
83+
In13_Cu = 13
84+
In14_Cu = 14
85+
In15_Cu = 15
86+
In16_Cu = 16
87+
In17_Cu = 17
88+
In18_Cu = 18
89+
In19_Cu = 19
90+
In20_Cu = 20
91+
In21_Cu = 21
92+
In22_Cu = 22
93+
In23_Cu = 23
94+
In24_Cu = 24
95+
In25_Cu = 25
96+
In26_Cu = 26
97+
In27_Cu = 27
98+
In28_Cu = 28
99+
In29_Cu = 29
100+
In30_Cu = 30
101+
B_Adhes = 32
102+
F_Adhes = 33
103+
B_Paste = 34
104+
F_Paste = 35
105+
B_SilkS = 36
106+
F_SilkS = 37
107+
B_Mask = 38
108+
F_Mask = 39
109+
Dwgs_User = 40
110+
Cmts_User = 41
111+
Eco1_User = 42
112+
Eco2_User = 43
113+
Edge_Cuts = 44
114+
Margin = 45
115+
B_CrtYd = 46
116+
F_CrtYd = 47
117+
B_Fab = 48
118+
F_Fab = 49
119+
User_1 = 50
120+
User_2 = 51
121+
User_3 = 52
122+
User_4 = 53
123+
User_5 = 54
124+
User_6 = 55
125+
User_7 = 56
126+
User_8 = 57
127+
User_9 = 58
66128

67129
@staticmethod
68130
def allCu():
131+
if isV9():
132+
return list(range(0, 64, 2))
69133
return list(range(Layer.F_Cu, Layer.B_Cu + 1))
70134

71135
@staticmethod
72136
def all():
137+
if isV9():
138+
return list(range(0, 63))
73139
return list(range(Layer.F_Cu, Layer.User_4 + 1))
74140

75141
@staticmethod
76142
def allTech():
143+
if isV9():
144+
return [Layer.B_Adhes, Layer.F_Adhes, Layer.B_Paste, Layer.F_Paste, Layer.B_SilkS, Layer.F_SilkS, Layer.B_Mask,
145+
Layer.F_Mask, Layer.Dwgs_User, Layer.Cmts_User, Layer.Eco1_User, Layer.Eco2_User, Layer.Edge_Cuts,
146+
Layer.Margin, Layer.B_CrtYd, Layer.F_CrtYd, Layer.B_Fab, Layer.F_Fab, Layer.User_1, Layer.User_2,
147+
Layer.User_3, Layer.User_4, Layer.User_5, Layer.User_6, Layer.User_7, Layer.User_8, Layer.User_9]
77148
return list(x for x in range(Layer.Dwgs_User, Layer.User_4 + 1))
78149

79150
@staticmethod

kikit/panelize.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,7 @@ def bakeTextVars(board: pcbnew.BOARD) -> None:
453453
for drawing in board.GetDrawings():
454454
if not isinstance(drawing, pcbnew.PCB_TEXT):
455455
continue
456-
if isV8():
456+
if isV8() or isV9():
457457
drawing.SetText(drawing.GetShownText(True))
458458
else:
459459
drawing.SetText(drawing.GetShownText())

0 commit comments

Comments
 (0)