Drawing a shape with a script

Hi,

I’m trying to draw shapes with the Python shell but it’s not showing up on my board. I have tried the following instructions:
circle = pcbnew.DRAWSEGMENT()
circle.SetShape(pcbnew.S_CIRCLE)
circle.SetCenter(pcbnew.wxPoint(0,0))
circle.SetArcStart(pcbnew.wxPoint(10,10))
circle.SetLayer(pcbnew.Edge_Cuts)
circle.SetWidth(10)
pcb.Add(circle)
Refresh()

I’m just experimenting. My goal is to write a script that draws the edges of the PCB automatically, with round edges and maybe even mounting holes, by detecting where the components are.

Many thanks!

There is a known issue where things added from console don’t show up in the view even if you call Refresh().

However if you save to a file and load the file they will be there.

Thanks for your reply! It hasn’t worked, but I created a script in the plugins folder and kept refreshing and that did the trick.

https://gitlabsu.sorbonne-universite.fr/mullerst/edgecuts

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