Commit 744dd80e authored by jean-pierre charras's avatar jean-pierre charras

Minor fixes. Minor code cleaning. Pcbnew: better iniatilization of members in...

Minor fixes. Minor code cleaning. Pcbnew: better iniatilization of members in DRAWSEGMENT, TRACK, EDGE_MOD (not bugs: just useful when using python scripting).
parents b1ed22f7 4a7f92fb
......@@ -15,6 +15,7 @@
#include <wx/graphics.h>
static const bool FILLED = true;
static const bool NOT_FILLED = false;
/* Important Note:
* These drawing functions clip draw item before send these items to wxDC draw
......@@ -50,11 +51,8 @@ GR_DRAWMODE g_XorMode = GR_NXOR;
EDA_COLOR_T g_DrawBgColor = WHITE;
#define USE_CLIP_FILLED_POLYGONS
#ifdef USE_CLIP_FILLED_POLYGONS
static void ClipAndDrawFilledPoly( EDA_RECT * ClipBox, wxDC * DC, wxPoint Points[], int n );
#endif
static void ClipAndDrawPoly( EDA_RECT * ClipBox, wxDC * DC, wxPoint Points[],
int n );
/* These functions are used by corresponding functions
* ( GRSCircle is called by GRCircle for instance) after mapping coordinates
......@@ -857,14 +855,9 @@ static bool IsGRSPolyDrawable( EDA_RECT* ClipBox, int n, wxPoint Points[] )
/*
* Draw a new polyline and fill it if Fill, in screen space.
*/
static void GRSPoly( EDA_RECT* ClipBox,
wxDC* DC,
int n,
wxPoint Points[],
bool Fill,
int width,
EDA_COLOR_T Color,
EDA_COLOR_T BgColor )
static void GRSPoly( EDA_RECT* ClipBox, wxDC* DC, int n, wxPoint Points[],
bool Fill, int width,
EDA_COLOR_T Color, EDA_COLOR_T BgColor )
{
if( !IsGRSPolyDrawable( ClipBox, n, Points ) )
return;
......@@ -878,12 +871,9 @@ static void GRSPoly( EDA_RECT* ClipBox,
/* clip before send the filled polygon to wxDC, because under linux
* (GTK?) polygons having large coordinates are incorrectly drawn
* (integer overflow in coordinates, I am guessing)
*/
#ifdef USE_CLIP_FILLED_POLYGONS
ClipAndDrawFilledPoly( ClipBox, DC, Points, n );
#else
DC->DrawPolygon( n, Points ); // does not work very well under linux
#endif
ClipAndDrawPoly( ClipBox, DC, Points, n );
}
else
{
......@@ -903,47 +893,36 @@ static void GRSPoly( EDA_RECT* ClipBox,
/*
* Draw a new closed polyline and fill it if Fill, in screen space.
*/
static void GRSClosedPoly( EDA_RECT* ClipBox,
wxDC* DC,
int aPointCount,
wxPoint aPoints[],
bool Fill,
int width,
EDA_COLOR_T Color,
EDA_COLOR_T BgColor )
static void GRSClosedPoly( EDA_RECT* aClipBox, wxDC* aDC,
int aPointCount, wxPoint aPoints[],
bool aFill, int aWidth,
EDA_COLOR_T aColor,
EDA_COLOR_T aBgColor )
{
if( !IsGRSPolyDrawable( ClipBox, aPointCount, aPoints ) )
if( !IsGRSPolyDrawable( aClipBox, aPointCount, aPoints ) )
return;
GRSetColorPen( DC, Color, width );
GRSetColorPen( aDC, aColor, aWidth );
if( Fill && ( aPointCount > 2 ) )
if( aFill && ( aPointCount > 2 ) )
{
GRLastMoveToX = aPoints[aPointCount - 1].x;
GRLastMoveToY = aPoints[aPointCount - 1].y;
GRSetBrush( DC, BgColor, FILLED );
#ifdef USE_CLIP_FILLED_POLYGONS
ClipAndDrawFilledPoly( ClipBox, DC, aPoints, aPointCount );
#else
DC->DrawPolygon( aPointCount, aPoints ); // does not work very well under linux
#endif
GRSetBrush( aDC, aBgColor, FILLED );
ClipAndDrawPoly( aClipBox, aDC, aPoints, aPointCount );
}
else
{
GRSetBrush( DC, BgColor );
DC->DrawLines( aPointCount, aPoints );
GRSetBrush( aDC, aBgColor );
aDC->DrawLines( aPointCount, aPoints );
int lastpt = aPointCount - 1;
/* Close the polygon. */
if( aPoints[aPointCount - 1] != aPoints[0] )
if( aPoints[lastpt] != aPoints[0] )
{
GRLine( ClipBox,
DC,
aPoints[0].x,
aPoints[0].y,
aPoints[aPointCount - 1].x,
aPoints[aPointCount - 1].y,
width,
Color );
GRLine( aClipBox, aDC, aPoints[0].x, aPoints[0].y,
aPoints[lastpt].x, aPoints[lastpt].y,
aWidth, aColor );
}
}
}
......@@ -1153,7 +1132,7 @@ void GRFilledArc( EDA_RECT* ClipBox,
void GRFilledArc( EDA_RECT* ClipBox, wxDC* DC, int x, int y,
double StAngle, double EndAngle, int r,
double StAngle, double EndAngle, int r,
EDA_COLOR_T Color, EDA_COLOR_T BgColor )
{
GRFilledArc( ClipBox, DC, x, y, StAngle, EndAngle, r, 0, Color, BgColor );
......@@ -1322,30 +1301,20 @@ void GRFilledRect( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2,
void GRSRect( EDA_RECT* aClipBox, wxDC* aDC, int x1, int y1, int x2, int y2,
int aWidth, EDA_COLOR_T aColor, wxPenStyle aStyle )
{
wxPoint points[5];
points[0] = wxPoint(x1, y1);
points[1] = wxPoint(x1, y2);
points[2] = wxPoint(x2, y2);
points[3] = wxPoint(x2, y1);
points[4] = points[0];
GRSetColorPen( aDC, aColor, aWidth, aStyle );
GRSetBrush( aDC, BLACK );
if( aClipBox )
{
EDA_RECT clipbox(*aClipBox);
clipbox.Inflate(aWidth);
ClipAndDrawFilledPoly(&clipbox, aDC, points, 5); // polygon approach is more accurate
}
else
ClipAndDrawFilledPoly(aClipBox, aDC, points, 5);
GRSClosedPoly( aClipBox, aDC, 5, points, NOT_FILLED, aWidth,
aColor, aColor );
}
void GRSFilledRect( EDA_RECT* aClipBox, wxDC* aDC, int x1, int y1, int x2, int y2,
int aWidth, EDA_COLOR_T aColor, EDA_COLOR_T aBgColor )
{
wxPoint points[5];
points[0] = wxPoint(x1, y1);
points[1] = wxPoint(x1, y2);
......@@ -1354,21 +1323,19 @@ void GRSFilledRect( EDA_RECT* aClipBox, wxDC* aDC, int x1, int y1, int x2, int y
points[4] = points[0];
GRSetBrush( aDC, aBgColor, FILLED );
GRSetColorPen( aDC, aBgColor, aWidth );
if( aClipBox && (aWidth > 0) )
{
EDA_RECT clipbox(*aClipBox);
clipbox.Inflate(aWidth);
ClipAndDrawFilledPoly(&clipbox, aDC, points, 5); // polygon approach is more accurate
ClipAndDrawPoly(&clipbox, aDC, points, 5); // polygon approach is more accurate
}
else
ClipAndDrawFilledPoly(aClipBox, aDC, points, 5);
ClipAndDrawPoly(aClipBox, aDC, points, 5 );
}
#ifdef USE_CLIP_FILLED_POLYGONS
/**
* Function ClipAndDrawFilledPoly
* Function ClipAndDrawPoly
* Used to clip a polygon and draw it as Filled Polygon
* uses the Sutherland and Hodgman algo to clip the given poly against a
* rectangle. This rectangle is the drawing area this is useful under
......@@ -1382,7 +1349,7 @@ void GRSFilledRect( EDA_RECT* aClipBox, wxDC* aDC, int x1, int y1, int x2, int y
*/
#include <SutherlandHodgmanClipPoly.h>
void ClipAndDrawFilledPoly( EDA_RECT* aClipBox, wxDC* aDC, wxPoint aPoints[], int n )
void ClipAndDrawPoly( EDA_RECT* aClipBox, wxDC* aDC, wxPoint aPoints[], int n )
{
if( aClipBox == NULL )
{
......@@ -1417,9 +1384,6 @@ void ClipAndDrawFilledPoly( EDA_RECT* aClipBox, wxDC* aDC, wxPoint aPoints[], in
}
#endif
void GRBezier( EDA_RECT* ClipBox,
wxDC* DC,
int x1,
......@@ -1561,7 +1525,7 @@ EDA_COLOR_T ColorFindNearest( const wxColour &aColor )
return candidate;
}
void GRDrawAnchor( EDA_RECT *aClipBox, wxDC *aDC, int x, int y,
void GRDrawAnchor( EDA_RECT *aClipBox, wxDC *aDC, int x, int y,
int aSize, EDA_COLOR_T aColor )
{
int anchor_size = aDC->DeviceToLogicalXRel( aSize );
......
......@@ -472,23 +472,32 @@ void WORKSHEET_DATAITEM_TEXT::SetConstrainedTextSize()
if( m_ConstrainedTextSize.y == 0 )
m_ConstrainedTextSize.y = m_DefaultTextSize.y;
if( m_BoundingBoxSize.x )
if( m_BoundingBoxSize.x || m_BoundingBoxSize.y )
{
int linewidth = 0;
// to know the X size of the line, we should use
// ReturnGraphicTextWidth
// to know the X and Y size of the line, we should use
// EDA_TEXT::GetTextBox()
// but this function uses integers
// So, to avoid truncations with our unit in mm, use microns.
int sizex_micron = KiROUND( m_ConstrainedTextSize.x * 1000.0 );
double lenMsg = ReturnGraphicTextWidth( m_FullText, sizex_micron,
IsItalic(), linewidth ) / 1000.0;
if( lenMsg > m_BoundingBoxSize.x )
m_ConstrainedTextSize.x *= m_BoundingBoxSize.x / lenMsg;
}
if( m_BoundingBoxSize.y )
{
if( m_ConstrainedTextSize.y > m_BoundingBoxSize.y )
m_ConstrainedTextSize.y = m_BoundingBoxSize.y;
wxSize size_micron;
size_micron.x = KiROUND( m_ConstrainedTextSize.x * 1000.0 );
size_micron.y = KiROUND( m_ConstrainedTextSize.y * 1000.0 );
WS_DRAW_ITEM_TEXT dummy( WS_DRAW_ITEM_TEXT( this, this->m_FullText,
wxPoint(0,0),
size_micron,
linewidth, BLACK,
IsItalic(), IsBold() ) );
dummy.SetMultilineAllowed( true );
TransfertSetupToGraphicText( &dummy );
EDA_RECT rect = dummy.GetTextBox();
DSIZE size;
size.x = rect.GetWidth() / 1000.0;
size.y = rect.GetHeight() / 1000.0;
if( m_BoundingBoxSize.x && size.x > m_BoundingBoxSize.x )
m_ConstrainedTextSize.x *= m_BoundingBoxSize.x / size.x;
if( m_BoundingBoxSize.y && size.y > m_BoundingBoxSize.y )
m_ConstrainedTextSize.y *= m_BoundingBoxSize.y / size.y;
}
}
......@@ -75,7 +75,13 @@ void DIALOG_NEW_DATAITEM::OnCancelClick( wxCommandEvent& event )
void DIALOG_NEW_DATAITEM::OnOKClick( wxCommandEvent& event )
{
if( m_item->GetType() == WORKSHEET_DATAITEM::WS_TEXT )
((WORKSHEET_DATAITEM_TEXT*)m_item)->m_TextBase = m_textCtrlText->GetValue();
{
WORKSHEET_DATAITEM_TEXT* text = ((WORKSHEET_DATAITEM_TEXT*)m_item);
text->m_TextBase = m_textCtrlText->GetValue();
// For multiline texts, replace the '\n' char by the "\\n" sequence",
// in internal string
text->m_TextBase.Replace( wxT("\n"), wxT("\\n") );
}
wxString msg;
......
......@@ -110,18 +110,20 @@ DIALOG_NEW_DATAITEM_BASE::DIALOG_NEW_DATAITEM_BASE( wxWindow* parent, wxWindowID
m_SizerText = new wxBoxSizer( wxVERTICAL );
m_staticText10 = new wxStaticText( this, wxID_ANY, _("Text"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText10->Wrap( -1 );
m_SizerText->Add( m_staticText10, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_staticTextTitle = new wxStaticText( this, wxID_ANY, _("Text"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextTitle->Wrap( -1 );
m_SizerText->Add( m_staticTextTitle, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_textCtrlText = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_SizerText->Add( m_textCtrlText, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_textCtrlText = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE );
m_textCtrlText->SetMinSize( wxSize( 300,-1 ) );
m_SizerText->Add( m_textCtrlText, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_staticline3 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
m_SizerText->Add( m_staticline3, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
bSizerUpper->Add( m_SizerText, 0, wxEXPAND, 5 );
bSizerUpper->Add( m_SizerText, 1, wxEXPAND, 5 );
bSizerMain->Add( bSizerUpper, 1, wxEXPAND, 5 );
......
......@@ -42,7 +42,7 @@
<property name="minimum_size"></property>
<property name="name">DIALOG_NEW_DATAITEM_BASE</property>
<property name="pos"></property>
<property name="size">328,290</property>
<property name="size">328,335</property>
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
<property name="subclass">DIALOG_SHIM; dialog_shim.h</property>
<property name="title">New Item</property>
......@@ -1369,7 +1369,7 @@
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">0</property>
<property name="proportion">1</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">m_SizerText</property>
......@@ -1415,7 +1415,7 @@
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_staticText10</property>
<property name="name">m_staticTextTitle</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
......@@ -1461,7 +1461,7 @@
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<property name="proportion">1</property>
<object class="wxTextCtrl" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
......@@ -1496,7 +1496,7 @@
<property name="maxlength"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="minimum_size">300,-1</property>
<property name="moveable">1</property>
<property name="name">m_textCtrlText</property>
<property name="pane_border">1</property>
......@@ -1508,7 +1508,7 @@
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="style">wxTE_MULTILINE</property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
......
......@@ -54,7 +54,7 @@ class DIALOG_NEW_DATAITEM_BASE : public DIALOG_SHIM
wxChoice* m_choiceCornerEnd;
wxStaticLine* m_staticlineEndXY;
wxBoxSizer* m_SizerText;
wxStaticText* m_staticText10;
wxStaticText* m_staticTextTitle;
wxTextCtrl* m_textCtrlText;
wxStaticLine* m_staticline3;
wxStdDialogButtonSizer* m_sdbSizerButtons;
......@@ -68,7 +68,7 @@ class DIALOG_NEW_DATAITEM_BASE : public DIALOG_SHIM
public:
DIALOG_NEW_DATAITEM_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("New Item"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 328,290 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
DIALOG_NEW_DATAITEM_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("New Item"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 328,335 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_NEW_DATAITEM_BASE();
};
......
......@@ -56,9 +56,11 @@
DRAWSEGMENT::DRAWSEGMENT( BOARD_ITEM* aParent, KICAD_T idtype ) :
BOARD_ITEM( aParent, idtype )
{
m_Width = m_Type = m_Angle = 0;
m_Type = 0;
m_Angle = 0;
m_Flags = 0;
m_Shape = S_SEGMENT;
m_Width = Millimeter2iu( 0.15 ); // Gives a decent width
}
......
......@@ -57,7 +57,7 @@ EDGE_MODULE::EDGE_MODULE( MODULE* parent, STROKE_T aShape ) :
{
m_Shape = aShape;
m_Angle = 0;
m_Width = 120;
m_Layer = SILKSCREEN_N_FRONT;
}
......@@ -251,9 +251,9 @@ void EDGE_MODULE::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
aList.push_back( MSG_PANEL_ITEM( _( "Value" ), module->GetValue(), BLUE ) );
msg.Printf( wxT( "%8.8lX" ), module->GetTimeStamp() );
aList.push_back( MSG_PANEL_ITEM( _( "TimeStamp" ), msg, BROWN ) );
aList.push_back( MSG_PANEL_ITEM( _( "Mod Layer" ),
aList.push_back( MSG_PANEL_ITEM( _( "Mod Layer" ),
module->GetLayerName(), RED ) );
aList.push_back( MSG_PANEL_ITEM( _( "Seg Layer" ),
aList.push_back( MSG_PANEL_ITEM( _( "Seg Layer" ),
GetLayerName(), RED ) );
msg = ::CoordinateToString( m_Width );
aList.push_back( MSG_PANEL_ITEM( _( "Width" ), msg, BLUE ) );
......
......@@ -50,7 +50,9 @@ PCB_TARGET::PCB_TARGET( BOARD_ITEM* aParent ) :
BOARD_ITEM( aParent, PCB_TARGET_T )
{
m_Shape = 0;
m_Size = 5000;
m_Size = Millimeter2iu( 5 ); // Gives a decent size
m_Width = Millimeter2iu( 0.15 ); // Gives a decent width
m_Layer = EDGE_N; // a target is on all layers
}
PCB_TARGET::PCB_TARGET( BOARD_ITEM* aParent, int aShape, LAYER_NUM aLayer,
......
......@@ -482,7 +482,7 @@ int D_PAD::GetSolderMaskMargin()
int minsize = -std::min( m_Size.x, m_Size.y ) / 2;
if( margin < minsize )
minsize = minsize;
margin = minsize;
}
return margin;
......
......@@ -124,7 +124,7 @@ TRACK* GetTrace( TRACK* aStartTrace, TRACK* aEndTrace, const wxPoint& aPosition,
TRACK::TRACK( BOARD_ITEM* aParent, KICAD_T idtype ) :
BOARD_CONNECTED_ITEM( aParent, idtype )
{
m_Width = 0;
m_Width = Millimeter2iu( 0.2 );
m_Shape = S_SEGMENT;
start = end = NULL;
SetDrillDefault();
......@@ -187,6 +187,7 @@ SEGVIA::SEGVIA( BOARD_ITEM* aParent ) :
TRACK( aParent, PCB_VIA_T )
{
SetShape( VIA_THROUGH );
m_Width = Millimeter2iu( 0.5 );
}
......
#!/usr/bin/python
# This python script wizard creates a FPC connector
# for Surface Mounted Technology
from pcbnew import *
......@@ -6,7 +8,7 @@ class FPCFootprintWizard(FootprintWizardPlugin):
def __init__(self):
FootprintWizardPlugin.__init__(self)
self.name = "FPC"
self.description = "FPC Footprint Wizard"
self.description = "FPC (SMTechnology) Footprint Wizard"
self.parameters = {
"Pads":
{"*n":40, # not internal units preceded by "*"
......@@ -17,9 +19,9 @@ class FPCFootprintWizard(FootprintWizardPlugin):
{"shield_to_pad": FromMM(1.6),
"from_top": FromMM(1.3),
"width": FromMM(1.5),
"height": FromMM(2)},
"height": FromMM(2)}
}
self.ClearErrors()
# build a rectangular pad
......@@ -75,48 +77,61 @@ class FPCFootprintWizard(FootprintWizardPlugin):
shl_to_pad = p["Shield"]["shield_to_pad"]
shl_from_top = p["Shield"]["from_top"]
offsetX = pad_pitch*(pads-1)/2
size_pad = wxSize(pad_width,pad_height)
size_shld = wxSize(shl_width,shl_height)
size_text = wxSize( FromMM( 0.8), FromMM( 0.7) )
textposy = pad_height/2 + FromMM(1)
module.SetReference("FPC"+str(pads)) # give it a reference name
module.Reference().SetPos0(wxPointMM(-1,-2))
module.Reference().SetPosition(wxPointMM(-1,-2))
module.Reference().SetPos0(wxPoint(0, textposy))
module.Reference().SetTextPosition(module.Reference().GetPos0())
module.Reference().SetSize( size_text )
textposy = textposy + FromMM(1)
module.SetValue("Val***") # give it a default value
module.Value().SetPos0( wxPoint(0, textposy) )
module.Value().SetTextPosition(module.Value().GetPos0())
module.Value().SetSize( size_text )
module.SetLibRef("FPC"+str(pads)) #the name in library
# create a pad array and add it to the module
for n in range (0,pads):
pad = self.smdRectPad(module,size_pad,wxPoint(pad_pitch*n,0),str(n+1))
xpos = pad_pitch*n - offsetX
pad = self.smdRectPad(module,size_pad,wxPoint(xpos,0),str(n+1))
module.Add(pad)
pad_s0 = self.smdRectPad(module,
size_shld,
wxPoint(-shl_to_pad,shl_from_top),
"0")
pad_s1 = self.smdRectPad(module,
size_shld,
wxPoint((pads-1)*pad_pitch+shl_to_pad,shl_from_top),
"0")
xpos = -shl_to_pad-offsetX
pad_s0 = self.smdRectPad(module, size_shld, wxPoint(xpos,shl_from_top), "0")
xpos = (pads-1)*pad_pitch+shl_to_pad-offsetX
pad_s1 = self.smdRectPad(module, size_shld, wxPoint(xpos,shl_from_top), "0")
module.Add(pad_s0)
module.Add(pad_s1)
e = EDGE_MODULE(module)
e.SetStartEnd(wxPointMM(-1,0),wxPointMM(0,0))
e.SetWidth(FromMM(0.2))
e.SetLayer(EDGE_LAYER)
e.SetShape(S_SEGMENT)
module.Add(e)
module.SetLibRef("FPC"+str(pads))
def register():
# create our footprint wizard
fpc_wizard = FPCFootprintWizard()
# register it into pcbnew
fpc_wizard.register()
return fpc_wizard
#add outline
outline = EDGE_MODULE(module)
width = FromMM(0.2)
posy = -pad_height/2 - width/2 -FromMM(0.2)
outline.SetStartEnd(wxPoint(pad_pitch * pads - pad_pitch*0.5-offsetX, posy),
wxPoint( - pad_pitch*0.5-offsetX, posy))
outline.SetWidth(width)
outline.SetLayer(SILKSCREEN_N_FRONT) #default: not needed
outline.SetShape(S_SEGMENT)
module.Add(outline)
outline1 = EDGE_MODULE(module)
outline1.Copy(outline) #copy all settings from outline
posy = pad_height/2 + width/2 +FromMM(0.2)
outline1.SetStartEnd(wxPoint(pad_pitch * pads - pad_pitch*0.5-offsetX, posy),
wxPoint( - pad_pitch*0.5-offsetX, posy))
module.Add(outline1)
# create our footprint wizard
fpc_wizard = FPCFootprintWizard()
# register it into pcbnew
fpc_wizard.register()
......@@ -164,12 +164,18 @@ class TouchSliderWizard(FootprintWizardPlugin):
step_length = float(touch_length) / float(steps)
size_text = wxSize( FromMM( 1), FromMM( 1) );
module.SetReference("TS"+str(steps)) # give it a reference name
module.Reference().SetPos0(wxPointMM(-1,-2))
module.Reference().SetPosition(wxPointMM(-1,-2))
module.Reference().SetPos0(wxPointMM(0,-2))
module.Reference().SetTextPosition(module.Reference().GetPos0())
module.Reference().SetSize( size_text );
# starting pad
module.SetValue("Val**") # give it a value
module.Value().SetPos0(wxPointMM(0,-3.2))
module.Value().SetTextPosition(module.Value().GetPos0())
module.Value().SetSize( size_text );
# starting pad
pos = wxPointMM(0,0)
band_width = touch_width/bands
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment