Python and footprint wizard: fix issues and update to be compatible
with recent changes in Kicad code.
This commit is contained in:
parent
4a3f77cd9d
commit
27ebba6b33
|
@ -49,7 +49,6 @@ class FPC_FootprintWizard(FootprintWizardBase.FootprintWizard):
|
|||
pad.SetShape(pcbnew.PAD_SHAPE_RECT)
|
||||
pad.SetAttribute(pcbnew.PAD_ATTRIB_SMD)
|
||||
pad.SetLayerSet( pad.SMDMask() )
|
||||
pad.SetPos0(pos)
|
||||
pad.SetPosition(pos)
|
||||
pad.SetName(name)
|
||||
return pad
|
||||
|
|
|
@ -486,7 +486,7 @@ class FootprintWizardDrawingAids:
|
|||
"""!
|
||||
Draw a line from (x1, y1) to (x2, y2)
|
||||
"""
|
||||
outline = pcbnew.FP_SHAPE(self.module)
|
||||
outline = pcbnew.PCB_SHAPE(self.module)
|
||||
outline.SetWidth(self.GetLineThickness())
|
||||
outline.SetLayer(self.GetLayer())
|
||||
outline.SetShape(pcbnew.S_SEGMENT)
|
||||
|
@ -508,7 +508,7 @@ class FootprintWizardDrawingAids:
|
|||
DC line thickness
|
||||
"""
|
||||
|
||||
circle = pcbnew.FP_SHAPE(self.module)
|
||||
circle = pcbnew.PCB_SHAPE(self.module)
|
||||
start = self.TransformPoint(x, y)
|
||||
|
||||
if filled:
|
||||
|
@ -548,7 +548,7 @@ class FootprintWizardDrawingAids:
|
|||
@param sy: the y coordinate of the arc start point
|
||||
@param angle: the arc's central angle (in deci-degrees)
|
||||
"""
|
||||
arc = pcbnew.FP_SHAPE(self.module)
|
||||
arc = pcbnew.PCB_SHAPE(self.module)
|
||||
arc.SetShape(pcbnew.SHAPE_T_ARC)
|
||||
arc.SetWidth(self.dc['lineThickness'])
|
||||
|
||||
|
@ -564,7 +564,7 @@ class FootprintWizardDrawingAids:
|
|||
arc.SetCenter(center)
|
||||
arc.SetStart(start)
|
||||
arc.SetArcAngleAndEnd(angle, True)
|
||||
arc.SetLocalCoord()
|
||||
#arc.SetLocalCoord()
|
||||
self.module.Add(arc)
|
||||
|
||||
def HLine(self, x, y, l):
|
||||
|
@ -635,9 +635,7 @@ class FootprintWizardDrawingAids:
|
|||
|
||||
text_size = pcbnew.VECTOR2I(size, size)
|
||||
|
||||
self.module.Reference().SetPos0(self.TransformPoint(x, y))
|
||||
self.module.Reference().SetPosition(
|
||||
self.module.Reference().GetPos0())
|
||||
self.module.Reference().SetPosition( self.TransformPoint(x, y) )
|
||||
self.module.Reference().SetTextSize(text_size)
|
||||
self.module.Reference().SetTextAngle( pcbnew.EDA_ANGLE( orientation_degree, pcbnew.DEGREES_T ) )
|
||||
|
||||
|
@ -652,8 +650,7 @@ class FootprintWizardDrawingAids:
|
|||
"""
|
||||
text_size = pcbnew.VECTOR2I(size, size)
|
||||
|
||||
self.module.Value().SetPos0(self.TransformPoint(x, y))
|
||||
self.module.Value().SetPosition(self.module.Value().GetPos0())
|
||||
self.module.Value().SetPosition(self.TransformPoint(x, y))
|
||||
self.module.Value().SetTextSize(text_size)
|
||||
self.module.Value().SetLayer(self.DefaultTextValueLayer())
|
||||
self.module.Value().SetTextAngle( pcbnew.EDA_ANGLE( orientation_degree, pcbnew.DEGREES_T ) )
|
||||
|
|
|
@ -156,7 +156,7 @@ class PadArray(object):
|
|||
|
||||
def AddPad(self, pad):
|
||||
"""!
|
||||
Add a pad to the array, under the same moodule as the main
|
||||
Add a pad to the array, under the same footprint as the main
|
||||
prototype pad
|
||||
@param pad: pad to add
|
||||
"""
|
||||
|
@ -175,7 +175,6 @@ class PadArray(object):
|
|||
|
||||
# create a new pad with same characteristics
|
||||
pad = pad.Duplicate()
|
||||
pad.SetPos0(pos)
|
||||
pad.SetPosition(pos)
|
||||
|
||||
return pad
|
||||
|
|
|
@ -64,7 +64,6 @@ class MutualcapButtonWizard(FootprintWizardBase.FootprintWizard):
|
|||
layerset.AddLayer(pcbnew.F_Cu)
|
||||
pad.SetLayerSet(layerset)
|
||||
|
||||
pad.SetPos0(pos)
|
||||
pad.SetPosition(pos)
|
||||
pad.SetName(name)
|
||||
return pad
|
||||
|
|
|
@ -66,8 +66,8 @@ class QRCodeWizard(FootprintWizardBase.FootprintWizard):
|
|||
self.qr.make()
|
||||
|
||||
def drawPixelSquareArea( self, layer, size, xposition, yposition):
|
||||
# creates a FP_SHAPE of rectangle type. The rectangle is square
|
||||
rectangle = pcbnew.FP_SHAPE(self.module)
|
||||
# creates a PCB_SHAPE of rectangle type. The rectangle is square
|
||||
rectangle = pcbnew.PCB_SHAPE(self.module)
|
||||
rectangle.SetShape(pcbnew.S_RECT)
|
||||
rectangle.SetWidth( 0 )
|
||||
rectangle.SetFilled( True )
|
||||
|
@ -77,8 +77,6 @@ class QRCodeWizard(FootprintWizardBase.FootprintWizard):
|
|||
rectangle.SetStartY( -halfsize+yposition )
|
||||
rectangle.SetEndX( halfsize+xposition )
|
||||
rectangle.SetEndY( halfsize+yposition )
|
||||
rectangle.SetStart0( rectangle.GetStart() )
|
||||
rectangle.SetEnd0( rectangle.GetEnd() )
|
||||
return rectangle
|
||||
|
||||
|
||||
|
@ -90,7 +88,6 @@ class QRCodeWizard(FootprintWizardBase.FootprintWizard):
|
|||
pad.SetSize(pcbnew.VECTOR2I(self.X, self.X))
|
||||
pad_pos = pcbnew.VECTOR2I(xposition,yposition)
|
||||
pad.SetPosition(pad_pos)
|
||||
pad.SetPos0(pad_pos)
|
||||
pad.SetShape(pcbnew.PAD_SHAPE_RECT)
|
||||
pad.SetAttribute(pcbnew.PAD_ATTRIB_SMD)
|
||||
pad.SetName("")
|
||||
|
@ -149,7 +146,6 @@ class QRCodeWizard(FootprintWizardBase.FootprintWizard):
|
|||
textPosition = int((self.textHeight) + ((1 + half_number_of_elements) * self.X))
|
||||
pos = pcbnew.VECTOR2I(0, - textPosition)
|
||||
self.module.Value().SetPosition(pos)
|
||||
self.module.Value().SetPos0(pos)
|
||||
self.module.Value().SetTextHeight(self.textHeight)
|
||||
self.module.Value().SetTextWidth(self.textWidth)
|
||||
self.module.Value().SetTextThickness(self.textThickness)
|
||||
|
@ -157,7 +153,6 @@ class QRCodeWizard(FootprintWizardBase.FootprintWizard):
|
|||
# Add Reference field
|
||||
pos = pcbnew.VECTOR2I(0, textPosition)
|
||||
self.module.Reference().SetPosition(pos)
|
||||
self.module.Reference().SetPos0(pos)
|
||||
self.module.Reference().SetTextHeight(self.textHeight)
|
||||
self.module.Reference().SetTextWidth(self.textWidth)
|
||||
self.module.Reference().SetTextThickness(self.textThickness)
|
||||
|
|
|
@ -66,7 +66,6 @@ class TouchSliderWizard(FootprintWizardBase.FootprintWizard):
|
|||
pad.SetShape(PAD_SHAPE_RECT)
|
||||
pad.SetAttribute(PAD_ATTRIB_SMD)
|
||||
pad.SetLayerSet(pad.ConnSMDMask())
|
||||
pad.SetPos0(pos)
|
||||
pad.SetPosition(pos)
|
||||
pad.SetName(name)
|
||||
return pad
|
||||
|
@ -78,7 +77,6 @@ class TouchSliderWizard(FootprintWizardBase.FootprintWizard):
|
|||
pad.SetShape(PAD_SHAPE_TRAPEZOID)
|
||||
pad.SetAttribute(PAD_ATTRIB_SMD)
|
||||
pad.SetLayerSet(pad.ConnSMDMask())
|
||||
pad.SetPos0(pos)
|
||||
pad.SetPosition(pos)
|
||||
pad.SetName(name)
|
||||
pad.SetDelta(VECTOR2I(left_right*size[1],up_down*size[0]))
|
||||
|
|
|
@ -166,15 +166,25 @@ static PCB_BITMAP* Cast_to_PCB_BITMAP( BOARD_ITEM* );
|
|||
else:
|
||||
raise TypeError("Unsupported drawing class: %s" % ct)
|
||||
|
||||
"""
|
||||
Needed to cast BOARD_ITEM::Duplicate() to the suitable type
|
||||
"""
|
||||
def Duplicate(self):
|
||||
ct = self.GetClass()
|
||||
if ct=="BOARD":
|
||||
return None
|
||||
else:
|
||||
return Cast_to_BOARD_ITEM( _pcbnew.BOARD_ITEM_Duplicate(self) ).Cast()
|
||||
|
||||
def SetPos(self,p):
|
||||
self.SetPosition(p)
|
||||
self.SetPos0(p)
|
||||
#self.SetPos0(p)
|
||||
|
||||
def SetStartEnd(self,start,end):
|
||||
self.SetStart(start)
|
||||
self.SetStart0(start)
|
||||
#self.SetStart0(start)
|
||||
self.SetEnd(end)
|
||||
self.SetEnd0(end)
|
||||
#self.SetEnd0(end)
|
||||
%}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue