Skip to content

Commit

Permalink
Fix non-orthogonal rectangles in outlines
Browse files Browse the repository at this point in the history
  • Loading branch information
yaqwsx committed Jul 23, 2023
1 parent 27672b3 commit 6e60d10
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions kikit/substrate.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,14 +211,6 @@ def approximateBezier(bezier, endWith):

return outline

def createRectangle(rect):
"""
Take PCB_SHAPE and convert it into outline
"""
tl = rect.GetStart()
br = rect.GetEnd()
return [tl, (br[0], tl[1]), br, (tl[0], br[1]), tl]

def shapeLinechainToList(l: pcbnew.SHAPE_LINE_CHAIN) -> List[Tuple[int, int]]:
return [(p.x, p.y) for p in l.CPoints()]

Expand Down Expand Up @@ -259,7 +251,8 @@ def toShapely(ring, geometryList):
outline += approximateBezier(geometryList[idxA],
commonEndPoint(geometryList[idxA], geometryList[idxB]))
elif shape in [STROKE_T.S_RECT]:
outline += createRectangle(geometryList[idxA])
assert idxA == idxB
outline += geometryList[idxA].GetRectCorners()
elif shape in [STROKE_T.S_POLYGON]:
# Polygons are always closed, so they should appear as stand-alone
assert len(ring) in [1, 2]
Expand Down

0 comments on commit 6e60d10

Please sign in to comment.