Skip to content

Commit 6459174

Browse files
committed
Fixed issues with KiCad 6 and IsClosed()
1 parent 74f44eb commit 6459174

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

kikit/substrate.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,10 @@ def getEndPoint(geom):
6363
# Rectangle is closed, so it starts at the same point as it ends
6464
point = geom.GetStart()
6565
else:
66-
point = geom.GetStart() if geom.IsClosed() else geom.GetEnd()
66+
if hasattr(geom, 'IsClosed'):
67+
point = geom.GetStart() if geom.IsClosed() else geom.GetEnd()
68+
else:
69+
point = geom.GetEnd()
6770
return point
6871

6972
class CoincidenceList(list):
@@ -233,7 +236,8 @@ def shapePolyToShapely(p: pcbnew.SHAPE_POLY_SET) \
233236
polygons = []
234237
for pIdx in range(p.OutlineCount()):
235238
kOutline = p.Outline(pIdx)
236-
assert kOutline.IsClosed()
239+
if hasattr(kOutline, 'IsClosed'):
240+
assert kOutline.IsClosed()
237241
outline = shapeLinechainToList(kOutline)
238242
holes = []
239243
for hIdx in range(p.HoleCount(pIdx)):

0 commit comments

Comments
 (0)