Comment 4 for bug 1828119

Revision history for this message
jean-pierre charras (jp-charras) wrote :

In fact the script is incorrect.
a working script (although not a very good script) is:

import pcbnew
from pcbnew import FromMM
board = pcbnew.GetBoard()
zone = pcbnew.ZONE_CONTAINER(board)

sps = zone.Outline() #pcbnew.SHAPE_POLY_SET()
chain = pcbnew.SHAPE_LINE_CHAIN()
chain.Append( FromMM(0.0), FromMM(0.0) )
chain.Append( FromMM(20.0), FromMM(0.0) )
chain.Append( FromMM(20.0), FromMM(20.0) )
chain.Append( FromMM(0.0), FromMM(20.0) )
chain.SetClosed(True)
sps.AddOutline(chain)
#zone.SetOutline(sps)
board.Add(zone)
pcbnew.Refresh()

Incorrect lines are commented.
The crash is for me something like a double deletion:
AddOutline() is an accessor to a private variable, and its use here is fully incorrect.