refinement

This commit is contained in:
jean-pierre charras 2017-01-04 16:17:40 +01:00
parent 02fa9639cd
commit 995940e992
1 changed files with 5 additions and 7 deletions

View File

@ -59,19 +59,17 @@ class QRCodeWizard(FootprintWizardBase.FootprintWizard):
self.qr.make() self.qr.make()
def drawSquareArea( self, layer, size, xposition, yposition): def drawSquareArea( self, layer, size, xposition, yposition):
# creates a EDGE_MODULE of polygon type # creates a EDGE_MODULE of polygon type. The polygon is a square
polygon = pcbnew.EDGE_MODULE(self.module) polygon = pcbnew.EDGE_MODULE(self.module)
polygon.SetShape(pcbnew.S_POLYGON) polygon.SetShape(pcbnew.S_POLYGON)
polygon.SetWidth( 0 ) polygon.SetWidth( 0 )
polygon.SetLayer(layer) polygon.SetLayer(layer)
clist = polygon.GetPolyPoints();
halfsize = size/2 halfsize = size/2
pos = pcbnew.wxPoint(xposition, yposition) pos = pcbnew.wxPoint(xposition, yposition)
clist.push_back( pcbnew.wxPoint( halfsize, halfsize ) + pos ) polygon.GetPolyPoints().push_back( pcbnew.wxPoint( halfsize, halfsize ) + pos )
clist.push_back( pcbnew.wxPoint( halfsize, -halfsize ) + pos ) polygon.GetPolyPoints().push_back( pcbnew.wxPoint( halfsize, -halfsize ) + pos )
clist.push_back( pcbnew.wxPoint( -halfsize, -halfsize ) + pos ) polygon.GetPolyPoints().push_back( pcbnew.wxPoint( -halfsize, -halfsize ) + pos )
clist.push_back( pcbnew.wxPoint( -halfsize, halfsize ) + pos ) polygon.GetPolyPoints().push_back( pcbnew.wxPoint( -halfsize, halfsize ) + pos )
polygon.SetPolyPoints(clist)
return polygon return polygon