From 3b1cf729beb16028422622aac6ba6a872946ad61 Mon Sep 17 00:00:00 2001 From: Hamilton Kibbe Date: Fri, 18 Nov 2016 07:43:02 -0500 Subject: Add script to render gerbv test files --- examples/gerbv_test_files/include-file-1.gbx | 7 +++ .../gerbv_test_files/test-aperture-circle-1.gbx | 38 ++++++++++++ .../test-aperture-circle-flash-1.gbx | 27 +++++++++ .../gerbv_test_files/test-aperture-obround-1.gbx | 38 ++++++++++++ .../test-aperture-obround-flash-1.gbx | 27 +++++++++ .../gerbv_test_files/test-aperture-polygon-1.gbx | 38 ++++++++++++ .../test-aperture-polygon-flash-1.gbx | 27 +++++++++ .../gerbv_test_files/test-aperture-rectangle-1.gbx | 38 ++++++++++++ .../test-aperture-rectangle-flash-1.gbx | 27 +++++++++ .../test-circular-interpolation-1.gbx | 35 +++++++++++ .../gerbv_test_files/test-drill-leading-zero-1.exc | 8 +++ examples/gerbv_test_files/test-drill-repeat-1.exc | 19 ++++++ .../test-drill-trailing-zero-1.exc | 8 +++ examples/gerbv_test_files/test-image-justify-1.gbx | 19 ++++++ examples/gerbv_test_files/test-image-justify-2.gbx | 19 ++++++ examples/gerbv_test_files/test-image-offset-1.gbx | 18 ++++++ examples/gerbv_test_files/test-image-offset-2.gbx | 19 ++++++ .../gerbv_test_files/test-image-polarity-1.gbx | 17 ++++++ .../gerbv_test_files/test-image-rotation-1.gbx | 21 +++++++ examples/gerbv_test_files/test-include-file-1.gbx | 11 ++++ .../gerbv_test_files/test-layer-axis-select-1.gbx | 15 +++++ .../gerbv_test_files/test-layer-knockout-1.gbx | 28 +++++++++ .../gerbv_test_files/test-layer-knockout-2.gbx | 28 +++++++++ .../gerbv_test_files/test-layer-mirror-image-1.gbx | 23 ++++++++ examples/gerbv_test_files/test-layer-mode-1.gbx | 68 ++++++++++++++++++++++ examples/gerbv_test_files/test-layer-offset-1.gbx | 18 ++++++ .../gerbv_test_files/test-layer-rotation-1.gbx | 23 ++++++++ .../gerbv_test_files/test-layer-scale-factor-1.gbx | 17 ++++++ .../test-layer-step-and_repeat-1.gbx | 17 ++++++ .../test-layer-step-and_repeat-2.gbx | 18 ++++++ examples/gerbv_test_files/test-polygon-fill-1.gbx | 45 ++++++++++++++ examples/render_gerbv_tests.py | 59 +++++++++++++++++++ 32 files changed, 820 insertions(+) create mode 100755 examples/gerbv_test_files/include-file-1.gbx create mode 100755 examples/gerbv_test_files/test-aperture-circle-1.gbx create mode 100755 examples/gerbv_test_files/test-aperture-circle-flash-1.gbx create mode 100755 examples/gerbv_test_files/test-aperture-obround-1.gbx create mode 100755 examples/gerbv_test_files/test-aperture-obround-flash-1.gbx create mode 100755 examples/gerbv_test_files/test-aperture-polygon-1.gbx create mode 100755 examples/gerbv_test_files/test-aperture-polygon-flash-1.gbx create mode 100755 examples/gerbv_test_files/test-aperture-rectangle-1.gbx create mode 100755 examples/gerbv_test_files/test-aperture-rectangle-flash-1.gbx create mode 100755 examples/gerbv_test_files/test-circular-interpolation-1.gbx create mode 100755 examples/gerbv_test_files/test-drill-leading-zero-1.exc create mode 100755 examples/gerbv_test_files/test-drill-repeat-1.exc create mode 100755 examples/gerbv_test_files/test-drill-trailing-zero-1.exc create mode 100755 examples/gerbv_test_files/test-image-justify-1.gbx create mode 100755 examples/gerbv_test_files/test-image-justify-2.gbx create mode 100755 examples/gerbv_test_files/test-image-offset-1.gbx create mode 100755 examples/gerbv_test_files/test-image-offset-2.gbx create mode 100755 examples/gerbv_test_files/test-image-polarity-1.gbx create mode 100755 examples/gerbv_test_files/test-image-rotation-1.gbx create mode 100755 examples/gerbv_test_files/test-include-file-1.gbx create mode 100755 examples/gerbv_test_files/test-layer-axis-select-1.gbx create mode 100755 examples/gerbv_test_files/test-layer-knockout-1.gbx create mode 100755 examples/gerbv_test_files/test-layer-knockout-2.gbx create mode 100755 examples/gerbv_test_files/test-layer-mirror-image-1.gbx create mode 100755 examples/gerbv_test_files/test-layer-mode-1.gbx create mode 100755 examples/gerbv_test_files/test-layer-offset-1.gbx create mode 100755 examples/gerbv_test_files/test-layer-rotation-1.gbx create mode 100755 examples/gerbv_test_files/test-layer-scale-factor-1.gbx create mode 100755 examples/gerbv_test_files/test-layer-step-and_repeat-1.gbx create mode 100755 examples/gerbv_test_files/test-layer-step-and_repeat-2.gbx create mode 100755 examples/gerbv_test_files/test-polygon-fill-1.gbx create mode 100755 examples/render_gerbv_tests.py (limited to 'examples') diff --git a/examples/gerbv_test_files/include-file-1.gbx b/examples/gerbv_test_files/include-file-1.gbx new file mode 100755 index 0000000..75b5325 --- /dev/null +++ b/examples/gerbv_test_files/include-file-1.gbx @@ -0,0 +1,7 @@ +X-1000Y0D02* +G54D10* +X1000Y0D01* +X0Y-1000D02* +G54D10* +X0Y1000D01* + diff --git a/examples/gerbv_test_files/test-aperture-circle-1.gbx b/examples/gerbv_test_files/test-aperture-circle-1.gbx new file mode 100755 index 0000000..ab56aae --- /dev/null +++ b/examples/gerbv_test_files/test-aperture-circle-1.gbx @@ -0,0 +1,38 @@ +G04 Test drawing with circular apertures* +G04 Hand coded by Julian Lamb * +%MOIN*% +%FSLAX23Y23*% +%ADD10C,0.050*% +G04 Note: aperture 11 has a round hole in it, but this shouldn't ever show when* +G04 drawing with it (only should show in flashes)* +%ADD11C,0.075X0.050*% + +G04 No hole, centered at 0,0 * +G54D10* +G04 Recenter to 0,0 +G01X0Y0D02* +G04 Draw a line segment* +X00100Y0D01* +G04 Turn off for a segment* +X00200Y0D02* +G04 Draw another line at angle* +G54D11* +X00300Y00100D01* +G04 Turn off for a segment* +X0Y00100D02* +G54D10* +G04 Turn on circular interpolation* +G75* +G03X0Y00300I0J00100D01* + +G04 Turn off for a segment* +X00500Y00D02* +G04 Draw a larger radius arc* +G03X00350Y00150I-00250J-00050D01* + +G04 Turn off for a segment* +X00250Y00200D02* +G04 Draw a larger clockwise radius arc* +G02X00350Y00350I00250J-00050D01* + +M02* diff --git a/examples/gerbv_test_files/test-aperture-circle-flash-1.gbx b/examples/gerbv_test_files/test-aperture-circle-flash-1.gbx new file mode 100755 index 0000000..91c4bfc --- /dev/null +++ b/examples/gerbv_test_files/test-aperture-circle-flash-1.gbx @@ -0,0 +1,27 @@ +G04 Test flashing of circular apertures* +G04 Four groups of circular apertures are arranged in a square* +G04 Handcoded by Julian Lamb * +%MOIN*% +%FSLAX23Y23*% +%ADD10C,0.050*% +%ADD11C,0.050X0.025*% +%ADD12C,0.050X0.025X0.030*% + +G04 No hole, centered at 0,0 * +G54D10* +X0Y0D03* + +G04 Round hole, centered at 0.1,0 * +G54D11* +X00100Y0D03* + +G04 Square hole, centered at 0,0.1 * +G54D12* +X0Y00100D03* + +G04 Two, with round holes, slightly overlapping, centered at 0.1,0.1 * +G54D11* +X00100Y00090D03* +X00100Y00110D03* + +M02* diff --git a/examples/gerbv_test_files/test-aperture-obround-1.gbx b/examples/gerbv_test_files/test-aperture-obround-1.gbx new file mode 100755 index 0000000..763232b --- /dev/null +++ b/examples/gerbv_test_files/test-aperture-obround-1.gbx @@ -0,0 +1,38 @@ +G04 Test drawing with rectangular apertures* +G04 Hand coded by Julian Lamb * +%MOIN*% +%FSLAX23Y23*% +%ADD10O,0.050X0.025*% +G04 Note: aperture 11 has a round hole in it, but this shouldn't ever show when* +G04 drawing with it (only should show in flashes)* +%ADD11O,0.075X0.050X0.025*% + +G04 No hole, centered at 0,0 * +G54D10* +G04 Recenter to 0,0 +G01X0Y0D02* +G04 Draw a line segment* +X00100Y0D01* +G04 Turn off for a segment* +X00200Y0D02* +G04 Draw another line at angle* +G54D11* +X00300Y00100D01* +G04 Turn off for a segment* +X0Y00100D02* +G54D10* +G04 Turn on circular interpolation* +G75* +G03X0Y00300I0J00100D01* + +G04 Turn off for a segment* +X00500Y00D02* +G04 Draw a larger radius arc* +G03X00350Y00150I-00250J-00050D01* + +G04 Turn off for a segment* +X00250Y00200D02* +G04 Draw a larger clockwise radius arc* +G02X00350Y00350I00250J-00050D01* + +M02* diff --git a/examples/gerbv_test_files/test-aperture-obround-flash-1.gbx b/examples/gerbv_test_files/test-aperture-obround-flash-1.gbx new file mode 100755 index 0000000..b09bf43 --- /dev/null +++ b/examples/gerbv_test_files/test-aperture-obround-flash-1.gbx @@ -0,0 +1,27 @@ +G04 Test flashing of obround apertures* +G04 Four groups of obround apertures are arranged in a square* +G04 Handcoded by Julian Lamb * +%MOIN*% +%FSLAX23Y23*% +%ADD10O,0.050X0.080*% +%ADD11O,0.080X0.050X0.025*% +%ADD12O,0.050X0.025X0.025X0.0150*% + +G04 No hole, centered at 0,0 * +G54D10* +X0Y0D03* + +G04 Round hole, centered at 0.1,0 * +G54D11* +X00100Y0D03* + +G04 Square hole, centered at 0,0.1 * +G54D12* +X0Y00100D03* + +G04 Two, with round holes, slightly overlapping, centered at 0.1,0.1 * +G54D11* +X00100Y00090D03* +X00100Y00110D03* + +M02* diff --git a/examples/gerbv_test_files/test-aperture-polygon-1.gbx b/examples/gerbv_test_files/test-aperture-polygon-1.gbx new file mode 100755 index 0000000..27f7e8e --- /dev/null +++ b/examples/gerbv_test_files/test-aperture-polygon-1.gbx @@ -0,0 +1,38 @@ +G04 Test drawing with polygon apertures* +G04 Hand coded by Julian Lamb * +%MOIN*% +%FSLAX23Y23*% +%ADD10O,0.050X0.025*% +G04 Note: aperture 11 has a round hole in it, but this shouldn't ever show when* +G04 drawing with it (only should show in flashes)* +%ADD11O,0.075X0.050X0.025*% + +G04 No hole, centered at 0,0 * +G54D10* +G04 Recenter to 0,0 +G01X0Y0D02* +G04 Draw a line segment* +X00100Y0D01* +G04 Turn off for a segment* +X00200Y0D02* +G04 Draw another line at angle* +G54D11* +X00300Y00100D01* +G04 Turn off for a segment* +X0Y00100D02* +G54D10* +G04 Turn on circular interpolation* +G75* +G03X0Y00300I0J00100D01* + +G04 Turn off for a segment* +X00500Y00D02* +G04 Draw a larger radius arc* +G03X00350Y00150I-00250J-00050D01* + +G04 Turn off for a segment* +X00250Y00200D02* +G04 Draw a larger clockwise radius arc* +G02X00350Y00350I00250J-00050D01* + +M02* diff --git a/examples/gerbv_test_files/test-aperture-polygon-flash-1.gbx b/examples/gerbv_test_files/test-aperture-polygon-flash-1.gbx new file mode 100755 index 0000000..788a755 --- /dev/null +++ b/examples/gerbv_test_files/test-aperture-polygon-flash-1.gbx @@ -0,0 +1,27 @@ +G04 Test flashing of polygon apertures* +G04 Four groups of polygon apertures are arranged in a square* +G04 Handcoded by Julian Lamb * +%MOIN*% +%FSLAX23Y23*% +%ADD10P,0.050X3*% +%ADD11P,0.050X6X-45X0.035*% +%ADD12P,0.040X10X25X0.025X0.025X0.0150*% + +G04 Triangle, centered at 0,0 * +G54D10* +X0Y0D03* + +G04 Hexagon with round hole rotate 45 degreed ccwise, centered at 0.1,0 * +G54D11* +X00100Y0D03* + +G04 10-sided with square hole rotated 25 degrees, centered at 0,0.1 * +G54D12* +X0Y00100D03* + +G04 Two, with round holes, slightly overlapping, centered at 0.1,0.1 * +G54D11* +X00100Y00090D03* +X00100Y00110D03* + +M02* diff --git a/examples/gerbv_test_files/test-aperture-rectangle-1.gbx b/examples/gerbv_test_files/test-aperture-rectangle-1.gbx new file mode 100755 index 0000000..77a8c2e --- /dev/null +++ b/examples/gerbv_test_files/test-aperture-rectangle-1.gbx @@ -0,0 +1,38 @@ +G04 Test drawing with rectangular apertures* +G04 Hand coded by Julian Lamb * +%MOIN*% +%FSLAX23Y23*% +%ADD10R,0.050X0.025*% +G04 Note: aperture 11 has a round hole in it, but this shouldn't ever show when* +G04 drawing with it (only should show in flashes)* +%ADD11R,0.075X0.050X0.025*% + +G04 No hole, centered at 0,0 * +G54D10* +G04 Recenter to 0,0 +G01X0Y0D02* +G04 Draw a line segment* +X00100Y0D01* +G04 Turn off for a segment* +X00200Y0D02* +G04 Draw another line at angle* +G54D11* +X00300Y00100D01* +G04 Turn off for a segment* +X0Y00100D02* +G54D10* +G04 Turn on circular interpolation* +G75* +G03X0Y00300I0J00100D01* + +G04 Turn off for a segment* +X00500Y00D02* +G04 Draw a larger radius arc* +G03X00350Y00150I-00250J-00050D01* + +G04 Turn off for a segment* +X00250Y00200D02* +G04 Draw a larger clockwise radius arc* +G02X00350Y00350I00250J-00050D01* + +M02* diff --git a/examples/gerbv_test_files/test-aperture-rectangle-flash-1.gbx b/examples/gerbv_test_files/test-aperture-rectangle-flash-1.gbx new file mode 100755 index 0000000..8aeb79c --- /dev/null +++ b/examples/gerbv_test_files/test-aperture-rectangle-flash-1.gbx @@ -0,0 +1,27 @@ +G04 Test flashing of rectangular apertures* +G04 Four groups of rectangular apertures are arranged in a square* +G04 Handcoded by Julian Lamb * +%MOIN*% +%FSLAX23Y23*% +%ADD10R,0.050X0.080*% +%ADD11R,0.080X0.050X0.025*% +%ADD12R,0.050X0.025X0.025X0.0150*% + +G04 No hole, centered at 0,0 * +G54D10* +X0Y0D03* + +G04 Round hole, centered at 0.1,0 * +G54D11* +X00100Y0D03* + +G04 Square hole, centered at 0,0.1 * +G54D12* +X0Y00100D03* + +G04 Two, with round holes, slightly overlapping, centered at 0.1,0.1 * +G54D11* +X00100Y00090D03* +X00100Y00110D03* + +M02* diff --git a/examples/gerbv_test_files/test-circular-interpolation-1.gbx b/examples/gerbv_test_files/test-circular-interpolation-1.gbx new file mode 100755 index 0000000..75cffc9 --- /dev/null +++ b/examples/gerbv_test_files/test-circular-interpolation-1.gbx @@ -0,0 +1,35 @@ +G04 Test circular interpolation* +G04 Hand coded by Julian Lamb * +%MOIN*% +%FSLAX23Y23*% +%ADD10C,0.050*% +G54D10* + +G04 Recenter to 0,0* +G01X0Y0D02* + +G04 Turn on multi-quadrant mode* +G75* +G03X0Y00200I0J00100D01* + +G04 Switch to quadrant mode, draw ccwise* +G74* +G01X00400Y0D02* +G03X00470Y00080I0J00100D01* + +G04 Draw things clockwise on the top two objects* + +G04 Turn on multi-quadrant mode* +G75* +G01X00100Y00300D02* +G02X00100Y00500I0J00100D01* + +G04 Switch to quadrant mode, draw clockwise* +G04 Note: since this is single quadrant mode, I and J must be* +G04 positive, and the parser should automatically negate the J value* +G04 to make the curve travel in the clockwise direction* +G74* +G01X00400Y00300D02* +G02X00500Y00300I00150J00300D01* + +M02* diff --git a/examples/gerbv_test_files/test-drill-leading-zero-1.exc b/examples/gerbv_test_files/test-drill-leading-zero-1.exc new file mode 100755 index 0000000..7e53954 --- /dev/null +++ b/examples/gerbv_test_files/test-drill-leading-zero-1.exc @@ -0,0 +1,8 @@ +M48 +INCH,LZ +T13C0.05 +% +T13 +X-001000Y030000 +X00000Y03000 +X001Y03 M30 diff --git a/examples/gerbv_test_files/test-drill-repeat-1.exc b/examples/gerbv_test_files/test-drill-repeat-1.exc new file mode 100755 index 0000000..8a87d5a --- /dev/null +++ b/examples/gerbv_test_files/test-drill-repeat-1.exc @@ -0,0 +1,19 @@ +M48 +INCH,TZ +T01C0.050 +% +T01 +X0000Y0000 +X10000Y10000 +R5X1000 +X20000Y10000 +R5Y1000 +X30000Y10000 +R5X1000Y1500 +X10000Y00000 +R5X-1000 +X20000Y00000 +R5Y-1000 +X30000Y00000 +R5X-1000Y-1500 +M30 diff --git a/examples/gerbv_test_files/test-drill-trailing-zero-1.exc b/examples/gerbv_test_files/test-drill-trailing-zero-1.exc new file mode 100755 index 0000000..5218b81 --- /dev/null +++ b/examples/gerbv_test_files/test-drill-trailing-zero-1.exc @@ -0,0 +1,8 @@ +M48 +INCH,TZ +T13C0.05 +% +T13 +X-001000Y030000 +X0Y030000 +X01000Y30000 M30 diff --git a/examples/gerbv_test_files/test-image-justify-1.gbx b/examples/gerbv_test_files/test-image-justify-1.gbx new file mode 100755 index 0000000..6e71d62 --- /dev/null +++ b/examples/gerbv_test_files/test-image-justify-1.gbx @@ -0,0 +1,19 @@ +G04 Test image justify 1* +G04 Crosshairs should be justified to the X axis * +G04 and 0.5 inches offset from Y axis * +G04 Handcoded by Julian Lamb * +%MOIN*% +%FSLAX23Y23*% +%IJB.5*% +%ADD10C,0.050*% + +G04 Crosshairs * +X-1000Y0D02* +G54D10* +X1000Y0D01* + +X0Y-1000D02* +G54D10* +X0Y1000D01* + +M02* diff --git a/examples/gerbv_test_files/test-image-justify-2.gbx b/examples/gerbv_test_files/test-image-justify-2.gbx new file mode 100755 index 0000000..12fa617 --- /dev/null +++ b/examples/gerbv_test_files/test-image-justify-2.gbx @@ -0,0 +1,19 @@ +G04 Test image justify 2* +G04 Crosshairs should be centered in X and Y (platen size * +G04 is assumed to be 2x the overall size of the image) * +G04 Handcoded by Julian Lamb * +%MOIN*% +%FSLAX23Y23*% +%IJACBC*% +%ADD10C,0.050*% + +G04 Crosshairs * +X-1000Y0D02* +G54D10* +X1000Y0D01* + +X0Y-1000D02* +G54D10* +X0Y1000D01* + +M02* diff --git a/examples/gerbv_test_files/test-image-offset-1.gbx b/examples/gerbv_test_files/test-image-offset-1.gbx new file mode 100755 index 0000000..6f79713 --- /dev/null +++ b/examples/gerbv_test_files/test-image-offset-1.gbx @@ -0,0 +1,18 @@ +G04 Test image polarity * +G04 Crosshairs should be centered on 0,0 in final rendering* +G04 Handcoded by Julian Lamb * +%MOIN*% +%FSLAX23Y23*% +%IOA-2.0B-1.0*% +%ADD10C,0.050*% + +G04 Crosshairs to be on 0,0 * +X1000Y1000D02* +G54D10* +X3000Y1000D01* + +X2000Y0D02* +G54D10* +X2000Y2000D01* + +M02* diff --git a/examples/gerbv_test_files/test-image-offset-2.gbx b/examples/gerbv_test_files/test-image-offset-2.gbx new file mode 100755 index 0000000..34e56e1 --- /dev/null +++ b/examples/gerbv_test_files/test-image-offset-2.gbx @@ -0,0 +1,19 @@ +G04 Test image offset uses current units * +G04 Crosshairs should be centered on 0,0 in final rendering* +G04 Handcoded by Julian Lamb * +%MOMM*% +%FSLAX23Y23*% +%IOB-25.4*% +%MOIN*% +%ADD10C,0.050*% + +G04 Crosshairs to be on 0,0 * +X-1000Y1000D02* +G54D10* +X1000Y1000D01* + +X0Y0D02* +G54D10* +X0Y2000D01* + +M02* diff --git a/examples/gerbv_test_files/test-image-polarity-1.gbx b/examples/gerbv_test_files/test-image-polarity-1.gbx new file mode 100755 index 0000000..e012966 --- /dev/null +++ b/examples/gerbv_test_files/test-image-polarity-1.gbx @@ -0,0 +1,17 @@ +G04 Test image polarity * +G04 Crosshairs should be cut out of a positive background* +G04 Handcoded by Julian Lamb * +%MOIN*% +%FSLAX23Y23*% +%IPNEG*% +%ADD10C,0.050*% + +G04 Draw crosshairs * +X-1000Y0D02* +G54D10* +X1000Y0D01* +X0Y-1000D02* +G54D10* +X0Y1000D01* + +M02* diff --git a/examples/gerbv_test_files/test-image-rotation-1.gbx b/examples/gerbv_test_files/test-image-rotation-1.gbx new file mode 100755 index 0000000..c136b5b --- /dev/null +++ b/examples/gerbv_test_files/test-image-rotation-1.gbx @@ -0,0 +1,21 @@ +G04 Test image rotation * +G04 Handcoded by Julian Lamb * +%MOIN*% +%FSLAX23Y23*% +%IR270*% +%ADD10C,0.050*% + +G04 Quarter star * +X1000Y0D02* +G54D10* +X2000Y0D01* + +X1000Y0D02* +G54D10* +X2000Y1000D01* + +X1000Y0D02* +G54D10* +X1000Y1000D01* + +M02* diff --git a/examples/gerbv_test_files/test-include-file-1.gbx b/examples/gerbv_test_files/test-include-file-1.gbx new file mode 100755 index 0000000..9576c79 --- /dev/null +++ b/examples/gerbv_test_files/test-include-file-1.gbx @@ -0,0 +1,11 @@ +G04 Test include file 1 * +G04 Crosshairs should be drawn at 0,0 in final rendering* +G04 Handcoded by Julian Lamb * +%MOIN*% +%FSLAX23Y23*% +%IOA-2.0B-1.0*% +%ADD10C,0.050*% + +G04 Crosshairs to be on 0,0 * +%IFinclude-file-1.gbx*% +M02* diff --git a/examples/gerbv_test_files/test-layer-axis-select-1.gbx b/examples/gerbv_test_files/test-layer-axis-select-1.gbx new file mode 100755 index 0000000..d5f003e --- /dev/null +++ b/examples/gerbv_test_files/test-layer-axis-select-1.gbx @@ -0,0 +1,15 @@ +G04 Test layer axis select * +G04 Line is drawn along A axis, then axis select switches it and renders * +G04 line along y axis * +G04 Handcoded by Julian Lamb * +%MOIN*% +%FSLAX23Y23*% +%ASAYBX*% +%ADD10C,0.050*% + +G04 Draw line * +X-1000Y0D02* +G54D10* +X1000Y0D01* + +M02* diff --git a/examples/gerbv_test_files/test-layer-knockout-1.gbx b/examples/gerbv_test_files/test-layer-knockout-1.gbx new file mode 100755 index 0000000..1d400e5 --- /dev/null +++ b/examples/gerbv_test_files/test-layer-knockout-1.gbx @@ -0,0 +1,28 @@ +G04 Test layer knockout 1* +G04 A cleared 3x3 square should surround the crosshairs * +G04 Handcoded by Julian Lamb * +%MOIN*% +%FSLAX23Y23*% +%ADD10C,0.050*% + +G04 Create a large dark area * +G36* +X-2000Y-2000D02* +X2000Y-2000D01* +X2000Y2000D01* +X-2000Y2000D01* +X-2000Y-2000D01* +G37* + +G04 Create the knockout region * +%KOCX-1.5Y-1.5I3J3*% + +G04 Draw crosshairs * +X-1000Y0D02* +G54D10* +X1000Y0D01* +X0Y-1000D02* +G54D10* +X0Y1000D01* + +M02* diff --git a/examples/gerbv_test_files/test-layer-knockout-2.gbx b/examples/gerbv_test_files/test-layer-knockout-2.gbx new file mode 100755 index 0000000..2b331c3 --- /dev/null +++ b/examples/gerbv_test_files/test-layer-knockout-2.gbx @@ -0,0 +1,28 @@ +G04 Test layer knockout 2* +G04 A cleared 0.5 inch border should surround the crosshairs * +G04 Handcoded by Julian Lamb * +%MOIN*% +%FSLAX23Y23*% +%ADD10C,0.050*% + +G04 Create a large dark area * +G36* +X-2000Y-2000D02* +X2000Y-2000D01* +X2000Y2000D01* +X-2000Y2000D01* +X-2000Y-2000D01* +G37* + +G04 Create the knockout region * +%KOCK0.5*% + +G04 Draw crosshairs * +X-1000Y0D02* +G54D10* +X1000Y0D01* +X0Y-1000D02* +G54D10* +X0Y1000D01* + +M02* diff --git a/examples/gerbv_test_files/test-layer-mirror-image-1.gbx b/examples/gerbv_test_files/test-layer-mirror-image-1.gbx new file mode 100755 index 0000000..6c76132 --- /dev/null +++ b/examples/gerbv_test_files/test-layer-mirror-image-1.gbx @@ -0,0 +1,23 @@ +G04 Test layer mirror image 1 * +G04 Quarter star is drawn pointing towards +X, +Y. Mirror +G04 flips around the Y axis and the star should point towards -X, -Y * +G04 Handcoded by Julian Lamb * +%MOIN*% +%FSLAX23Y23*% +%MIA1B1*% +%ADD10C,0.050*% + +G04 Draw quarter star * +X0Y0D02* +G54D10* +X1000Y0D01* + +X0Y0D02* +G54D10* +X1000Y1000D01* + +X0Y0D02* +G54D10* +X0Y1000D01* + +M02* diff --git a/examples/gerbv_test_files/test-layer-mode-1.gbx b/examples/gerbv_test_files/test-layer-mode-1.gbx new file mode 100755 index 0000000..95b8555 --- /dev/null +++ b/examples/gerbv_test_files/test-layer-mode-1.gbx @@ -0,0 +1,68 @@ +G04 Test handling of unit changes within a RS274X file * +G04 Handcoded by Julian Lamb * +%MOIN*% +%FSLAX23Y23*% +G04 Aperture 10 should be in Inches * +%ADD10C,0.050*% +%MOMM*% +G04 Aperture 11 should be in MMs * +%ADD11C,1.250*% +G04 Aperture 12 should be in MMs * +%AMTHERMAL* +7,0,0,25.4,12.7,2.54,0*% +%MOIN*% +G04 Aperture 13 is in inches * +%AMTHERMALTWO* +7,0,0,1,0.5,0.1,0*% +%MOMM*% +%ADD12THERMAL*% +%MOIN*% +%ADD13THERMALTWO*% + +%MOIN*% +G04 Box 1, using aperture 10* +X0Y0D02* +G54D10* +X0Y0D01* +X1000D01* +Y1000D01* +X0D01* +Y0D01* + +G04 Box 2, using aperture 11* +X2000Y0D02* +G54D11* +X2000Y0D01* +X3000D01* +Y1000D01* +X2000D01* +Y0D01* + +%MOMM*% +G04 Box 3, using aperture 10* +X100000Y0D02* +G54D10* +X100000Y0D01* +X125000D01* +Y25000D01* +X100000D01* +Y0D01* + +G04 Draw Thermal in box 1* +G54D12* +Y12000X12700D03* + +G04 Draw Thermal in box 2* +G04 ..switch to inches for coordinates* +G70* +Y500X2500D02* +G54D12* +Y500X2500D03* + +G04 ..switch to mms for coordinates* +G71* +G04 Draw Thermal in box 3* +G54D13* +Y12000X112000D03* + +M02* diff --git a/examples/gerbv_test_files/test-layer-offset-1.gbx b/examples/gerbv_test_files/test-layer-offset-1.gbx new file mode 100755 index 0000000..df26e4d --- /dev/null +++ b/examples/gerbv_test_files/test-layer-offset-1.gbx @@ -0,0 +1,18 @@ +G04 Test layer offset 1 * +G04 Crosshairs should be centered on 0,0* +G04 Handcoded by Julian Lamb * +%MOIN*% +%FSLAX23Y23*% +%OFA-2.0B-1.0*% +%ADD10C,0.050*% + +G04 Crosshairs to be on 0,0 * +X1000Y1000D02* +G54D10* +X3000Y1000D01* + +X2000Y0D02* +G54D10* +X2000Y2000D01* + +M02* diff --git a/examples/gerbv_test_files/test-layer-rotation-1.gbx b/examples/gerbv_test_files/test-layer-rotation-1.gbx new file mode 100755 index 0000000..d49e39c --- /dev/null +++ b/examples/gerbv_test_files/test-layer-rotation-1.gbx @@ -0,0 +1,23 @@ +G04 Test layer rotation 1 * +G04 Quarter star should be rotated 45 degrees counterclockwise, pointing* +G04 the center line straight up * +G04 Handcoded by Julian Lamb * +%MOIN*% +%FSLAX23Y23*% +%RO45*% +%ADD10C,0.025*% + +G04 Quarter star * +X1000Y0D02* +G54D10* +X2000Y0D01* + +X1000Y0D02* +G54D10* +X2000Y1000D01* + +X1000Y0D02* +G54D10* +X1000Y1000D01* + +M02* diff --git a/examples/gerbv_test_files/test-layer-scale-factor-1.gbx b/examples/gerbv_test_files/test-layer-scale-factor-1.gbx new file mode 100755 index 0000000..02a7b7d --- /dev/null +++ b/examples/gerbv_test_files/test-layer-scale-factor-1.gbx @@ -0,0 +1,17 @@ +G04 Test layer scale factor 1 * +G04 Crosshairs should be centered on 0,0 and 2 inches wide and 1 inch tall* +G04 Handcoded by Julian Lamb * +%MOIN*% +%FSLAX23Y23*% +%SFA2B1*% +%ADD10C,0.025*% + +G04 Crosshairs to be on 0,0 * +X-500Y0D02* +G54D10* +X500Y0D01* +X0Y-500D02* +G54D10* +X0Y500D01* + +M02* diff --git a/examples/gerbv_test_files/test-layer-step-and_repeat-1.gbx b/examples/gerbv_test_files/test-layer-step-and_repeat-1.gbx new file mode 100755 index 0000000..4f69391 --- /dev/null +++ b/examples/gerbv_test_files/test-layer-step-and_repeat-1.gbx @@ -0,0 +1,17 @@ +G04 Test step and repeat 1* +G04 Repeat a crosshair 3 times in the x direction and 2 times in the Y * +G04 Handcoded by Julian Lamb * +%MOIN*% +%FSLAX23Y23*% +%SRX3Y2I5.0J2*% +%ADD10C,0.050*% + +G04 Draw crosshairs * +X-1000Y0D02* +G54D10* +X1000Y0D01* +X0Y-1000D02* +G54D10* +X0Y1000D01* + +M02* diff --git a/examples/gerbv_test_files/test-layer-step-and_repeat-2.gbx b/examples/gerbv_test_files/test-layer-step-and_repeat-2.gbx new file mode 100755 index 0000000..392036f --- /dev/null +++ b/examples/gerbv_test_files/test-layer-step-and_repeat-2.gbx @@ -0,0 +1,18 @@ +G04 Test step and repeat 1* +G04 Repeat a crosshair 3 times in the x direction and 2 times in the Y * +G04 Handcoded by Julian Lamb * +%MOIN*% +%FSLAX23Y23*% +%SRX3Y2I1J1*% +%ADD10C,0.050*% + +G04 Draw a simple square* +G36* +G01X00400Y0D02* +X00600Y0D01* +X00600Y00200D01* +X00400Y00200D01* +X00400Y0D01* +G37* + +M02* diff --git a/examples/gerbv_test_files/test-polygon-fill-1.gbx b/examples/gerbv_test_files/test-polygon-fill-1.gbx new file mode 100755 index 0000000..ec25644 --- /dev/null +++ b/examples/gerbv_test_files/test-polygon-fill-1.gbx @@ -0,0 +1,45 @@ +G04 Test drawing with polygon apertures* +G04 Four small polygon fills aranged in a square +G04 Hand coded by Julian Lamb * +%MOIN*% +%FSLAX23Y23*% +%ADD10C,0.050*% + +G04 Draw a rectangle with a rounded right side* +G36* +G01X0Y0D02* +X00200Y0D01* +G75* +G03X00200Y00200I0J00100D01* +X0Y00200D01* +G04 Do not close with a final line, so let gerbv automatically close* +G37* + +G04 Draw a simple square* +G36* +G01X00400Y0D02* +X00600Y0D01* +X00600Y00200D01* +X00400Y00200D01* +X00400Y0D01* +G37* + +G04 Draw a small diamond* +G36* +G01X00100Y00300D02* +X00200Y00400D01* +X00100Y00500D01* +X0Y00400D01* +X00100Y00300D01* +G37* + +G04 Draw a very-narrow slit* +G36* +G01X00500Y00300D02* +X00510Y00300D01* +X00510Y00500D01* +X00500Y00500D01* +X00500Y00300D01* +G37* + +M02* diff --git a/examples/render_gerbv_tests.py b/examples/render_gerbv_tests.py new file mode 100755 index 0000000..d29ec11 --- /dev/null +++ b/examples/render_gerbv_tests.py @@ -0,0 +1,59 @@ +#! /usr/bin/env python +# -*- coding: utf-8 -*- + +# Copyright 2015 Hamilton Kibbe + +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at + +# http://www.apache.org/licenses/LICENSE-2.0 + +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. + +""" +This example renders the gerber files from the gerbv test suite +""" + +import os +from gerber.rs274x import read as gerber_read +from gerber.excellon import read as excellon_read +from gerber.render import GerberCairoContext +from gerber.utils import listdir + +GERBER_FOLDER = os.path.abspath(os.path.join(os.path.dirname(__file__), 'gerbv_test_files')) + +if not os.path.isdir(os.path.join(os.path.dirname(__file__), 'outputs')): + os.mkdir(os.path.join(os.path.dirname(__file__), 'outputs')) + +for infile in listdir(GERBER_FOLDER): + if infile.startswith('test'): + try: + outfile = os.path.splitext(infile)[0] + '.png' + if infile.endswith('gbx'): + layer = gerber_read(os.path.join(GERBER_FOLDER, infile)) + print("Loaded Gerber file: {}".format(infile)) + elif infile.endswith('exc'): + layer = excellon_read(os.path.join(GERBER_FOLDER, infile)) + print("Loaded Excellon file: {}".format(infile)) + else: + continue + + # Create a new drawing context + ctx = GerberCairoContext(1200) + ctx.color = (80./255, 80/255., 154/255.) + ctx.drill_color = ctx.color + + # Draw the layer, and specify the rendering settings to use + layer.render(ctx) + + # Write output to png file + print("Writing output to: {}".format(outfile)) + ctx.dump(os.path.join(os.path.dirname(__file__), 'outputs', outfile)) + except Exception as exc: + import traceback + traceback.print_exc() -- cgit