Surprised this hasn't been in there until now! I used the IPC-2221a thickness (1 oz/ft^2 = 34.30 microns = ~1.3503 mils). The calculations match other calculators pretty closely.
Jon
From 22e7d80bc3da668b974ef7382cba8122c10f630f Mon Sep 17 00:00:00 2001 From: Jon Neal <[email protected]> Date: Tue, 5 Jan 2016 00:48:12 -0500 Subject: [PATCH] Add a new dropdown type that has oz/ft^2 for the pcb calculator. --- pcb_calculator/UnitSelector.cpp | 38 ++++++++++++++++++++-- pcb_calculator/UnitSelector.h | 17 +++++++++- .../dialogs/pcb_calculator_frame_base.cpp | 6 ++-- .../dialogs/pcb_calculator_frame_base.fbp | 4 +-- pcb_calculator/dialogs/pcb_calculator_frame_base.h | 7 ++-- pcb_calculator/units_scales.h | 3 +- 6 files changed, 63 insertions(+), 12 deletions(-) diff --git a/pcb_calculator/UnitSelector.cpp b/pcb_calculator/UnitSelector.cpp index ddf26ae..06b3768 100644 --- a/pcb_calculator/UnitSelector.cpp +++ b/pcb_calculator/UnitSelector.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2011-2014 Jean-Pierre Charras - * Copyright (C) 2004-2014 KiCad Developers, see change_log.txt for contributors. + * Copyright (C) 2004-2016 KiCad Developers, see change_log.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -46,7 +46,7 @@ UNIT_SELECTOR_LEN::UNIT_SELECTOR_LEN( wxWindow *parent, wxWindowID id, /* * Function GetUnitScale * return the scaling factor to convert users units - * to normalized units (meter ) + * to normalized units (meter) */ double UNIT_SELECTOR_LEN::GetUnitScale() { @@ -62,6 +62,40 @@ double UNIT_SELECTOR_LEN::GetUnitScale() } +UNIT_SELECTOR_THICKNESS::UNIT_SELECTOR_THICKNESS( wxWindow *parent, wxWindowID id, + const wxPoint& pos, const wxSize& size, + const wxArrayString& choices, long style ) + : UNIT_SELECTOR( parent, id, pos, size, choices, style ) +{ + Append( _( "mm" ) ); + Append( _( "um" ) ); + Append( _( "cm" ) ); + Append( _( "mil" ) ); + Append( _( "inch" ) ); + Append( _( "oz/ft^2" ) ); +}; + + +/* + * Function GetUnitScale + * return the scaling factor to convert users units + * to normalized units (meter) including copper oz/ft^2 + */ +double UNIT_SELECTOR_THICKNESS::GetUnitScale() +{ + switch( GetCurrentSelection() ) + { + case 0: return UNIT_MM; break; + case 1: return UNIT_MICRON; break; + case 2: return UNIT_CM; break; + case 3: return UNIT_MIL; break; + case 4: return UNIT_INCH; break; + case 5: return UNIT_OZSQFT; break; + } + return 1.0; +} + + UNIT_SELECTOR_FREQUENCY::UNIT_SELECTOR_FREQUENCY( wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, const wxArrayString& choices, long style ): diff --git a/pcb_calculator/UnitSelector.h b/pcb_calculator/UnitSelector.h index e8ea45d..d5adea0 100644 --- a/pcb_calculator/UnitSelector.h +++ b/pcb_calculator/UnitSelector.h @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2011-2014 Jean-Pierre Charras - * Copyright (C) 2004-2014 KiCad Developers, see change_log.txt for contributors. + * Copyright (C) 2004-2016 KiCad Developers, see change_log.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -73,6 +73,21 @@ public: virtual double GetUnitScale(); }; +class UNIT_SELECTOR_THICKNESS: public UNIT_SELECTOR +{ +public: + UNIT_SELECTOR_THICKNESS( wxWindow *parent, wxWindowID id, + const wxPoint& pos, const wxSize& size, + const wxArrayString& choices, long style = 0 ); + + /** + * Function GetUnitScale + * @return the scaling factor to convert users units + * to normalized units (meter) including oz/ft^2 + */ + virtual double GetUnitScale(); +}; + class UNIT_SELECTOR_FREQUENCY: public UNIT_SELECTOR { public: diff --git a/pcb_calculator/dialogs/pcb_calculator_frame_base.cpp b/pcb_calculator/dialogs/pcb_calculator_frame_base.cpp index 5ba848f..59c7e95 100644 --- a/pcb_calculator/dialogs/pcb_calculator_frame_base.cpp +++ b/pcb_calculator/dialogs/pcb_calculator_frame_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Jun 17 2015) +// C++ code generated with wxFormBuilder (version Aug 23 2015) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -362,7 +362,7 @@ PCB_CALCULATOR_FRAME_BASE::PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindow fgSizerTW_Results->Add( m_ExtTrackThicknessValue, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 5 ); wxArrayString m_ExtTrackThicknessUnitChoices; - m_ExtTrackThicknessUnit = new UNIT_SELECTOR_LEN( sbSizerTW_Result->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_ExtTrackThicknessUnitChoices, 0 ); + m_ExtTrackThicknessUnit = new UNIT_SELECTOR_THICKNESS( sbSizerTW_Result->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_ExtTrackThicknessUnitChoices, 0 ); m_ExtTrackThicknessUnit->SetSelection( 0 ); fgSizerTW_Results->Add( m_ExtTrackThicknessUnit, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 5 ); @@ -451,7 +451,7 @@ PCB_CALCULATOR_FRAME_BASE::PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindow fgSizerTW_Results1->Add( m_IntTrackThicknessValue, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 5 ); wxArrayString m_IntTrackThicknessUnitChoices; - m_IntTrackThicknessUnit = new UNIT_SELECTOR_LEN( sbSizerTW_Result1->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_IntTrackThicknessUnitChoices, 0 ); + m_IntTrackThicknessUnit = new UNIT_SELECTOR_THICKNESS( sbSizerTW_Result1->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_IntTrackThicknessUnitChoices, 0 ); m_IntTrackThicknessUnit->SetSelection( 0 ); fgSizerTW_Results1->Add( m_IntTrackThicknessUnit, 0, wxALL, 5 ); diff --git a/pcb_calculator/dialogs/pcb_calculator_frame_base.fbp b/pcb_calculator/dialogs/pcb_calculator_frame_base.fbp index 3cf27fd..8ddf2f2 100644 --- a/pcb_calculator/dialogs/pcb_calculator_frame_base.fbp +++ b/pcb_calculator/dialogs/pcb_calculator_frame_base.fbp @@ -5032,7 +5032,7 @@ <property name="show">1</property> <property name="size"></property> <property name="style"></property> - <property name="subclass">UNIT_SELECTOR_LEN; UnitSelector.h</property> + <property name="subclass">UNIT_SELECTOR_THICKNESS; UnitSelector.h</property> <property name="toolbar_pane">0</property> <property name="tooltip"></property> <property name="validator_data_type"></property> @@ -6584,7 +6584,7 @@ <property name="show">1</property> <property name="size"></property> <property name="style"></property> - <property name="subclass">UNIT_SELECTOR_LEN; UnitSelector.h</property> + <property name="subclass">UNIT_SELECTOR_THICKNESS; UnitSelector.h</property> <property name="toolbar_pane">0</property> <property name="tooltip"></property> <property name="validator_data_type"></property> diff --git a/pcb_calculator/dialogs/pcb_calculator_frame_base.h b/pcb_calculator/dialogs/pcb_calculator_frame_base.h index ff718f4..7152c44 100644 --- a/pcb_calculator/dialogs/pcb_calculator_frame_base.h +++ b/pcb_calculator/dialogs/pcb_calculator_frame_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Jun 17 2015) +// C++ code generated with wxFormBuilder (version Aug 23 2015) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -16,6 +16,7 @@ class UNIT_SELECTOR_ANGLE; class UNIT_SELECTOR_FREQUENCY; class UNIT_SELECTOR_LEN; class UNIT_SELECTOR_RESISTOR; +class UNIT_SELECTOR_THICKNESS; #include "kiway_player.h" #include <wx/string.h> @@ -110,7 +111,7 @@ class PCB_CALCULATOR_FRAME_BASE : public KIWAY_PLAYER UNIT_SELECTOR_LEN* m_TW_ExtTrackWidth_choiceUnit; wxStaticText* m_staticText65; wxTextCtrl* m_ExtTrackThicknessValue; - UNIT_SELECTOR_LEN* m_ExtTrackThicknessUnit; + UNIT_SELECTOR_THICKNESS* m_ExtTrackThicknessUnit; wxStaticText* m_staticTextArea; wxStaticText* m_ExtTrackAreaValue; wxStaticText* m_ExtTrackAreaUnitLabel; @@ -128,7 +129,7 @@ class PCB_CALCULATOR_FRAME_BASE : public KIWAY_PLAYER UNIT_SELECTOR_LEN* m_TW_IntTrackWidth_choiceUnit; wxStaticText* m_staticText652; wxTextCtrl* m_IntTrackThicknessValue; - UNIT_SELECTOR_LEN* m_IntTrackThicknessUnit; + UNIT_SELECTOR_THICKNESS* m_IntTrackThicknessUnit; wxStaticText* m_staticTextArea1; wxStaticText* m_IntTrackAreaValue; wxStaticText* m_IntTrackAreaUnitLabel; diff --git a/pcb_calculator/units_scales.h b/pcb_calculator/units_scales.h index f694a83..72b63a1 100644 --- a/pcb_calculator/units_scales.h +++ b/pcb_calculator/units_scales.h @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2011-2014 Jean-Pierre Charras - * Copyright (C) 2004-2014 KiCad Developers, see change_log.txt for contributors. + * Copyright (C) 2004-2016 KiCad Developers, see change_log.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -37,6 +37,7 @@ #define UNIT_MICRON 1e-6 // um to meter #define UNIT_INCH (1e-2*2.54) // inch to meter #define UNIT_MIL (1e-5*2.54) // mil (or thou) to meter +#define UNIT_OZSQFT (1.3503*UNIT_MIL) // 1 oz/ft^2 is 1.378 mils #define UNIT_GHZ 1e9 #define UNIT_MHZ 1e6 -- 2.5.0
_______________________________________________ Mailing list: https://launchpad.net/~kicad-developers Post to : [email protected] Unsubscribe : https://launchpad.net/~kicad-developers More help : https://help.launchpad.net/ListHelp

