From f0860386847a6c226527ffea97ab956a1d069782 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Wed, 28 Feb 2024 17:30:55 +0100 Subject: [PATCH] GERBER_PLOTTER, round-rect aperture: ensure primitives have non null size. for round-rect pads with a radius = 50% of the smaller dim, one of primitives used to create the shape can have a 0 size. Ensure a min size >= 10 nm (It should not create a actual change) --- common/plotters/GERBER_plotter.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/common/plotters/GERBER_plotter.cpp b/common/plotters/GERBER_plotter.cpp index 0c47d88f6f..9efdbb1cfb 100644 --- a/common/plotters/GERBER_plotter.cpp +++ b/common/plotters/GERBER_plotter.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2019 Jean-Pierre Charras, jp.charras at wanadoo.fr - * Copyright (C) 2022-2023 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2022-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 @@ -647,6 +647,16 @@ void GERBER_PLOTTER::writeApertureList() std::vector corners; VECTOR2I half_size( tool.m_Size.x/2-tool.m_Radius, tool.m_Size.y/2-tool.m_Radius ); + // Ensure half_size.x and half_size.y > minimal value to avoid shapes + // with null size (especially the rectangle with coordinates corners) + // Because the minimal value for a non nul Gerber coord in 10nm + // in format 4.5, use 10 nm as minimal value. + // (Even in 4.6 format, use 10 nm, because gerber viewers can have + // a internal unit bigger than 1 nm) + const int min_size_value = 10; + half_size.x = std::max( half_size.x, min_size_value ); + half_size.y = std::max( half_size.y, min_size_value ); + corners.emplace_back( -half_size.x, -half_size.y ); corners.emplace_back( half_size.x, -half_size.y ); corners.emplace_back( half_size.x, half_size.y );