Python fp wizards: Add a text ("${REFERENCE}") on fab layer to a few wizards.

This commit is contained in:
jean-pierre charras 2023-11-11 10:18:09 +01:00
parent 3e58425671
commit 75e0bf0cba
5 changed files with 41 additions and 2 deletions

View File

@ -119,12 +119,19 @@ class circular_pad_array_wizard(FootprintWizardBase.FootprintWizard):
self.draw.SetLineThickness(pcbnew.FromMM(0.05))
self.draw.Circle(0, 0, body_radius + outline['margin'])
# Text size
# Text (reference and value) size
text_size = self.GetTextSize() # IPC nominal
thickness = self.GetTextThickness()
textposy = body_radius + self.draw.GetLineThickness()/2 + self.GetTextSize()/2 + thickness + + outline['margin']
self.draw.Value( 0, textposy, text_size )
self.draw.Reference( 0, -textposy, text_size )
# Add a extra text (${REFERENCE}) on the F_Fab layer
extra_text = pcbnew.PCB_TEXT( self.module )
extra_text.SetLayer( pcbnew.F_Fab )
extra_text.SetPosition( pcbnew.VECTOR2I( 0, 0) )
extra_text.SetTextSize( pcbnew.VECTOR2I( text_size, text_size ) )
extra_text.SetText( "${REFERENCE}" )
self.module.Add( extra_text )
circular_pad_array_wizard().register()

View File

@ -200,5 +200,13 @@ class MicroMaTchWizard(FPWbase.FootprintWizard):
self.draw.Value(0, text_offset, text_size)
self.draw.Reference(0, -text_offset, text_size)
# Add a extra text (${REFERENCE}) on the F_Fab layer
extra_text = pcbnew.PCB_TEXT( self.module )
extra_text.SetLayer( pcbnew.F_Fab )
extra_text.SetPosition( pcbnew.VECTOR2I( 0, 0) )
extra_text.SetTextSize( pcbnew.VECTOR2I( text_size, text_size ) )
extra_text.SetText( "${REFERENCE}" )
self.module.Add( extra_text )
MicroMaTchWizard().register()

View File

@ -252,6 +252,14 @@ class QFNWizard(FootprintWizardBase.FootprintWizard):
self.draw.Value(0, text_offset, text_size)
self.draw.Reference(0, -text_offset, text_size)
# Add a extra text (${REFERENCE}) on the F_Fab layer
extra_text = pcbnew.PCB_TEXT( self.module )
extra_text.SetLayer( pcbnew.F_Fab )
extra_text.SetPosition( pcbnew.VECTOR2I( 0, 0) )
extra_text.SetTextSize( pcbnew.VECTOR2I( text_size, text_size ) )
extra_text.SetText( "${REFERENCE}" )
self.module.Add( extra_text )
# set SMD attribute
self.module.SetAttributes(pcbnew.FP_SMD)

View File

@ -165,6 +165,14 @@ class QFPWizard(FootprintWizardBase.FootprintWizard):
self.draw.Value(0, text_offset, text_size)
self.draw.Reference(0, -text_offset, text_size)
# Add a extra text (${REFERENCE}) on the F_Fab layer
extra_text = pcbnew.PCB_TEXT( self.module )
extra_text.SetLayer( pcbnew.F_Fab )
extra_text.SetPosition( pcbnew.VECTOR2I( 0, 0) )
extra_text.SetTextSize( pcbnew.VECTOR2I( text_size, text_size ) )
extra_text.SetText( "${REFERENCE}" )
self.module.Add( extra_text )
# set SMD attribute
self.module.SetAttributes(pcbnew.FP_SMD)

View File

@ -111,6 +111,14 @@ class RowedFootprint(FootprintWizardBase.FootprintWizard):
self.draw.Value(0, t_posy, text_size)
self.draw.Reference(0, -t_posy, text_size)
# Add a extra text (${REFERENCE}) on the F_Fab layer
extra_text = pcbnew.PCB_TEXT( self.module )
extra_text.SetLayer( pcbnew.F_Fab )
extra_text.SetPosition( pcbnew.VECTOR2I( 0, 0) )
extra_text.SetTextSize( pcbnew.VECTOR2I( text_size, text_size ) )
extra_text.SetText( "${REFERENCE}" )
self.module.Add( extra_text )
# set SMD attribute
if self.GetName() == "ZIP":
self.module.SetAttributes(pcbnew.FP_THROUGH_HOLE)