From 55a44f3cfc886e732b9c338f9046f34a581b5785 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Fri, 3 Jun 2016 09:05:25 +0200 Subject: [PATCH] Gerbview: rename a file with a better name. Add a test file to test aperture macros which include a negative object (currently incorrectly displayed by Gerbview) --- gerbview/CMakeLists.txt | 3 +- gerbview/class_aperture_macro.cpp | 2 +- ...rawlayers.cpp => clear_gbr_drawlayers.cpp} | 5 +- .../aperture_macro_with_negative_object.gbr | 70 +++++++++++++++++++ 4 files changed, 76 insertions(+), 4 deletions(-) rename gerbview/{init_gbr_drawlayers.cpp => clear_gbr_drawlayers.cpp} (93%) create mode 100644 gerbview/gerber_test_files/aperture_macro_with_negative_object.gbr diff --git a/gerbview/CMakeLists.txt b/gerbview/CMakeLists.txt index 8158de0f76..e919ac5e8c 100644 --- a/gerbview/CMakeLists.txt +++ b/gerbview/CMakeLists.txt @@ -34,6 +34,7 @@ set( GERBVIEW_SRCS class_gerbview_layer_widget.cpp class_gbr_layer_box_selector.cpp class_X2_gerber_attributes.cpp + clear_gbr_drawlayers.cpp controle.cpp dcode.cpp draw_gerber_screen.cpp @@ -44,7 +45,7 @@ set( GERBVIEW_SRCS gerbview_config.cpp gerbview_frame.cpp hotkeys.cpp - init_gbr_drawlayers.cpp + clear_gbr_drawlayers.cpp locate.cpp menubar.cpp onleftclick.cpp diff --git a/gerbview/class_aperture_macro.cpp b/gerbview/class_aperture_macro.cpp index 7ff3e2550b..e884d5c922 100644 --- a/gerbview/class_aperture_macro.cpp +++ b/gerbview/class_aperture_macro.cpp @@ -91,7 +91,7 @@ bool AM_PRIMITIVE::mapExposure( GERBER_DRAW_ITEM* aParent ) break; default: - case 1: // exposure always OON + case 1: // exposure always ON exposure = true; break; diff --git a/gerbview/init_gbr_drawlayers.cpp b/gerbview/clear_gbr_drawlayers.cpp similarity index 93% rename from gerbview/init_gbr_drawlayers.cpp rename to gerbview/clear_gbr_drawlayers.cpp index be33329f7e..139790ea47 100644 --- a/gerbview/init_gbr_drawlayers.cpp +++ b/gerbview/clear_gbr_drawlayers.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr - * Copyright (C) 1992-2013 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2016 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 @@ -23,7 +23,8 @@ */ /** - * @file init_gbr_drawlayers.cpp + * @file clear_gbr_drawlayers.cpp + * @brief erase a given or all draw layers, an free memory relative to the cleared layer(s) */ #include diff --git a/gerbview/gerber_test_files/aperture_macro_with_negative_object.gbr b/gerbview/gerber_test_files/aperture_macro_with_negative_object.gbr new file mode 100644 index 0000000000..bd430fba10 --- /dev/null +++ b/gerbview/gerber_test_files/aperture_macro_with_negative_object.gbr @@ -0,0 +1,70 @@ +%TF.GerberVersion,J4*% +%TF.Part,Single*% +%TF.FileFunction,Other,BugReportExample*% + +%FSLAX26Y26*% +%MOIN*% + +%LPD*% + +%SRX1Y1I0J0*% + + +G04 ===================================================* +G04 Aperture Macros* +G04 AMHALFCIRCLE draws a half circle by drawing a full circle and then +G04 a rectangular negative object overlapping the other half circle +G04 ===================================================* +%AMHALFCIRCLE* +1,1,1,0,0,0,0* +2,0,1,0,0,-.5,0,0*% + + + + +G04 ===================================================* +G04 Aperture Definitions* +G04 ===================================================* +%ADD10HALFCIRCLE*% +%ADD20HALFCIRCLE*% +%ADD30HALFCIRCLE*% + + + +G04 ===================================================* +G04 Program* +G04 ===================================================* + +G01* + +G04 ---------------------------------------------------* +G04 The following code should produce similar outputs. * +G04 That is, 2 half circles side by side. However, * +G04 only the flashes done with D10 are correct. With * +G04 the D20, the second aperture flash erases the first* +G04 which should not happen according to the gerber * +G04 file format specifications. The only difference * +G04 between the D10 and D20 flashes are the Y coords. * +G04 and the order of the flash statements. * +G04 Note: D30 shows one flash (one aperture macro). * +G04 * +G04 See section 4.12.2 of the Ucamco Gerber Format * +G04 Specification document for more details on aperture* +G04 macro exposure modifiers. * +G04 ---------------------------------------------------* + + +D10* +X500000Y2000000D03* +X0Y2000000D03* + + +D20* +X0Y0D03* +X500000Y0D03* + +D30* +X1500000Y1000000D03* + + +M02* \ No newline at end of file