get_shapes duplicates Arcs
It appears the get_shape() duplicates PolyLineNode objects that contain an ArcStartMidEnd.
Attached is a board with 4 arcs in a polygon. This shape was created using 4 arcs, 4 line segments then using Create from Selection > Polygon. When saved, the polygon contains only 4 objects, KiCAD fills in the line segments.
Polygon from the .kicad_pcb
(gr_poly
(pts
(arc
(start 150 55)
(mid 148.535534 51.464466)
(end 145 50)
)
(arc
(start 105 50)
(mid 101.464466 51.464466)
(end 100 55)
)
(arc
(start 100 95)
(mid 101.464466 98.535534)
(end 105 100)
)
(arc
(start 145 100)
(mid 148.535534 98.535534)
(end 150 95)
)
)
(stroke
(width 0.15)
(type solid)
)
(fill no)
(layer "Edge.Cuts")
(uuid "24cf10dd-314e-4fa1-8bfe-6f9e10a78d39")
)
And when running this snippets against the attached board, the length is 8 and each arc is duplicated. When it's a mixture of arcs and lines, the arcs are still duplicated and the lines are delivered as expected.
from kipy import KiCad
kicad = KiCad()
shapes = kicad.get_board().get_shapes()[0]
nodes = shapes.polygons[0].outline.nodes
print(len(nodes))
for node in nodes:
print(node)
8
PolyLineNode(arc=ArcStartMidEnd(start=Vector2(150000000, 55000000), mid=Vector2(148535534, 51464466), end=Vector2(145000000, 50000000)))
PolyLineNode(arc=ArcStartMidEnd(start=Vector2(150000000, 55000000), mid=Vector2(148535534, 51464466), end=Vector2(145000000, 50000000)))
PolyLineNode(arc=ArcStartMidEnd(start=Vector2(105000000, 50000000), mid=Vector2(101464466, 51464466), end=Vector2(100000000, 55000000)))
PolyLineNode(arc=ArcStartMidEnd(start=Vector2(105000000, 50000000), mid=Vector2(101464466, 51464466), end=Vector2(100000000, 55000000)))
PolyLineNode(arc=ArcStartMidEnd(start=Vector2(100000000, 95000000), mid=Vector2(101464466, 98535534), end=Vector2(105000000, 100000000)))
PolyLineNode(arc=ArcStartMidEnd(start=Vector2(100000000, 95000000), mid=Vector2(101464466, 98535534), end=Vector2(105000000, 100000000)))
PolyLineNode(arc=ArcStartMidEnd(start=Vector2(145000000, 100000000), mid=Vector2(148535534, 98535534), end=Vector2(150000000, 95000000)))
PolyLineNode(arc=ArcStartMidEnd(start=Vector2(145000000, 100000000), mid=Vector2(148535534, 98535534), end=Vector2(150000000, 95000000)))
Edited by morgan