Skip to content

Commit

Permalink
Fix handling of multiple polygons in the board edges
Browse files Browse the repository at this point in the history
  • Loading branch information
yaqwsx committed Oct 11, 2024
1 parent 571be59 commit 46b2ea9
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions kikit/substrate.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ def getStartPoint(geom):
point = geom.GetStart() + pcbnew.VECTOR2I(geom.GetRadius(), 0)
elif geom.GetShape() == STROKE_T.S_RECT:
point = geom.GetStart()
elif geom.GetShape() == STROKE_T.S_POLYGON:
# Polygons don't use the properties for start point, look into the
# geometry
point = geom.GetPolyShape().Outline(0).CPoints()[0]
else:
point = geom.GetStart()
return point
Expand All @@ -62,6 +66,14 @@ def getEndPoint(geom):
elif geom.GetShape() == STROKE_T.S_RECT:
# Rectangle is closed, so it starts at the same point as it ends
point = geom.GetStart()
elif geom.GetShape() == STROKE_T.S_POLYGON:
# Polygons don't use the properties for start point, look into the
# geometry
outline = geom.GetPolyShape().Outline(0)
if outline.IsClosed():
point = outline.CPoints()[0]
else:
point = outline.CPoints()[-1]
else:
point = geom.GetStart() if geom.IsClosed() else geom.GetEnd()
return point
Expand Down

0 comments on commit 46b2ea9

Please sign in to comment.