Skip to content
This repository was archived by the owner on Mar 7, 2026. It is now read-only.

Commit 04093aa

Browse files
authored
Add more constraints to stdlib (#134)
These are useful for importing KiCad projects.
1 parent 89d8a9c commit 04093aa

1 file changed

Lines changed: 34 additions & 0 deletions

File tree

board_config.zen

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,26 @@ Silkscreen = record(
3636
# Note: minimum_text_thickness is complex in KiCad API, not supported yet
3737
)
3838

39+
# Solder mask constraints
40+
SolderMask = record(
41+
clearance=field(float | None, None), # Mask expansion / clearance from pads to mask opening
42+
minimum_width=field(float | None, None), # Minimum mask web width
43+
to_copper_clearance=field(float | None, None), # Minimum solder-mask to copper-feature clearance
44+
)
45+
46+
# Zone defaults constraints
47+
Zones = record(
48+
minimum_clearance=field(float | None, None), # Default zone-to-copper clearance
49+
)
50+
3951
# All design rule constraints grouped together
4052
Constraints = record(
4153
copper=field(Copper | None, None),
4254
holes=field(Holes | None, None),
4355
uvias=field(Uvias | None, None),
4456
silkscreen=field(Silkscreen | None, None),
57+
solder_mask=field(SolderMask | None, None),
58+
zones=field(Zones | None, None),
4559
)
4660

4761
# Via dimensions for pre-defined sizes
@@ -210,6 +224,10 @@ def deep_merge(base, override):
210224
return Uvias(**merged)
211225
elif type_name == "Silkscreen":
212226
return Silkscreen(**merged)
227+
elif type_name == "SolderMask":
228+
return SolderMask(**merged)
229+
elif type_name == "Zones":
230+
return Zones(**merged)
213231
elif type_name == "ViaDimension":
214232
return ViaDimension(**merged)
215233
elif type_name == "NetClass":
@@ -931,6 +949,14 @@ BASE_CONSTRAINTS = Constraints(
931949
minimum_item_clearance=0.1, # Reasonable silkscreen clearance
932950
minimum_text_height=0.8, # Reasonable minimum text height
933951
),
952+
solder_mask=SolderMask(
953+
clearance=0.0,
954+
minimum_width=0.0,
955+
to_copper_clearance=0.0,
956+
),
957+
zones=Zones(
958+
minimum_clearance=0.15,
959+
),
934960
)
935961

936962
# Heavy Copper Constraints (2oz copper)
@@ -954,6 +980,14 @@ BASE_CONSTRAINTS_2OZ = Constraints(
954980
minimum_item_clearance=0.1,
955981
minimum_text_height=0.8,
956982
),
983+
solder_mask=SolderMask(
984+
clearance=0.0,
985+
minimum_width=0.0,
986+
to_copper_clearance=0.0,
987+
),
988+
zones=Zones(
989+
minimum_clearance=0.2,
990+
),
957991
)
958992

959993

0 commit comments

Comments
 (0)