Skip to content
This repository has been archived by the owner on Dec 10, 2024. It is now read-only.

Commit

Permalink
Libs: KiCad: fileformats update footprint (#21)
Browse files Browse the repository at this point in the history
* Add: global text_layer class

* Fix: keepout bool

* Add: offset and other options to pad class
  • Loading branch information
ruben-iteng authored Aug 23, 2024
1 parent 3065b02 commit 60856b7
Showing 1 changed file with 22 additions and 7 deletions.
29 changes: 22 additions & 7 deletions src/faebryk/libs/kicad/fileformats.py
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,15 @@ class E_type(SymEnum):
type: E_type


@dataclass
class C_text_layer:
class E_knockout(SymEnum):
knockout = auto()

layer: str = field(**sexp_field(positional=True))
knockout: Optional[E_knockout] = field(**sexp_field(positional=True), default=None)


@dataclass
class C_effects:
@dataclass
Expand Down Expand Up @@ -570,7 +579,7 @@ class C_arc:
class C_text:
text: str = field(**sexp_field(positional=True))
at: C_xyr
layer: str
layer: C_text_layer
uuid: UUID
effects: C_effects

Expand All @@ -583,7 +592,7 @@ class E_type(SymEnum):
type: E_type = field(**sexp_field(positional=True))
text: str = field(**sexp_field(positional=True))
at: C_xyr
layer: str
layer: C_text_layer
uuid: UUID
effects: C_effects

Expand Down Expand Up @@ -626,7 +635,7 @@ class C_property:
name: str = field(**sexp_field(positional=True))
value: str = field(**sexp_field(positional=True))
at: C_xyr
layer: str
layer: C_text_layer
hide: bool = False
uuid: UUID
effects: C_effects
Expand All @@ -636,7 +645,8 @@ class C_pad:
class E_type(SymEnum):
thru_hole = auto()
smd = auto()
np_thru_hole = auto()
none_plated_thru_hole = "np_thru_hole"
edge_connector = "connect"

class E_shape(SymEnum):
circle = auto()
Expand All @@ -663,9 +673,12 @@ class E_shape(SymEnum):
circle = ""
stadium = "oval"

shape: E_shape = field(**sexp_field(positional=True))
size_x: float = field(**sexp_field(positional=True))
shape: E_shape = field(
**sexp_field(positional=True), default=E_shape.circle
)
size_x: Optional[float] = field(**sexp_field(positional=True), default=None)
size_y: Optional[float] = field(**sexp_field(positional=True), default=None)
offset: Optional[C_xy] = None

# TODO: replace with generic gr item
@dataclass(kw_only=True)
Expand All @@ -687,6 +700,8 @@ class C_gr_poly(C_polygon):
drill: Optional[C_drill] = None
layers: list[str]
remove_unused_layers: bool = False
roundrect_rratio: Optional[float] = None
die_length: Optional[float] = None
options: Optional[C_options] = None
primitives: Optional[C_gr] = None
# TODO: primitives: add: gr_line, gr_arc, gr_circle, gr_rect, gr_curve, gr_bbox
Expand Down Expand Up @@ -926,7 +941,7 @@ class E_island_removal_mode(IntEnum):

@dataclass
class C_keepout:
class E_keepout_bool(StrEnum):
class E_keepout_bool(SymEnum):
allowed = auto()
not_allowed = auto()

Expand Down

0 comments on commit 60856b7

Please sign in to comment.