Pcbnew: add a new primitive pad shape: chamfered round rect pad.

Allows 0 to 4 chamfered corners, not only one.

A custom shape allow this kind of shape. However because it is a primitive,
it is easier to edit and it support thermal reliefs.
This commit is contained in:
jean-pierre charras
2019-03-11 10:26:15 +01:00
parent d25d62295a
commit d259459a14
27 changed files with 11700 additions and 9119 deletions
+19 -1
View File
@@ -7,7 +7,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2018 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
@@ -45,6 +45,7 @@
#include <class_drawsegment.h>
#include <class_pcb_target.h>
#include <class_dimension.h>
#include <convert_basic_shapes_to_polygon.h>
#include <pcbnew.h>
#include <pcbplot.h>
@@ -186,6 +187,23 @@ void BRDITEMS_PLOTTER::PlotPad( D_PAD* aPad, COLOR4D aColor, EDA_DRAW_MODE_T aPl
aPad->GetOrientation(), aPlotMode, &gbr_metadata );
break;
case PAD_SHAPE_CHAMFERED_RECT:
{
SHAPE_POLY_SET polygons;
const int segmentToCircleCount = 64;
const int corner_radius = aPad->GetRoundRectCornerRadius( aPad->GetSize() );
TransformRoundChamferedRectToPolygon( polygons, shape_pos, aPad->GetSize(),
aPad->GetOrientation(), corner_radius, aPad->GetChamferRectRatio(),
aPad->GetChamferPositions(), segmentToCircleCount );
if( polygons.OutlineCount() == 0 )
break;
int min_dim = std::min( aPad->GetSize().x, aPad->GetSize().y ) /2;
m_plotter->FlashPadCustom( shape_pos,wxSize( min_dim, min_dim ), &polygons, aPlotMode, &gbr_metadata );
}
break;
case PAD_SHAPE_CUSTOM:
{
SHAPE_POLY_SET polygons;