import pcbnew
from pcbnew import *
b=pcbnew.GetBoard()
new_arc=PCB_SHAPE()
new_arc.SetShape(SHAPE_T)
p1= wxPoint(203200000, 127000000)
md= wxPoint(221160512, 134439488)
p2= wxPoint(228600000, 152400000)
# new_arc.SetArcGeometry(aStart: 'wxPoint', aMid: 'wxPoint', aEnd: 'wxPoint')
new_arc.SetArcGeometry(p1,md,p2)
# new_arc.SetStart(p1)
# new_arc.SetMid(md)
# new_arc.SetEnd(p2)
new_arc.SetWidth(250000)
new_arc.SetLayer(pcbnew.F_SilkS)
b.Add(new_arc)
# pcbnew.SaveBoard("./test.kicad_pcb",b)
Here a sample code that should work…
But the result is a line instead of an arc.
The format inside the file is ‘gr_line
’ instead of ‘gr_arc
’
Moreover, executing the Save code (last commented line), pcbnew just crashes.
I also found a nasty error… designing a simple 90 deg Arc with the Gui and pressing Edit and simply confirm the Arc will rotate… probably because Start point is mangled with Center point in the pcbnew code…
Application: KiCad PCB Editor (64-bit)
Version: (5.99.0-11630-gc5e195bdff), release build
Libraries:
wxWidgets 3.1.5
libcurl/7.74.0-DEV Schannel zlib/1.2.11
Platform: Windows 10 (build 18363), 64-bit edition, 64 bit, Little endian, wxMSW
Build Info:
Date: Aug 3 2021 21:00:05
wxWidgets: 3.1.5 (wchar_t,STL containers)
Boost: 1.75.0
OCC: 7.5.0
Curl: 7.74.0-DEV
ngspice: 34
Compiler: Visual C++ 1928 without C++ ABI
Build settings:
KICAD_USE_OCC=ON
KICAD_SPICE=ON
test.kicad_pcb (2.1 KB)
arc-dwg.kicad_pcb (2.1 KB)