Create arc board edge via Python bindings

Hi,
I’m working on a plugin where I need to create arc edge cuts programmatically.
I tried the following, then also looked into PCB_SHAPE methods with no luck:

edge = pcbnew.PCB_ARC(board)
edge.SetLayer( pcbnew.Edge_Cuts )
edge.SetWidth( int(0.1 * 1e6) )
edge.SetStart( pcbnew.wxPointMM(0,0) )
edge.SetMid( pcbnew.wxPointMM(0,10) )
edge.SetEnd( pcbnew.wxPointMM(-10,0) )
board.Add(edge)

the above code works on “edge.SetLayer( pcbnew.F_Cu )” and other copper layers but not on the edge cuts one. what would be the way to make arcs on those other layers?

thanks for any pointer in the right direction.

Cheers,
Stef

PCB_ARC is a track subtype that’s why it only works on copper layers. You want PCB_SHAPE. Pass SHAPE_T_ARC as type parameter and board as the parent
https://docs.kicad.org/doxygen-python/classpcbnew_1_1PCB__SHAPE.html#a5f43b904b7f8204b6ff49eefb81dcb7c

1 Like

there is a plugin for it… you can get tips from its code

1 Like

works flawlessly as advertised using:

board = pcbnew.GetBoard()
arc = pcbnew.PCB_SHAPE(board, pcbnew.SHAPE_T_ARC)

thanks a lot

@maui thanks a lot for the link. I’m studying the code, definitely super useful. I’m considering expanding it to fillet PCB_TRACK and PCB_ARC… I’m not aware of any snippet out there doing fillet on curved tracks yet

RF-tools

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.