Start unifying padstack properties

This commit is contained in:
Jon Evans 2024-04-07 18:01:08 -04:00
parent 0e58f1bad4
commit c800fb790d
35 changed files with 189 additions and 89 deletions

View File

@ -718,6 +718,7 @@ set( PCB_COMMON_SRCS
${CMAKE_SOURCE_DIR}/pcbnew/netinfo_item.cpp
${CMAKE_SOURCE_DIR}/pcbnew/netinfo_list.cpp
${CMAKE_SOURCE_DIR}/pcbnew/pad.cpp
${CMAKE_SOURCE_DIR}/pcbnew/padstack.cpp
${CMAKE_SOURCE_DIR}/pcbnew/pcb_target.cpp
${CMAKE_SOURCE_DIR}/pcbnew/pcb_reference_image.cpp
${CMAKE_SOURCE_DIR}/pcbnew/pcb_field.cpp

View File

@ -23,7 +23,7 @@
#include <api/board/board_types.pb.h>
#include <wx/wx.h>
#include <pad_shapes.h>
#include <padstack.h>
#include <zones.h>
using namespace kiapi::board;

View File

@ -1490,7 +1490,7 @@ void BOARD_DESIGN_SETTINGS::SetDefaultMasterPad()
{
m_Pad_Master.get()->SetSizeX( pcbIUScale.mmToIU( DEFAULT_PAD_WIDTH_MM ) );
m_Pad_Master.get()->SetSizeY( pcbIUScale.mmToIU( DEFAULT_PAD_HEIGTH_MM ) );
m_Pad_Master.get()->SetDrillShape( PAD_DRILL_SHAPE_CIRCLE );
m_Pad_Master.get()->SetDrillShape( PAD_DRILL_SHAPE::CIRCLE );
m_Pad_Master.get()->SetDrillSize(
VECTOR2I( pcbIUScale.mmToIU( DEFAULT_PAD_DRILL_DIAMETER_MM ), 0 ) );
m_Pad_Master.get()->SetShape( PAD_SHAPE::ROUNDRECT );

View File

@ -299,7 +299,7 @@ void DIALOG_BOARD_STATISTICS::getDataFromPCB()
}
DRILL_LINE_ITEM drill( via->GetDrillValue(), via->GetDrillValue(),
PAD_DRILL_SHAPE_CIRCLE, true, false, via->TopLayer(),
PAD_DRILL_SHAPE::CIRCLE, true, false, via->TopLayer(),
via->BottomLayer() );
auto it = m_drillTypes.begin();
@ -509,8 +509,8 @@ void DIALOG_BOARD_STATISTICS::updateDrillGrid()
switch( line.shape )
{
case PAD_DRILL_SHAPE_CIRCLE: shapeStr = _( "Round" ); break;
case PAD_DRILL_SHAPE_OBLONG: shapeStr = _( "Slot" ); break;
case PAD_DRILL_SHAPE::CIRCLE: shapeStr = _( "Round" ); break;
case PAD_DRILL_SHAPE::OBLONG: shapeStr = _( "Slot" ); break;
default: shapeStr = _( "???" ); break;
}

View File

@ -31,7 +31,7 @@
#include <footprint.h>
#include <pcb_track.h>
#include <dialog_board_statistics_base.h>
#include <pad_shapes.h>
#include <padstack.h>
#include <pcb_base_frame.h>
#include <pcb_edit_frame.h>
#include <project.h>
@ -97,7 +97,7 @@ public:
COL_STOP_LAYER
};
DRILL_LINE_ITEM( int aXSize, int aYSize, PAD_DRILL_SHAPE_T aShape, bool aIsPlated,
DRILL_LINE_ITEM( int aXSize, int aYSize, PAD_DRILL_SHAPE aShape, bool aIsPlated,
bool aIsPad, PCB_LAYER_ID aStartLayer, PCB_LAYER_ID aStopLayer ) :
xSize( aXSize ),
ySize( aYSize ),
@ -129,7 +129,8 @@ public:
case COL_COUNT:
return compareDrillParameters( aLeft.qty, aRight.qty );
case COL_SHAPE:
return compareDrillParameters( aLeft.shape, aRight.shape );
return compareDrillParameters( static_cast<int>( aLeft.shape ),
static_cast<int>( aRight.shape ) );
case COL_X_SIZE:
return compareDrillParameters( aLeft.xSize, aRight.xSize );
case COL_Y_SIZE:
@ -158,7 +159,7 @@ public:
int xSize;
int ySize;
PAD_DRILL_SHAPE_T shape;
PAD_DRILL_SHAPE shape;
bool isPlated;
bool isPad;
PCB_LAYER_ID startLayer;

View File

@ -151,7 +151,7 @@ void DIALOG_GENDRILL::InitDisplayParams()
{
for( PAD* pad : footprint->Pads() )
{
if( pad->GetDrillShape() == PAD_DRILL_SHAPE_CIRCLE )
if( pad->GetDrillShape() == PAD_DRILL_SHAPE::CIRCLE )
{
if( pad->GetDrillSize().x != 0 )
{

View File

@ -754,7 +754,7 @@ void DIALOG_PAD_PROPERTIES::initValues()
m_choiceFabProperty->Enable( false );
}
if( m_previewPad->GetDrillShape() != PAD_DRILL_SHAPE_OBLONG )
if( m_previewPad->GetDrillShape() != PAD_DRILL_SHAPE::OBLONG )
m_holeShapeCtrl->SetSelection( 0 );
else
m_holeShapeCtrl->SetSelection( 1 );
@ -1382,7 +1382,7 @@ bool DIALOG_PAD_PROPERTIES::padValuesOK()
case PAD_ATTRIB::NPTH: // Not plated, but through hole, a hole is expected
case PAD_ATTRIB::PTH: // Pad through hole, a hole is also expected
if( drill_size.x <= 0
|| ( drill_size.y <= 0 && m_previewPad->GetDrillShape() == PAD_DRILL_SHAPE_OBLONG ) )
|| ( drill_size.y <= 0 && m_previewPad->GetDrillShape() == PAD_DRILL_SHAPE::OBLONG ) )
{
error_msgs.Add( _( "Error: Through hole pad has no hole." ) );
}
@ -1833,12 +1833,12 @@ bool DIALOG_PAD_PROPERTIES::transferDataToPad( PAD* aPad )
if( m_holeShapeCtrl->GetSelection() == CHOICE_SHAPE_CIRCLE )
{
aPad->SetDrillShape( PAD_DRILL_SHAPE_CIRCLE );
aPad->SetDrillShape( PAD_DRILL_SHAPE::CIRCLE );
aPad->SetDrillSize( VECTOR2I( m_holeX.GetIntValue(), m_holeX.GetIntValue() ) );
}
else
{
aPad->SetDrillShape( PAD_DRILL_SHAPE_OBLONG );
aPad->SetDrillShape( PAD_DRILL_SHAPE::OBLONG );
aPad->SetDrillSize( VECTOR2I( m_holeX.GetIntValue(), m_holeY.GetIntValue() ) );
}

View File

@ -31,7 +31,7 @@
#include <wx/valnum.h>
#include <board.h>
#include <footprint.h>
#include <pad_shapes.h>
#include <padstack.h>
#include <pcb_shape.h>
#include <origin_viewitem.h>
#include <dialog_pad_properties_base.h>

View File

@ -346,7 +346,7 @@ static void idf_export_footprint( BOARD* aPcb, FOOTPRINT* aFootprint, IDF3_BOARD
if( tstr.empty() || !tstr.compare( "0" ) || !tstr.compare( "~" )
|| ( kplate == IDF3::NPTH )
|| ( pad->GetDrillShape() == PAD_DRILL_SHAPE_OBLONG ) )
|| ( pad->GetDrillShape() == PAD_DRILL_SHAPE::OBLONG ) )
pintype = "MTG";
else
pintype = "PIN";
@ -359,7 +359,7 @@ static void idf_export_footprint( BOARD* aPcb, FOOTPRINT* aFootprint, IDF3_BOARD
// 5. Assoc. part : BOARD | NOREFDES | PANEL | {"refdes"}
// 6. type : PIN | VIA | MTG | TOOL | { "other" }
// 7. owner : MCAD | ECAD | UNOWNED
if( ( pad->GetDrillShape() == PAD_DRILL_SHAPE_OBLONG )
if( ( pad->GetDrillShape() == PAD_DRILL_SHAPE::OBLONG )
&& ( pad->GetDrillSize().x != pad->GetDrillSize().y ) )
{
// NOTE: IDF does not have direct support for slots;

View File

@ -907,7 +907,7 @@ void EXPORTER_PCB_VRML::ExportVrmlPadHole( PAD* aPad )
if( ( aPad->GetAttribute() != PAD_ATTRIB::NPTH ) )
pth = true;
if( aPad->GetDrillShape() == PAD_DRILL_SHAPE_OBLONG )
if( aPad->GetDrillShape() == PAD_DRILL_SHAPE::OBLONG )
{
// Oblong hole (slot)

View File

@ -147,7 +147,7 @@ void GENDRILL_WRITER_BASE::buildHolesList( DRILL_LAYER_PAIR aLayerPair,
new_hole.m_Hole_Size.x = new_hole.m_Hole_Size.y = new_hole.m_Hole_Diameter;
// Convert oblong holes that are actually circular into drill hits
if( pad->GetDrillShape() != PAD_DRILL_SHAPE_CIRCLE &&
if( pad->GetDrillShape() != PAD_DRILL_SHAPE::CIRCLE &&
pad->GetDrillSizeX() != pad->GetDrillSizeY() )
{
new_hole.m_Hole_Shape = 1; // oval flag set

View File

@ -79,7 +79,7 @@ PAD::PAD( FOOTPRINT* parent ) :
SetShape( PAD_SHAPE::CIRCLE ); // Default pad shape is PAD_CIRCLE.
SetAnchorPadShape( PAD_SHAPE::CIRCLE ); // Default shape for custom shaped pads
// is PAD_CIRCLE.
SetDrillShape( PAD_DRILL_SHAPE_CIRCLE ); // Default pad drill shape is a circle.
SetDrillShape( PAD_DRILL_SHAPE::CIRCLE ); // Default pad drill shape is a circle.
m_attribute = PAD_ATTRIB::PTH; // Default pad type is plated through hole
SetProperty( PAD_PROP::NONE ); // no special fabrication property
@ -427,12 +427,12 @@ bool PAD::FlashLayer( int aLayer, bool aOnlyCheckIfPermitted ) const
if( GetAttribute() == PAD_ATTRIB::NPTH && IsCopperLayer( aLayer ) )
{
if( GetShape() == PAD_SHAPE::CIRCLE && GetDrillShape() == PAD_DRILL_SHAPE_CIRCLE )
if( GetShape() == PAD_SHAPE::CIRCLE && GetDrillShape() == PAD_DRILL_SHAPE::CIRCLE )
{
if( GetOffset() == VECTOR2I( 0, 0 ) && GetDrillSize().x >= GetSize().x )
return false;
}
else if( GetShape() == PAD_SHAPE::OVAL && GetDrillShape() == PAD_DRILL_SHAPE_OBLONG )
else if( GetShape() == PAD_SHAPE::OVAL && GetDrillShape() == PAD_DRILL_SHAPE::OBLONG )
{
if( GetOffset() == VECTOR2I( 0, 0 )
&& GetDrillSize().x >= GetSize().x && GetDrillSize().y >= GetSize().y )
@ -1264,7 +1264,7 @@ void PAD::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>&
if( m_drill.x > 0 || m_drill.y > 0 )
{
if( GetDrillShape() == PAD_DRILL_SHAPE_CIRCLE )
if( GetDrillShape() == PAD_DRILL_SHAPE::CIRCLE )
{
aList.emplace_back( _( "Hole" ),
wxString::Format( wxT( "%s" ),
@ -1362,7 +1362,8 @@ int PAD::Compare( const PAD* aPadRef, const PAD* aPadCmp )
static_cast<int>( aPadCmp->m_attribute ) ) != 0 )
return diff;
if( ( diff = aPadRef->m_drillShape - aPadCmp->m_drillShape ) != 0 )
if( ( diff = static_cast<int>( aPadRef->m_drillShape ) -
static_cast<int>( aPadCmp->m_drillShape ) ) != 0 )
return diff;
if( ( diff = aPadRef->m_drill.x - aPadCmp->m_drill.x ) != 0 )

View File

@ -31,7 +31,7 @@
#include <board_connected_item.h>
#include <geometry/shape_poly_set.h>
#include <geometry/shape_compound.h>
#include <pad_shapes.h>
#include <padstack.h>
#include <geometry/eda_angle.h>
#include <geometry/geometry_utils.h>
#include <core/arraydim.h>
@ -355,8 +355,8 @@ public:
return m_orient.AsDegrees();
}
void SetDrillShape( PAD_DRILL_SHAPE_T aShape ) { m_drillShape = aShape; m_shapesDirty = true; }
PAD_DRILL_SHAPE_T GetDrillShape() const { return m_drillShape; }
void SetDrillShape( PAD_DRILL_SHAPE aShape ) { m_drillShape = aShape; m_shapesDirty = true; }
PAD_DRILL_SHAPE GetDrillShape() const { return m_drillShape; }
bool IsDirty() const
{
@ -789,7 +789,7 @@ private:
VECTOR2I m_drill; // Drill diameter (x == y) or slot dimensions (x != y)
VECTOR2I m_size; // X and Y size (relative to orient 0)
PAD_DRILL_SHAPE_T m_drillShape; // PAD_DRILL_SHAPE_CIRCLE, PAD_DRILL_SHAPE_OBLONG
PAD_DRILL_SHAPE m_drillShape; // PAD_DRILL_SHAPE::CIRCLE, PAD_DRILL_SHAPE::OBLONG
double m_roundedCornerScale; // Scaling factor of min(width, height) to corner
// radius, default 0.25

43
pcbnew/padstack.cpp Normal file
View File

@ -0,0 +1,43 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2024 Jon Evans <jon@craftyjon.com>
* Copyright (C) 2024 KiCad Developers, see AUTHORS.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 as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version.
*
* 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.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "padstack.h"
PADSTACK::PADSTACK()
{
}
bool PADSTACK::Deserialize( const google::protobuf::Any& aContainer )
{
return false;
}
void PADSTACK::Serialize( google::protobuf::Any& aContainer ) const
{
}
wxString PADSTACK::Name() const
{
return wxEmptyString;
}

View File

@ -1,30 +1,33 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.TXT for contributors.
* Copyright (C) 2024 Jon Evans <jon@craftyjon.com>
* Copyright (C) 2024 KiCad Developers, see AUTHORS.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
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* 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.
*
* 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.
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef PAD_SHAPES_H_
#define PAD_SHAPES_H_
#ifndef KICAD_PADSTACK_H
#define KICAD_PADSTACK_H
#include <memory>
#include <optional>
#include <wx/string.h>
#include <api/serializable.h>
#include <zones.h>
#include <string>
/**
* The set of pad shapes, used with PAD::{Set,Get}Shape()
@ -45,17 +48,15 @@ enum class PAD_SHAPE : int
// (thick segments, circles, arcs, polygons).
};
/**
* The set of pad drill shapes, used with PAD::{Set,Get}DrillShape()
*/
enum PAD_DRILL_SHAPE_T
enum class PAD_DRILL_SHAPE
{
PAD_DRILL_SHAPE_CIRCLE,
PAD_DRILL_SHAPE_OBLONG,
CIRCLE,
OBLONG,
};
/**
* The set of pad shapes, used with PAD::{Set,Get}Attribute().
*
@ -91,4 +92,54 @@ enum class PAD_PROP
};
#endif // PAD_SHAPES_H_
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

View File

@ -3065,7 +3065,7 @@ void ALTIUM_PCB::ConvertPads6ToFootprintItemOnCopper( FOOTPRINT* aFootprint, con
if( !aElem.sizeAndShape || aElem.sizeAndShape->holeshape == ALTIUM_PAD_HOLE_SHAPE::ROUND )
{
pad->SetDrillShape( PAD_DRILL_SHAPE_T::PAD_DRILL_SHAPE_CIRCLE );
pad->SetDrillShape( PAD_DRILL_SHAPE::CIRCLE );
pad->SetDrillSize( VECTOR2I( aElem.holesize, aElem.holesize ) );
}
else
@ -3102,7 +3102,7 @@ void ALTIUM_PCB::ConvertPads6ToFootprintItemOnCopper( FOOTPRINT* aFootprint, con
}
}
pad->SetDrillShape( PAD_DRILL_SHAPE_T::PAD_DRILL_SHAPE_CIRCLE );
pad->SetDrillShape( PAD_DRILL_SHAPE::CIRCLE );
pad->SetDrillSize( VECTOR2I( aElem.holesize, aElem.holesize ) ); // Workaround
// TODO: elem.sizeAndShape->slotsize was 0 in testfile. Either use holesize in
// this case or rect holes have a different id
@ -3110,7 +3110,7 @@ void ALTIUM_PCB::ConvertPads6ToFootprintItemOnCopper( FOOTPRINT* aFootprint, con
case ALTIUM_PAD_HOLE_SHAPE::SLOT:
{
pad->SetDrillShape( PAD_DRILL_SHAPE_T::PAD_DRILL_SHAPE_OBLONG );
pad->SetDrillShape( PAD_DRILL_SHAPE::OBLONG );
EDA_ANGLE slotRotation( aElem.sizeAndShape->slotrotation, DEGREES_T );
slotRotation.Normalize();
@ -3187,7 +3187,7 @@ void ALTIUM_PCB::ConvertPads6ToFootprintItemOnCopper( FOOTPRINT* aFootprint, con
}
}
pad->SetDrillShape( PAD_DRILL_SHAPE_T::PAD_DRILL_SHAPE_CIRCLE );
pad->SetDrillShape( PAD_DRILL_SHAPE::CIRCLE );
pad->SetDrillSize( VECTOR2I( aElem.holesize, aElem.holesize ) ); // Workaround
break;
}
@ -3288,7 +3288,7 @@ void ALTIUM_PCB::ConvertPads6ToFootprintItemOnCopper( FOOTPRINT* aFootprint, con
if( pad->GetAttribute() == PAD_ATTRIB::NPTH && pad->HasHole() )
{
// KiCad likes NPTH pads to be the same size & shape as their holes
pad->SetShape( pad->GetDrillShape() == PAD_DRILL_SHAPE_CIRCLE ? PAD_SHAPE::CIRCLE
pad->SetShape( pad->GetDrillShape() == PAD_DRILL_SHAPE::CIRCLE ? PAD_SHAPE::CIRCLE
: PAD_SHAPE::OVAL );
pad->SetSize( pad->GetDrillSize() );
}

View File

@ -1238,14 +1238,14 @@ PAD* CADSTAR_PCB_ARCHIVE_LOADER::getKiCadPad( const COMPONENT_PAD& aCadstarPad,
{
if( csPadcode.SlotLength != UNDEFINED_VALUE )
{
pad->SetDrillShape( PAD_DRILL_SHAPE_T::PAD_DRILL_SHAPE_OBLONG );
pad->SetDrillShape( PAD_DRILL_SHAPE::OBLONG );
pad->SetDrillSize( { getKiCadLength( (long long) csPadcode.SlotLength +
(long long) csPadcode.DrillDiameter ),
getKiCadLength( csPadcode.DrillDiameter ) } );
}
else
{
pad->SetDrillShape( PAD_DRILL_SHAPE_T::PAD_DRILL_SHAPE_CIRCLE );
pad->SetDrillShape( PAD_DRILL_SHAPE::CIRCLE );
pad->SetDrillSize( { getKiCadLength( csPadcode.DrillDiameter ),
getKiCadLength( csPadcode.DrillDiameter ) } );
}

View File

@ -74,7 +74,7 @@ Load() TODO's
#include <pcb_track.h>
#include <pcb_shape.h>
#include <zone.h>
#include <pad_shapes.h>
#include <padstack.h>
#include <pcb_text.h>
#include <pcb_dimension.h>

View File

@ -852,7 +852,7 @@ void PCB_IO_EASYEDA_PARSER::ParseToBoardItemContainer(
pad->SetAttribute( PAD_ATTRIB::PTH );
pad->SetShape( PAD_SHAPE::CIRCLE );
pad->SetSize( VECTOR2I( kdia, kdia ) );
pad->SetDrillShape( PAD_DRILL_SHAPE_CIRCLE );
pad->SetDrillShape( PAD_DRILL_SHAPE::CIRCLE );
pad->SetDrillSize( VECTOR2I( kdrill, kdrill ) );
footprint->Add( pad.release(), ADD_MODE::APPEND );
@ -911,7 +911,7 @@ void PCB_IO_EASYEDA_PARSER::ParseToBoardItemContainer(
pad->SetAttribute( PAD_ATTRIB::NPTH );
pad->SetShape( PAD_SHAPE::CIRCLE );
pad->SetSize( VECTOR2I( kdia, kdia ) );
pad->SetDrillShape( PAD_DRILL_SHAPE_CIRCLE );
pad->SetDrillShape( PAD_DRILL_SHAPE::CIRCLE );
pad->SetDrillSize( VECTOR2I( kdia, kdia ) );
padContainer->Add( pad.release(), ADD_MODE::APPEND );
@ -1039,7 +1039,7 @@ void PCB_IO_EASYEDA_PARSER::ParseToBoardItemContainer(
if( holeL > 0 )
{
pad->SetDrillShape( PAD_DRILL_SHAPE_OBLONG );
pad->SetDrillShape( PAD_DRILL_SHAPE::OBLONG );
if( size.x < size.y )
pad->SetDrillSize( VECTOR2I( holeD, holeL ) );
@ -1048,7 +1048,7 @@ void PCB_IO_EASYEDA_PARSER::ParseToBoardItemContainer(
}
else
{
pad->SetDrillShape( PAD_DRILL_SHAPE_CIRCLE );
pad->SetDrillShape( PAD_DRILL_SHAPE::CIRCLE );
pad->SetDrillSize( VECTOR2I( holeD, holeD ) );
}
}

View File

@ -640,7 +640,7 @@ std::unique_ptr<PAD> PCB_IO_EASYEDAPRO_PARSER::createPAD( FOOTPRINT*
if( holeShape == wxS( "SLOT" ) )
{
pad->SetDrillShape( PAD_DRILL_SHAPE_OBLONG );
pad->SetDrillShape( PAD_DRILL_SHAPE::OBLONG );
}
pad->SetDrillSize( ScaleSize( drill ) );

View File

@ -43,7 +43,7 @@
#include <board_item.h>
#include <footprint.h>
#include <pad.h>
#include <pad_shapes.h>
#include <padstack.h>
#include <pcb_shape.h>
#include <pcb_text.h>
#include <pcb_track.h>
@ -2380,9 +2380,9 @@ bool FABMASTER::loadFootprints( BOARD* aBoard )
}
if( pad.drill_size_x == pad.drill_size_y )
newpad->SetDrillShape( PAD_DRILL_SHAPE_CIRCLE );
newpad->SetDrillShape( PAD_DRILL_SHAPE::CIRCLE );
else
newpad->SetDrillShape( PAD_DRILL_SHAPE_OBLONG );
newpad->SetDrillShape( PAD_DRILL_SHAPE::OBLONG );
newpad->SetDrillSize( VECTOR2I( pad.drill_size_x, pad.drill_size_y ) );
}

View File

@ -28,7 +28,7 @@
#include <eda_text.h>
#include <geometry/shape_arc.h>
#include <pad_shapes.h>
#include <padstack.h>
#include <deque>
#include <functional>

View File

@ -1449,7 +1449,7 @@ void PCB_IO_KICAD_LEGACY::loadPAD( FOOTPRINT* aFootprint )
BIU offs_x = biuParse( data, &data );
BIU offs_y = biuParse( data, &data );
PAD_DRILL_SHAPE_T drShape = PAD_DRILL_SHAPE_CIRCLE;
PAD_DRILL_SHAPE drShape = PAD_DRILL_SHAPE::CIRCLE;
data = strtok_r( (char*) data, delims, &saveptr );
@ -1457,7 +1457,7 @@ void PCB_IO_KICAD_LEGACY::loadPAD( FOOTPRINT* aFootprint )
{
if( data[0] == 'O' )
{
drShape = PAD_DRILL_SHAPE_OBLONG;
drShape = PAD_DRILL_SHAPE::OBLONG;
data = strtok_r( nullptr, delims, &saveptr );
drill_x = biuParse( data );

View File

@ -1522,7 +1522,7 @@ void PCB_IO_KICAD_SEXPR::format( const PAD* aPad, int aNestLevel ) const
{
m_out->Print( 0, " (drill" );
if( aPad->GetDrillShape() == PAD_DRILL_SHAPE_OBLONG )
if( aPad->GetDrillShape() == PAD_DRILL_SHAPE::OBLONG )
m_out->Print( 0, " oval" );
if( sz.x > 0 )

View File

@ -4840,7 +4840,7 @@ PAD* PCB_IO_KICAD_SEXPR_PARSER::parsePAD( FOOTPRINT* aParent )
switch( token )
{
case T_oval: pad->SetDrillShape( PAD_DRILL_SHAPE_OBLONG ); break;
case T_oval: pad->SetDrillShape( PAD_DRILL_SHAPE::OBLONG ); break;
case T_NUMBER:
{

View File

@ -209,7 +209,7 @@ void PCAD_PAD::AddToFootprint( FOOTPRINT* aFootprint, const EDA_ANGLE& aRotation
pad->SetShape( PAD_SHAPE::CIRCLE );
pad->SetAttribute( PAD_ATTRIB::NPTH );
pad->SetDrillShape( PAD_DRILL_SHAPE_CIRCLE );
pad->SetDrillShape( PAD_DRILL_SHAPE::CIRCLE );
pad->SetDrillSize( VECTOR2I( m_Hole, m_Hole ) );
pad->SetSize( VECTOR2I( m_Hole, m_Hole ) );
@ -291,7 +291,7 @@ void PCAD_PAD::AddToFootprint( FOOTPRINT* aFootprint, const EDA_ANGLE& aRotation
pad->SetDelta( VECTOR2I( 0, 0 ) );
pad->SetOrientation( m_Rotation + aRotation );
pad->SetDrillShape( PAD_DRILL_SHAPE_CIRCLE );
pad->SetDrillShape( PAD_DRILL_SHAPE::CIRCLE );
pad->SetOffset( VECTOR2I( 0, 0 ) );
pad->SetDrillSize( VECTOR2I( m_Hole, m_Hole ) );

View File

@ -514,7 +514,7 @@ int PCB_PAINTER::getLineThickness( int aActualThickness ) const
}
int PCB_PAINTER::getDrillShape( const PAD* aPad ) const
PAD_DRILL_SHAPE PCB_PAINTER::getDrillShape( const PAD* aPad ) const
{
return aPad->GetDrillShape();
}

View File

@ -30,6 +30,7 @@
#include <frame_type.h>
#include <gal/painter.h>
#include <padstack.h> // PAD_DRILL_SHAPE
#include <pcb_display_options.h>
#include <math/vector2d.h>
#include <memory>
@ -205,7 +206,7 @@ protected:
/**
* Return drill shape of a pad.
*/
virtual int getDrillShape( const PAD* aPad ) const;
virtual PAD_DRILL_SHAPE getDrillShape( const PAD* aPad ) const;
/**
* Return hole shape for a pad (internal units).

View File

@ -308,9 +308,9 @@ KIGFX::PCB_PRINT_PAINTER::PCB_PRINT_PAINTER( GAL* aGal ) :
{ }
int KIGFX::PCB_PRINT_PAINTER::getDrillShape( const PAD* aPad ) const
PAD_DRILL_SHAPE KIGFX::PCB_PRINT_PAINTER::getDrillShape( const PAD* aPad ) const
{
return m_drillMarkReal ? KIGFX::PCB_PAINTER::getDrillShape( aPad ) : PAD_DRILL_SHAPE_CIRCLE;
return m_drillMarkReal ? KIGFX::PCB_PAINTER::getDrillShape( aPad ) : PAD_DRILL_SHAPE::CIRCLE;
}

View File

@ -97,7 +97,7 @@ public:
}
protected:
int getDrillShape( const PAD* aPad ) const override;
PAD_DRILL_SHAPE getDrillShape( const PAD* aPad ) const override;
SHAPE_SEGMENT getPadHoleShape( const PAD* aPad ) const override;

View File

@ -24,7 +24,7 @@
#ifndef PCBPLOT_H_
#define PCBPLOT_H_
#include <pad_shapes.h> // for PAD_DRILL_SHAPE_T
#include <padstack.h> // for PAD_DRILL_SHAPE
#include <pcb_plot_params.h>
#include <settings/color_settings.h>
#include <settings/settings_manager.h>
@ -131,7 +131,7 @@ private:
*
* It compensate and clamp the drill mark size depending on the current plot options.
*/
void plotOneDrillMark( PAD_DRILL_SHAPE_T aDrillShape, const VECTOR2I& aDrillPos,
void plotOneDrillMark( PAD_DRILL_SHAPE aDrillShape, const VECTOR2I& aDrillPos,
const VECTOR2I& aDrillSize, const VECTOR2I& aPadSize,
const EDA_ANGLE& aOrientation, int aSmallDrill );

View File

@ -1014,21 +1014,21 @@ void BRDITEMS_PLOTTER::PlotTableBorders( const PCB_TABLE* aTable )
}
void BRDITEMS_PLOTTER::plotOneDrillMark( PAD_DRILL_SHAPE_T aDrillShape, const VECTOR2I& aDrillPos,
void BRDITEMS_PLOTTER::plotOneDrillMark( PAD_DRILL_SHAPE aDrillShape, const VECTOR2I& aDrillPos,
const VECTOR2I& aDrillSize, const VECTOR2I& aPadSize,
const EDA_ANGLE& aOrientation, int aSmallDrill )
{
VECTOR2I drillSize = aDrillSize;
// Small drill marks have no significance when applied to slots
if( aSmallDrill && aDrillShape == PAD_DRILL_SHAPE_CIRCLE )
if( aSmallDrill && aDrillShape == PAD_DRILL_SHAPE::CIRCLE )
drillSize.x = std::min( aSmallDrill, drillSize.x );
// Round holes only have x diameter, slots have both
drillSize.x -= getFineWidthAdj();
drillSize.x = Clamp( 1, drillSize.x, aPadSize.x - 1 );
if( aDrillShape == PAD_DRILL_SHAPE_OBLONG )
if( aDrillShape == PAD_DRILL_SHAPE::OBLONG )
{
drillSize.y -= getFineWidthAdj();
drillSize.y = Clamp( 1, drillSize.y, aPadSize.y - 1 );
@ -1073,7 +1073,7 @@ void BRDITEMS_PLOTTER::PlotDrillMarks()
if( ( via->GetLayerSet() & m_layerMask ).none() )
continue;
plotOneDrillMark( PAD_DRILL_SHAPE_CIRCLE, via->GetStart(),
plotOneDrillMark( PAD_DRILL_SHAPE::CIRCLE, via->GetStart(),
VECTOR2I( via->GetDrillValue(), 0 ), VECTOR2I( via->GetWidth(), 0 ),
ANGLE_0, smallDrill );
}

View File

@ -1,6 +1,6 @@
%rename(AddPrimitiveShape) PAD::AddPrimitive;
%include pad_shapes.h
%include padstack.h
%include pad.h
%rename(Get) operator PAD*;
@ -13,6 +13,8 @@ const int PAD_SHAPE_RECT = (const int)PAD_SHAPE::RECTANGLE;
%{
const int PAD_SHAPE_RECT = (const int)PAD_SHAPE::RECTANGLE;
const int PAD_DRILL_SHAPE_CIRCLE = (const int)PAD_DRILL_SHAPE::CIRCLE;
const int PAD_DRILL_SHAPE_OBLONG = (const int)PAD_DRILL_SHAPE::OBLONG;
%}
%extend PAD

View File

@ -591,7 +591,7 @@ int PAD_TOOL::PlacePad( const TOOL_EVENT& aEvent )
// Gives an acceptable drill size: it cannot be 0, but from pad master
// it is currently 0, therefore change it:
pad->SetDrillShape( PAD_DRILL_SHAPE_CIRCLE );
pad->SetDrillShape( PAD_DRILL_SHAPE::CIRCLE );
int hole_size = pad->GetSizeX() / 2;
pad->SetDrillSize( VECTOR2I( hole_size, hole_size ) );

View File

@ -33,7 +33,7 @@
#include <stroke_params.h>
// Board-specific
#include <pad_shapes.h>
#include <padstack.h>
#include <zones.h>
using namespace kiapi::common;