Commit eb396a5e authored by jean-pierre charras's avatar jean-pierre charras

Fix footprint wizard issues. Fix export vrml incorrect Z position of items.

parent 39216b4b
...@@ -95,15 +95,13 @@ LSET D_PAD::StandardMask() ...@@ -95,15 +95,13 @@ LSET D_PAD::StandardMask()
LSET D_PAD::SMDMask() LSET D_PAD::SMDMask()
{ {
// was: #define PAD_SMD_DEFAULT_LAYERS LAYER_FRONT | SOLDERPASTE_LAYER_FRONT | SOLDERMASK_LAYER_FRONT
static LSET saved( 3, F_Cu, F_Paste, F_Mask ); static LSET saved( 3, F_Cu, F_Paste, F_Mask );
return saved; return saved;
} }
LSET D_PAD::ConnMask() LSET D_PAD::ConnSMDMask()
{ {
// was: #define PAD_CONN_DEFAULT_LAYERS LAYER_FRONT | SOLDERMASK_LAYER_FRONT
static LSET saved( 2, F_Cu, F_Mask ); static LSET saved( 2, F_Cu, F_Mask );
return saved; return saved;
} }
......
...@@ -88,10 +88,11 @@ public: ...@@ -88,10 +88,11 @@ public:
/* Default layers used for pads, according to the pad type. /* Default layers used for pads, according to the pad type.
* this is default values only, they can be changed for a given pad * this is default values only, they can be changed for a given pad
*/ */
static LSET StandardMask(); static LSET StandardMask(); ///< layer set for a through hole pad
static LSET ConnMask(); static LSET SMDMask(); ///< layer set for a SMD pad on Front layer
static LSET SMDMask(); static LSET ConnSMDMask(); ///< layer set for a SMD pad on Front layer
static LSET UnplatedHoleMask(); ///< used for edge board connectors
static LSET UnplatedHoleMask(); ///< layer set for a mechanical unplated through hole pad
void Copy( D_PAD* source ); void Copy( D_PAD* source );
...@@ -419,6 +420,16 @@ public: ...@@ -419,6 +420,16 @@ public:
EDA_ITEM* Clone() const; EDA_ITEM* Clone() const;
/**
* same as Clone, but returns a D_PAD item.
* Useful mainly for pythons scripts, because Clone (virtual function)
* returns an EDA_ITEM.
*/
D_PAD* Duplicate() const
{
return (D_PAD*) Clone();
}
/// @copydoc VIEW_ITEM::ViewGetLayers() /// @copydoc VIEW_ITEM::ViewGetLayers()
virtual void ViewGetLayers( int aLayers[], int& aCount ) const; virtual void ViewGetLayers( int aLayers[], int& aCount ) const;
......
...@@ -76,7 +76,7 @@ static const LSET std_pad_layers[] = { ...@@ -76,7 +76,7 @@ static const LSET std_pad_layers[] = {
D_PAD::SMDMask(), D_PAD::SMDMask(),
// PAD_CONN: // PAD_CONN:
D_PAD::ConnMask(), D_PAD::ConnSMDMask(),
// PAD_HOLE_NOT_PLATED: // PAD_HOLE_NOT_PLATED:
D_PAD::UnplatedHoleMask() D_PAD::UnplatedHoleMask()
......
...@@ -473,9 +473,9 @@ static void compute_layer_Zs( MODEL_VRML& aModel, BOARD* pcb ) ...@@ -473,9 +473,9 @@ static void compute_layer_Zs( MODEL_VRML& aModel, BOARD* pcb )
LAYER_ID i = *seq; LAYER_ID i = *seq;
if( i < copper_layers ) if( i < copper_layers )
aModel.SetLayerZ( i, aModel.board_thickness * i / (copper_layers - 1) - half_thickness ); aModel.SetLayerZ( i, half_thickness - aModel.board_thickness * i / (copper_layers - 1) );
else else
aModel.SetLayerZ( i, half_thickness ); // component layer aModel.SetLayerZ( i, - half_thickness ); // bottom layer
} }
/* To avoid rounding interference, we apply an epsilon to each /* To avoid rounding interference, we apply an epsilon to each
......
...@@ -30,7 +30,7 @@ class FPCFootprintWizard(FootprintWizardPlugin): ...@@ -30,7 +30,7 @@ class FPCFootprintWizard(FootprintWizardPlugin):
pad.SetSize(size) pad.SetSize(size)
pad.SetShape(PAD_RECT) pad.SetShape(PAD_RECT)
pad.SetAttribute(PAD_SMD) pad.SetAttribute(PAD_SMD)
pad.SetLayerMask(PAD_SMD_DEFAULT_LAYERS) pad.SetLayerSet( pad.StandardMask() )
pad.SetPos0(pos) pad.SetPos0(pos)
pad.SetPosition(pos) pad.SetPosition(pos)
pad.SetPadName(name) pad.SetPadName(name)
...@@ -126,7 +126,7 @@ class FPCFootprintWizard(FootprintWizardPlugin): ...@@ -126,7 +126,7 @@ class FPCFootprintWizard(FootprintWizardPlugin):
xstart = - pad_pitch*0.5-offsetX xstart = - pad_pitch*0.5-offsetX
xend = pad_pitch * pads + xstart; xend = pad_pitch * pads + xstart;
outline.SetStartEnd( wxPoint(xstart, posy), wxPoint( xend, posy) ) outline.SetStartEnd( wxPoint(xstart, posy), wxPoint( xend, posy) )
outline.SetLayer(SILKSCREEN_N_FRONT) #default: not needed outline.SetLayer(F_SilkS) #default: not needed
outline.SetShape(S_SEGMENT) outline.SetShape(S_SEGMENT)
module.Add(outline) module.Add(outline)
......
...@@ -17,7 +17,7 @@ class PadMaker: ...@@ -17,7 +17,7 @@ class PadMaker:
pad.SetShape(shape) pad.SetShape(shape)
pad.SetAttribute(pcbnew.PAD_STANDARD) pad.SetAttribute(pcbnew.PAD_STANDARD)
pad.SetLayerMask(pcbnew.PAD_STANDARD_DEFAULT_LAYERS) pad.SetLayerSet(pad.StandardMask())
pad.SetDrillSize(pcbnew.wxSize(drill, drill)) pad.SetDrillSize(pcbnew.wxSize(drill, drill))
return pad return pad
...@@ -29,7 +29,7 @@ class PadMaker: ...@@ -29,7 +29,7 @@ class PadMaker:
pad.SetShape(shape) pad.SetShape(shape)
pad.SetAttribute(pcbnew.PAD_SMD) pad.SetAttribute(pcbnew.PAD_SMD)
pad.SetLayerMask(pcbnew.PAD_SMD_DEFAULT_LAYERS) pad.SetLayerSet(pad.SMDMask())
return pad return pad
...@@ -45,19 +45,6 @@ class PadArray: ...@@ -45,19 +45,6 @@ class PadArray:
def SetFirstPadInArray(self, fpNum): def SetFirstPadInArray(self, fpNum):
self.firstPad = fpNum self.firstPad = fpNum
# HACK! pad should one day have its own clone method
def ClonePad(self):
pad = pcbnew.D_PAD(self.pad.GetParent())
pad.SetSize(self.pad.GetSize())
pad.SetShape(self.pad.GetShape())
pad.SetAttribute(self.pad.GetAttribute())
pad.SetLayerMask(self.pad.GetLayerMask())
pad.SetDrillSize(self.pad.GetDrillSize())
return pad
def AddPad(self, pad): def AddPad(self, pad):
self.pad.GetParent().Add(pad) self.pad.GetParent().Add(pad)
...@@ -100,9 +87,8 @@ class PadGridArray(PadArray): ...@@ -100,9 +87,8 @@ class PadGridArray(PadArray):
pos = pcbnew.wxPoint(posX, posY) pos = pcbnew.wxPoint(posX, posY)
# THIS DOESN'T WORK yet! # create a new pad with same characteristics
#pad = self.pad.Clone() pad = self.pad.Duplicate()
pad = self.ClonePad()
pad.SetPos0(pos) pad.SetPos0(pos)
pad.SetPosition(pos) pad.SetPosition(pos)
......
...@@ -27,6 +27,7 @@ class QFPWizard(HelpfulFootprintWizardPlugin.HelpfulFootprintWizardPlugin): ...@@ -27,6 +27,7 @@ class QFPWizard(HelpfulFootprintWizardPlugin.HelpfulFootprintWizardPlugin):
def CheckParameters(self): def CheckParameters(self):
self.CheckParamPositiveInt("Pads", "*n", is_multiple_of = 4) self.CheckParamPositiveInt("Pads", "*n", is_multiple_of = 4)
self.CheckParamBool("Pads", "*oval")
def GetReference(self): def GetReference(self):
return "QFP %d" % self.parameters["Pads"]["*n"] return "QFP %d" % self.parameters["Pads"]["*n"]
...@@ -46,8 +47,10 @@ class QFPWizard(HelpfulFootprintWizardPlugin.HelpfulFootprintWizardPlugin): ...@@ -46,8 +47,10 @@ class QFPWizard(HelpfulFootprintWizardPlugin.HelpfulFootprintWizardPlugin):
row_len = (pads_per_row - 1) * pad_pitch row_len = (pads_per_row - 1) * pad_pitch
h_pad = PA.PadMaker(self.module).SMDPad(pad_width, pad_length, shape = pcbnew.PAD_OVAL) pad_shape = pcbnew.PAD_OVAL if pads["*oval"] else pcbnew.PAD_RECT
v_pad = PA.PadMaker(self.module).SMDPad(pad_length, pad_width, shape = pcbnew.PAD_OVAL)
h_pad = PA.PadMaker(self.module).SMDPad(pad_width, pad_length, shape = pad_shape)
v_pad = PA.PadMaker(self.module).SMDPad(pad_length, pad_width, shape = pad_shape)
#left row #left row
pin1Pos = pcbnew.wxPoint(-h_pitch / 2, -row_len / 2) pin1Pos = pcbnew.wxPoint(-h_pitch / 2, -row_len / 2)
......
...@@ -25,7 +25,7 @@ class TouchSliderWizard(FootprintWizardPlugin): ...@@ -25,7 +25,7 @@ class TouchSliderWizard(FootprintWizardPlugin):
pad.SetSize(size) pad.SetSize(size)
pad.SetShape(PAD_RECT) pad.SetShape(PAD_RECT)
pad.SetAttribute(PAD_SMD) pad.SetAttribute(PAD_SMD)
pad.SetLayerMask(PAD_SMD_DEFAULT_LAYERS) pad.SetLayerSet(pad.ConnSMDMask())
pad.SetPos0(pos) pad.SetPos0(pos)
pad.SetPosition(pos) pad.SetPosition(pos)
pad.SetPadName(name) pad.SetPadName(name)
...@@ -36,8 +36,8 @@ class TouchSliderWizard(FootprintWizardPlugin): ...@@ -36,8 +36,8 @@ class TouchSliderWizard(FootprintWizardPlugin):
pad = D_PAD(module) pad = D_PAD(module)
pad.SetSize(wxSize(size[0],size[1])) pad.SetSize(wxSize(size[0],size[1]))
pad.SetShape(PAD_TRAPEZOID) pad.SetShape(PAD_TRAPEZOID)
pad.SetAttribute(PAD_CONN) pad.SetAttribute(PAD_SMD)
pad.SetLayerMask(PAD_CONN_DEFAULT_LAYERS) pad.SetLayerSet(pad.ConnSMDMask())
pad.SetPos0(pos) pad.SetPos0(pos)
pad.SetPosition(pos) pad.SetPosition(pos)
pad.SetPadName(name) pad.SetPadName(name)
......
...@@ -66,7 +66,7 @@ ...@@ -66,7 +66,7 @@
#include <class_title_block.h> #include <class_title_block.h>
#include <class_colors_design_settings.h> #include <class_colors_design_settings.h>
#include <class_marker_base.h> #include <class_marker_base.h>
#include <eda_text.h> #include <eda_text.h>
#include <convert_from_iu.h> #include <convert_from_iu.h>
#include <convert_to_biu.h> #include <convert_to_biu.h>
......
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