Source code for jitxlib.jlcpcb.rules
from jitx.substrate import FabricationConstraints
[docs]
class JLCPCBRules(FabricationConstraints):
"""JLCPCB Fabrication Constraints for 1oz Copper on 4-6 layer boards."""
# copper rules
min_copper_width = 0.09
min_copper_copper_space = 0.09
min_copper_hole_space = 0.254
min_copper_edge_space = 0.3
# soldermask rules
solder_mask_registration = 0.05
min_soldermask_opening = 0.0
min_soldermask_bridge = 0.08
# silkscreen rules
min_silkscreen_width = 0.153
min_silk_solder_mask_space = 0.15
min_silkscreen_text_height = 1.0
# via rules
min_annular_ring = 0.13
min_drill_diameter = 0.3
# pitch rules
min_pitch_leaded = 0.127 + 0.09
min_pitch_bga = 0.377
# pad rules
min_hole_to_hole = 0.5 # Pad to pad clearance (pad with hole, different nets)
min_pth_pin_solder_clearance = 0 # Soldermask expansion - None required
min_th_pad_expand_outer = 0.2 # Minimum Clearance -> Pad to Track
# board size => Max dimensions under "PCB specification"
max_board_width = 500
max_board_height = 400
[docs]
class JLCPCBRogersRules(FabricationConstraints):
"""JLCPCB Fabrication Constraints for their 2-layer, 1oz Rogers process.
Sources, read 2026-11-08:
- [HF] https://jlcpcb.com/pcb-fabrication/high-frequency-pcb, the
high-frequency PCB capabilities table.
- [CAP] https://jlcpcb.com/capabilities/pcb-capabilities, the general
capabilities page, for every field the HF table does not give. Where it
splits a value by layer count or copper weight, the 2-layer 1 oz figure
is used.
Values are JLCPCB's minimums, not their recommendations, except
`min_drill_diameter`, which takes the no-surcharge drill below.
"""
# copper rules
min_copper_width = 0.10 # [HF] minimum track width
min_copper_copper_space = 0.10 # [HF] minimum spacing
# [CAP] "PTH to Track" 0.28 mm minimum (0.35 recommended). Via hole to
# track and NPTH to track are 0.2 mm; one field covers every hole, so it
# takes the plated-hole figure.
min_copper_hole_space = 0.28
# [CAP] Outline: copper clearance from routed board edges and slots. A
# V-cut edge needs 0.4 mm instead.
min_copper_edge_space = 0.2
# soldermask rules
# [CAP] "Soldermask Expansion 1:1": the opening may equal the pad.
solder_mask_registration = 0.0
# [CAP] publishes no minimum opening.
min_soldermask_opening = 0.0
# [CAP] soldermask bridge, 1 oz, green; [HF] lists green soldermask only.
min_soldermask_bridge = 0.10
# silkscreen rules
min_silkscreen_width = 0.15 # [CAP] Legend: minimum line width
min_silk_solder_mask_space = 0.15 # [CAP] Legend: pad to silkscreen
min_silkscreen_text_height = 1.0 # [CAP] Legend: minimum text height
# via rules
# jitx defines this field as the "Minimum annular ring around a hole or
# via"; component through-hole pads have their own field,
# `min_th_pad_expand_outer` below. JITX's legacy open-components-database
# built its minimum via as drill + 2 x MinAnnularRing, so these rules take
# it as the via ring floor. [CAP] "Via diameter should be 0.1mm (0.15mm
# preferred) larger than Via hole size": a 0.05 mm minimum ring, 0.075 mm
# preferred.
# StdVia (0.4 on 0.3) meets the minimum and StdViaPreferred (0.45 on 0.3)
# the preferred figure.
min_annular_ring = 0.05
# [HF] lists a 0.2 mm minimum drill, a process floor like the standard
# process's 0.15 mm via hole ([CAP]). The order form charges extra for a
# via hole under 0.3 mm on a pad of 0.4 mm or less and nothing at 0.3 mm
# and above, so this takes 0.3 mm, the same no-surcharge basis as
# `JLCPCBRules`. A design that needs a smaller hole overrides it.
min_drill_diameter = 0.3
# pitch rules
# [CAP] gives no pitch directly. Smallest SMD pad, 0.25 mm, plus the SMD
# pad to pad clearance between different nets, 0.15 mm.
min_pitch_leaded = 0.25 + 0.15
# [CAP] gives no pitch directly. Smallest BGA pad, 0.2 mm, plus the same
# 0.15 mm pad to pad clearance. BGA pads of 0.2 to 0.25 mm need ENIG,
# not OSP.
min_pitch_bga = 0.2 + 0.15
# pad rules
# [CAP] "Pad Hole-to-Hole Spacing" 0.45 mm. Via to via is 0.2 mm; one
# field covers both, so it takes the pad figure.
min_hole_to_hole = 0.45
# [CAP] soldermask expansion 1:1, so no clearance from pad to mask.
min_pth_pin_solder_clearance = 0.0
# [CAP] PTH annular ring, 2-layer 1 oz: absolute minimum 0.18 mm (0.25
# recommended). The pad copper outside a component hole on an outer layer.
min_th_pad_expand_outer = 0.18
# board size: [HF] and [CAP] both give 590 x 438 mm for Rogers.
max_board_width = 590
max_board_height = 438