2016-01-12 11:33:33 -05:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2024-04-07 18:01:08 -04:00
|
|
|
* Copyright (C) 2024 Jon Evans <jon@craftyjon.com>
|
|
|
|
* Copyright (C) 2024 KiCad Developers, see AUTHORS.txt for contributors.
|
2016-01-12 11:33:33 -05:00
|
|
|
*
|
2024-04-07 18:01:08 -04:00
|
|
|
* This program is free software: you can redistribute it and/or modify it
|
|
|
|
* under the terms of the GNU General Public License as published by the
|
|
|
|
* Free Software Foundation, either version 3 of the License, or (at your
|
|
|
|
* option) any later version.
|
2016-01-12 11:33:33 -05:00
|
|
|
*
|
2024-04-07 18:01:08 -04:00
|
|
|
* This program is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* General Public License for more details.
|
2016-01-12 11:33:33 -05:00
|
|
|
*
|
2024-04-07 18:01:08 -04:00
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
2016-01-12 11:33:33 -05:00
|
|
|
*/
|
2008-01-05 17:20:13 +00:00
|
|
|
|
2024-04-07 18:01:08 -04:00
|
|
|
#ifndef KICAD_PADSTACK_H
|
|
|
|
#define KICAD_PADSTACK_H
|
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
#include <optional>
|
|
|
|
#include <wx/string.h>
|
|
|
|
|
|
|
|
#include <api/serializable.h>
|
|
|
|
#include <zones.h>
|
2008-01-05 17:20:13 +00:00
|
|
|
|
2020-07-01 15:40:15 -07:00
|
|
|
|
2012-02-18 22:02:19 -06:00
|
|
|
/**
|
2020-12-19 18:29:10 -05:00
|
|
|
* The set of pad shapes, used with PAD::{Set,Get}Shape()
|
2022-04-24 23:54:01 +01:00
|
|
|
*
|
2023-12-24 01:21:58 +00:00
|
|
|
* --> DO NOT REORDER, PCB_IO_KICAD_LEGACY is dependent on the integer values <--
|
2012-02-18 22:02:19 -06:00
|
|
|
*/
|
2021-05-01 08:22:35 -04:00
|
|
|
enum class PAD_SHAPE : int
|
2012-02-18 22:02:19 -06:00
|
|
|
{
|
2021-05-01 08:22:35 -04:00
|
|
|
CIRCLE,
|
2023-06-02 11:10:48 +02:00
|
|
|
RECTANGLE, // do not use just RECT: it collides in a header on MSYS2
|
2021-05-01 08:22:35 -04:00
|
|
|
OVAL,
|
|
|
|
TRAPEZOID,
|
|
|
|
ROUNDRECT,
|
2020-12-19 18:29:10 -05:00
|
|
|
|
|
|
|
// Rectangle with a chamfered corner ( and with rounded other corners).
|
2021-05-01 08:22:35 -04:00
|
|
|
CHAMFERED_RECT,
|
|
|
|
CUSTOM // A shape defined by user, using a set of basic shapes
|
2022-04-24 23:54:01 +01:00
|
|
|
// (thick segments, circles, arcs, polygons).
|
2014-01-26 15:20:58 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
2020-12-19 18:29:10 -05:00
|
|
|
* The set of pad drill shapes, used with PAD::{Set,Get}DrillShape()
|
2014-01-26 15:20:58 +01:00
|
|
|
*/
|
2024-04-07 18:01:08 -04:00
|
|
|
enum class PAD_DRILL_SHAPE
|
2014-01-26 15:20:58 +01:00
|
|
|
{
|
2024-04-07 18:01:08 -04:00
|
|
|
CIRCLE,
|
|
|
|
OBLONG,
|
2012-02-18 22:02:19 -06:00
|
|
|
};
|
2008-01-05 17:20:13 +00:00
|
|
|
|
2012-02-18 22:02:19 -06:00
|
|
|
/**
|
2020-12-19 18:29:10 -05:00
|
|
|
* The set of pad shapes, used with PAD::{Set,Get}Attribute().
|
|
|
|
*
|
2015-07-28 15:05:47 +02:00
|
|
|
* The double name is for convenience of Python devs
|
2012-02-18 22:02:19 -06:00
|
|
|
*/
|
2021-05-01 10:46:50 -04:00
|
|
|
enum class PAD_ATTRIB
|
2012-02-18 22:02:19 -06:00
|
|
|
{
|
2024-01-26 13:56:52 +00:00
|
|
|
PTH, ///< Plated through hole pad
|
|
|
|
SMD, ///< Smd pad, appears on the solder paste layer (default)
|
|
|
|
CONN, ///< Like smd, does not appear on the solder paste layer (default)
|
|
|
|
///< Note: also has a special attribute in Gerber X files
|
|
|
|
///< Used for edgecard connectors for instance
|
|
|
|
NPTH, ///< like PAD_PTH, but not plated
|
|
|
|
///< mechanical use only, no connection allowed
|
2012-02-18 22:02:19 -06:00
|
|
|
};
|
2008-01-05 17:20:13 +00:00
|
|
|
|
|
|
|
|
2019-12-11 11:36:45 +01:00
|
|
|
/**
|
2022-04-24 23:54:01 +01:00
|
|
|
* The set of pad properties used in Gerber files (Draw files, and P&P files)
|
2024-03-04 13:42:57 -08:00
|
|
|
* to define some properties in fabrication or test files. Also used by
|
|
|
|
* DRC to check some properties.
|
2019-12-11 11:36:45 +01:00
|
|
|
*/
|
2021-05-01 10:58:30 -04:00
|
|
|
enum class PAD_PROP
|
2019-12-11 11:36:45 +01:00
|
|
|
{
|
2021-05-01 10:58:30 -04:00
|
|
|
NONE, ///< no special fabrication property
|
|
|
|
BGA, ///< Smd pad, used in BGA footprints
|
|
|
|
FIDUCIAL_GLBL, ///< a fiducial (usually a smd) for the full board
|
|
|
|
FIDUCIAL_LOCAL, ///< a fiducial (usually a smd) local to the parent footprint
|
|
|
|
TESTPOINT, ///< a test point pad
|
|
|
|
HEATSINK, ///< a pad used as heat sink, usually in SMD footprints
|
2024-03-04 13:42:57 -08:00
|
|
|
CASTELLATED, ///< a pad with a castellated through hole
|
|
|
|
MECHANICAL, ///< a pad used for mechanical support
|
2019-12-11 11:36:45 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2024-04-07 18:01:08 -04:00
|
|
|
class PADSTACK : public SERIALIZABLE
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
///! Padstack type, mostly for IPC-7351 naming and attributes
|
|
|
|
///! Note that TYPE::MOUNTING is probably not currently supported by KiCad
|
|
|
|
enum class TYPE
|
|
|
|
{
|
|
|
|
NORMAL, ///< Padstack for a footprint pad
|
|
|
|
VIA, ///< Padstack for a via
|
|
|
|
MOUNTING ///< A mounting hole (plated or unplated, not associated with a footprint)
|
|
|
|
};
|
|
|
|
|
|
|
|
enum class MODE
|
|
|
|
{
|
|
|
|
NORMAL, ///< Shape is the same on all layers
|
|
|
|
TOP_INNER_BOTTOM, ///< Up to three shapes can be defined (top, inner, bottom)
|
|
|
|
CUSTOM ///< Shapes can be defined on arbitrary layers
|
|
|
|
};
|
|
|
|
|
|
|
|
struct OUTER_LAYER_PROPS
|
|
|
|
{
|
|
|
|
std::optional<int> solder_mask_margin;
|
|
|
|
std::optional<int> solder_paste_margin;
|
|
|
|
std::optional<double> solder_paste_margin_ratio;
|
|
|
|
ZONE_CONNECTION zone_connection;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct INNER_LAYER_PROPS
|
|
|
|
{
|
|
|
|
ZONE_CONNECTION zone_connection;
|
|
|
|
};
|
|
|
|
|
|
|
|
public:
|
|
|
|
PADSTACK();
|
|
|
|
|
|
|
|
virtual ~PADSTACK() = default;
|
|
|
|
|
|
|
|
void Serialize( google::protobuf::Any &aContainer ) const override;
|
|
|
|
bool Deserialize( const google::protobuf::Any &aContainer ) override;
|
|
|
|
|
|
|
|
///! Returns the name of this padstack in IPC-7351 format
|
|
|
|
wxString Name() const;
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
///! An override for the IPC-7351 padstack name
|
|
|
|
wxString m_customName;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif //KICAD_PADSTACK_H
|