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.
In fact the script is incorrect.
a working script (although not a very good script) is:
import pcbnew ZONE_CONTAINER( board)
from pcbnew import FromMM
board = pcbnew.GetBoard()
zone = pcbnew.
sps = zone.Outline() #pcbnew. SHAPE_POLY_ SET() SHAPE_LINE_ CHAIN() (True) chain) e(sps)
chain = pcbnew.
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
sps.AddOutline(
#zone.SetOutlin
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.