Creating arcs in pcbnew python

I am struggling with the documentation for the pcbnew python scripting console. I am trying to draw an edge cut arc.

I can’t find any examples, the closest I have found is in the interface code, something like this:

**** I worked out the problem and have added the offending line

arc = pcbnew.DRAWSEGMENT(board )
arc.SetShape(pcbnew.S_ARC)
arc.SetCenter(pcbnew.wxPoint(pcbnew.FromMM(centre[0]),pcbnew.FromMM(centre[1])))
arc.SetArcStart(pcbnew.wxPoint(
pcbnew.FromMM(centre[0]+math.sqrt(outerRad**2-(fingerWidth/2)**2)),
pcbnew.FromMM(centre[1]+fingerWidth/2)))
arc.SetAngle(totalAngle)
arc.SetLayer(edgecut)
board.Add(arc)

Am I approaching this all wrong? Are there any examples I have missed?
thanks
Dave

It turns out I was being daft, I failed to add the arc to the canvas with a
board.add(arc)

I will amend it above.

1 Like

One other thing that confused me is that the angle is measured in tenths of a degree.

A good way to learn how objects are represented is to draw them in pcbnew and then inspect the result from python api. Then you can replicate it from api.

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