From 9febca7da6a730b3b3ca3a54129a9f88e5c44d14 Mon Sep 17 00:00:00 2001 From: opiopan Date: Thu, 21 Mar 2019 22:00:32 +0900 Subject: initial commit --- test/test.py | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 test/test.py (limited to 'test/test.py') diff --git a/test/test.py b/test/test.py new file mode 100644 index 0000000..d894268 --- /dev/null +++ b/test/test.py @@ -0,0 +1,63 @@ +import gerberex +from gerberex.dxf import DxfFile +import gerber +from gerber.render.cairo_backend import GerberCairoContext + +def merge(): + ctx = gerberex.GerberComposition() + a = gerberex.read('test.GTL') + a.to_metric() + ctx.merge(a) + + b = gerberex.read('test.GTL') + b.to_metric() + b.offset(0, 25) + ctx.merge(b) + + c = gerberex.read('test2.GTL') + c.to_metric() + c.offset(0, 60) + ctx.merge(c) + + c = gerberex.read('test.GML') + c.to_metric() + ctx.merge(c) + + ctx.dump('test-merged.GTL') + +def merge2(): + ctx = gerberex.DrillComposition() + a = gerberex.read('test.TXT') + a.to_metric() + ctx.merge(a) + + b = gerberex.read('test.TXT') + b.to_metric() + b.offset(0, 25) + ctx.merge(b) + + c = gerberex.read('test2.TXT') + c.to_metric() + c.offset(0, 60) + ctx.merge(c) + + ctx.dump('test-merged.TXT') + + +#merge2() + +file = gerberex.read('outline.dxf') +file.to_metric() +w = file.width +file.draw_mode = DxfFile.DM_FILL +file.write('outline.GML') + +copper = gerber.load_layer('test-merged.GTL') +ctx = GerberCairoContext(scale=10) +ctx.render_layer(copper) +outline = gerber.load_layer('test.GML') +outline.cam_source.to_metric() +ctx.render_layer(outline) +drill = gerber.load_layer('test-merged.TXT') +ctx.render_layer(drill) +ctx.dump('test.png') -- cgit