Fix python fp wizards according to last kicad code changes, especially EDA_ANGLE

This commit is contained in:
jean-pierre charras 2022-01-28 17:02:13 +01:00
parent d32a72ddde
commit 901a9387e9
5 changed files with 12 additions and 14 deletions

View File

@ -639,8 +639,7 @@ class FootprintWizardDrawingAids:
self.module.Reference().SetPosition( self.module.Reference().SetPosition(
self.module.Reference().GetPos0()) self.module.Reference().GetPos0())
self.module.Reference().SetTextSize(text_size) self.module.Reference().SetTextSize(text_size)
# internal angles are in 0.1 deg self.module.Reference().SetTextAngle( pcbnew.EDA_ANGLE( orientation_degree, pcbnew.DEGREES_T ) )
self.module.Reference().SetTextAngle(orientation_degree * 10)
def Value(self, x, y, size, orientation_degree=0): def Value(self, x, y, size, orientation_degree=0):
"""! """!
@ -657,8 +656,7 @@ class FootprintWizardDrawingAids:
self.module.Value().SetPosition(self.module.Value().GetPos0()) self.module.Value().SetPosition(self.module.Value().GetPos0())
self.module.Value().SetTextSize(text_size) self.module.Value().SetTextSize(text_size)
self.module.Value().SetLayer(self.DefaultTextValueLayer()) self.module.Value().SetLayer(self.DefaultTextValueLayer())
# internal angles are in 0.1 deg self.module.Value().SetTextAngle( pcbnew.EDA_ANGLE( orientation_degree, pcbnew.DEGREES_T ) )
self.module.Value().SetTextAngle(orientation_degree * 10)
def Box(self, x, y, w, h): def Box(self, x, y, w, h):
"""! """!

View File

@ -52,7 +52,7 @@ class PadMaker(object):
pad.SetAttribute(pcbnew.PAD_ATTRIB_PTH) pad.SetAttribute(pcbnew.PAD_ATTRIB_PTH)
pad.SetLayerSet(pad.PTHMask()) pad.SetLayerSet(pad.PTHMask())
pad.SetDrillSize(pcbnew.VECTOR2I(drill, drill)) pad.SetDrillSize(pcbnew.VECTOR2I(drill, drill))
pad.SetOrientation(rot_degree*10) # rotation is in 0.1 degrees pad.SetOrientation( pcbnew.EDA_ANGLE( rot_degree, pcbnew.DEGREES_T ) )
return pad return pad
@ -93,7 +93,7 @@ class PadMaker(object):
pad.SetShape(shape) pad.SetShape(shape)
pad.SetAttribute(pcbnew.PAD_ATTRIB_SMD) pad.SetAttribute(pcbnew.PAD_ATTRIB_SMD)
pad.SetLayerSet(pad.SMDMask()) pad.SetLayerSet(pad.SMDMask())
pad.SetOrientation(rot_degree*10) # rotation is in 0.1 degrees pad.SetOrientation( pcbnew.EDA_ANGLE( rot_degree, pcbnew.DEGREES_T ) )
return pad return pad
@ -423,7 +423,7 @@ class PadCircleArray(PadArray):
padAngle = self.padRotationOffset padAngle = self.padRotationOffset
if self.padRotationEnable: if self.padRotationEnable:
padAngle -=angle padAngle -=angle
pad.SetOrientation(padAngle*10) pad.SetOrientation( pcbnew.EDA_ANGLE( padAngle, pcbnew.DEGREES_T ) )
pad.SetName(self.GetName(pin)) pad.SetName(self.GetName(pin))
self.AddPad(pad) self.AddPad(pad)

View File

@ -38,7 +38,7 @@ class DemoArc(FootprintWizardBase.FootprintWizard):
centery = self.parameters["demo"]["centerY"] centery = self.parameters["demo"]["centerY"]
startptx = centerx startptx = centerx
startpty = centery+radius startpty = centery+radius
self.draw.Arc(centerx, centery, startptx, startpty, arc_angle_deg * 10) self.draw.Arc(centerx, centery, startptx, startpty, pcbnew.EDA_ANGLE( arc_angle_deg, pcbnew.DEGREES_T ) )
t_size = self.GetTextSize() t_size = self.GetTextSize()
self.draw.Reference(0, -t_size, t_size) self.draw.Reference(0, -t_size, t_size)
self.draw.Value(0, t_size, t_size) self.draw.Value(0, t_size, t_size)

View File

@ -88,7 +88,7 @@ class MutualcapButtonWizard(FootprintWizardBase.FootprintWizard):
###border h ###border h
self.module.SetLayer(F_Cu) self.module.SetLayer(F_Cu)
size_pad = pcbnew.wxSize( w, oew ) size_pad = pcbnew.VECTOR2I( w, oew )
self.module.Add(self.smdRectPad(self.module,size_pad, self.module.Add(self.smdRectPad(self.module,size_pad,
pcbnew.VECTOR2I(0, (int)((-h/2)+oew/2) ), pcbnew.VECTOR2I(0, (int)((-h/2)+oew/2) ),
str(1))) str(1)))
@ -96,7 +96,7 @@ class MutualcapButtonWizard(FootprintWizardBase.FootprintWizard):
pcbnew.VECTOR2I(0, (int)(( h/2)-oew/2) ), pcbnew.VECTOR2I(0, (int)(( h/2)-oew/2) ),
str(1))) str(1)))
###border v ###border v
size_pad = pcbnew.wxSize(oBorderWidth, h-2*oew) size_pad = pcbnew.VECTOR2I( int(oBorderWidth), int(h-2*oew) )
self.module.Add(self.smdRectPad(self.module,size_pad, self.module.Add(self.smdRectPad(self.module,size_pad,
pcbnew.VECTOR2I( (int)((-w/2)+oBorderWidth/2), 0), pcbnew.VECTOR2I( (int)((-w/2)+oBorderWidth/2), 0),
str(1))) str(1)))
@ -105,10 +105,10 @@ class MutualcapButtonWizard(FootprintWizardBase.FootprintWizard):
str(1))) str(1)))
xPos = -w/2+oBorderWidth+clearance+iew xPos = -w/2+oBorderWidth+clearance+iew
oFingerSize = pcbnew.wxSize(oew/2, h-oew-iew-2*clearance-oew) oFingerSize = pcbnew.VECTOR2I( int(oew/2), int(h-oew-iew-2*clearance-oew) )
iFingerSize = pcbnew.wxSize(iew,h-2*oew-2*clearance) iFingerSize = pcbnew.VECTOR2I( int(iew), int(h-2*oew-2*clearance) )
#horizontal inner electrode trace #horizontal inner electrode trace
self.module.Add(self.smdRectPad(self.module,pcbnew.wxSize(w-2*oBorderWidth-2*clearance,iew), self.module.Add(self.smdRectPad(self.module,pcbnew.VECTOR2I( int(w-2*oBorderWidth-2*clearance), int(iew) ),
pcbnew.VECTOR2I(0, (int)(h/2-oew-clearance-iew/2) ),str(2))) pcbnew.VECTOR2I(0, (int)(h/2-oew-clearance-iew/2) ),str(2)))
for i in range(0,oFingerCount): for i in range(0,oFingerCount):
#inner electrode fingers #inner electrode fingers

View File

@ -87,7 +87,7 @@ class QRCodeWizard(FootprintWizardBase.FootprintWizard):
# and a rectangle (a square) on silkscreen # and a rectangle (a square) on silkscreen
if self.UseCu: if self.UseCu:
pad = pcbnew.PAD(self.module) pad = pcbnew.PAD(self.module)
pad.SetSize(pcbnew.wxSize(self.X, self.X)) pad.SetSize(pcbnew.VECTOR2I(self.X, self.X))
pad_pos = pcbnew.VECTOR2I(xposition,yposition) pad_pos = pcbnew.VECTOR2I(xposition,yposition)
pad.SetPosition(pad_pos) pad.SetPosition(pad_pos)
pad.SetPos0(pad_pos) pad.SetPos0(pad_pos)