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

Commit

Permalink
Fix for alternative circle definition
Browse files Browse the repository at this point in the history
  • Loading branch information
mawildoer committed Nov 3, 2024
1 parent 3e23c29 commit c01e06d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion dev_schematics.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def add_to_sys_path(path):


with add_to_sys_path(root_dir / "examples"):
from mcu import App
from iterative_design_nand import App

app = App()

Expand Down
8 changes: 7 additions & 1 deletion src/faebryk/exporters/schematic/kicad/transformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,13 @@ def _(obj: C_rect) -> BoundingBox | None:
@get_bbox.register
@staticmethod
def _(obj: C_circle) -> BoundingBox:
radius = Geometry.distance_euclid(obj.center, obj.end)
if obj.radius is None:
radius = Geometry.distance_euclid(obj.center, obj.end)
elif obj.end is None:
radius = obj.radius
else:
raise ValueError("Circle has both radius and end")

return Geometry.bbox(
(obj.center.x - radius, obj.center.y - radius),
(obj.center.x + radius, obj.center.y + radius),
Expand Down
3 changes: 2 additions & 1 deletion src/faebryk/libs/kicad/fileformats_sch.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,10 @@ class E_type(SymEnum):
@dataclass(kw_only=True)
class C_circle:
center: C_xy
end: C_xy
stroke: C_stroke
fill: C_fill
radius: Optional[float] = None
end: Optional[C_xy] = None


@dataclass(kw_only=True)
Expand Down

0 comments on commit c01e06d

Please sign in to comment.