Commit graph

235 commits

Author SHA1 Message Date
Girts Folkmanis
369ac7b2a3 cairo_backend.py: use BytesIO instead of StringIO
This fixes a crash in cairocffi on Python3, and should be compatible
with both python2 and python3. In python2, byte strings are just
strings. In python3, when getting binary data, the user probably wants
a byte string instead of a regular string.
2016-11-07 17:11:07 -08:00
Hamilton Kibbe
22e668c75f Fix tests 2016-11-05 18:30:21 -04:00
Hamilton Kibbe
0fedaedb6e Add more layer hints as seen in the wild 2016-09-29 19:43:28 -04:00
Paulo Henrique Silva
6b054c6815 Merge pull request #55 from BenFrantzDale/install-instructions
Add install instructions.
2016-03-22 14:10:47 -03:00
Ben FrantzDale
57c9dab99d Remove "make" line. Apparently it's not necessary. 2016-03-22 13:02:34 -04:00
Ben FrantzDale
7c7a2e03d9 Add install instructions. 2016-03-22 08:13:30 -04:00
Hamilton Kibbe
d7df755d60 Merge pull request #54 from kirberich/master
Make sure apertures get a unit
2016-03-11 08:48:03 -05:00
Robert Kirberich
d274b0823d Make sure apertures get a unit 2016-03-10 20:51:53 +00:00
Hamilton Kibbe
5df38c014f Cleanup, rendering fixes.
fixed rendering of tented vias
fixed rendering of semi-transparent layers
fixed file type detection issues
added some examples
2016-01-28 12:19:03 -05:00
Paulo Henrique Silva
b9f1b106c3 Excellon format detection uses ExcelonFile.bounds now
Long term we should have only one .bounds method. But ExcellonParser right
now is not correct for cases with two drills in the same line
(it will report one dimension being zero)
2016-01-25 12:42:12 -02:00
Paulo Henrique Silva
1d9270d809 Fix NameError on Polygon primitive rendering 2016-01-22 03:24:50 -02:00
Hamilton Kibbe
66a0d09e72 Add support for mirrored rendering
- The default theme now renders the bottom layers mirrored.
  - see https://github.com/curtacircuitos/pcb-tools/blob/master/examples/pcb_bottom.png
    for an example.
2016-01-21 04:39:55 -05:00
Hamilton Kibbe
5476da8aa3 Fix a bunch of rendering bugs.
- 'clear' polarity primitives no longer erase background
  - Added aperture macro support for polygons
  - Added aperture macro rendring support
  - Renderer now creates a new surface for each layer and merges them instead of working
    directly on a single surface
  - Updated examples accordingly
2016-01-21 03:57:44 -05:00
Paulo Henrique Silva
7a53251463 Merge pull request #53 from curtacircuitos/pcb_interface
Add PCB interface
2016-01-05 22:05:19 -02:00
Hamilton Kibbe
6a005436b4 Refactor a little
pulled all rendering stuff out of the pcb/layer objects
2016-01-01 12:25:38 -05:00
Hamilton Kibbe
5430fa6738 Python3 fix 2015-12-22 10:18:51 -05:00
Hamilton Kibbe
6f876edd09 Add PCB interface
this incorporates some of @chintal's layers.py changes
PCB.from_directory() simplifies loading of multiple gerbers
the PCB() class should be pretty helpful going forward...

the context classes could use some cleaning up, although I'd like to wait until the freecad stuff gets merged, that way we can try to refactor the context base to support more use cases
2015-12-22 02:47:23 -05:00
Hamilton Kibbe
af5541ac93 Allow renderer to write to memory per #38
Some updates to rendering colors/themes
2015-12-20 23:54:20 -05:00
Paulo Henrique Silva
d1598b46c9 Merge pull request #52 from curtacircuitos/negative_soldermask
Allow negative solder mask rendering per #50.
2015-12-20 22:15:44 -02:00
Hamilton Kibbe
163a0cd531 Merge branch 'negative_soldermask' of github.com:curtacircuitos/pcb-tools into negative_soldermask 2015-12-20 15:26:39 -05:00
Hamilton Kibbe
60c5906b29 Clean up negative render code 2015-12-20 15:24:20 -05:00
Hamilton Kibbe
a0847ef70d Update Readme 2015-12-19 21:56:01 -05:00
Hamilton Kibbe
1cb269131b Allow negative render of soldermask per #50
Update example code and rendering to show change
2015-12-19 21:54:29 -05:00
Paulo Henrique Silva
2e2b4e49c3 Fix AMParamStmt to_gerber to write changes back.
AMParamStmt was not calling to_gerber on each of its primitives
on his own to_gerber method. That way primitives that changes after reading,
such as when you call to_inch/to_metric was failing because it was
writing only the original macro back.
2015-11-23 16:04:25 -02:00
Hamilton Kibbe
ba82d60cb8 Merge pull request #45 from curtacircuitos/remove-svgwrite-backend
Remove svgwrite backend
2015-11-15 22:16:03 -05:00
Paulo Henrique Silva
7e2e469f5e Remove svgwrite backend
We moved the functionality to cairo backend, it can write png and svg and maybe more (pdfs?)
2015-11-15 22:31:42 -02:00
Paulo Henrique Silva
6e29b9bcae Use Python's universal newlines to open files 2015-11-15 22:28:56 -02:00
Hamilton Kibbe
ebc8518197 Merge pull request #43 from curtacircuitos/excellon-with-no-tool-definition
Add fix to work with excellon with no tool definition.
2015-11-13 11:40:03 -05:00
Paulo Henrique Silva
cead702f4d Add fix to work with excellon with no tool definition.
I found out that Proteus generate some strange Excellon without any tool definition.
Gerbv renders it correctly and after digging in I found the heuristic that they use
to "guess" the tool diameter. This change replicates this behavior on pcb-tools.
2015-11-13 13:18:50 -02:00
Paulo Henrique Silva
2208fe2205 Fix issue when a region is created as the first graphical object in a file
When regions were the first thing draw there is no current aperture
defined, as regions do not require an aperture, so we use an zeroed
Circle as aperture in this case. Gerber spec says that apertures have
no graphical meaning for regions, so this should be enough.
2015-11-13 04:17:27 -02:00
Paulo Henrique Silva
6d8b5377a8 Merge pull request #42 from curtacircuitos/add-some-missing-excellon-stmts
Improve Excellon parsing coverage
2015-11-13 03:38:57 -02:00
Paulo Henrique Silva
9ca75f991a Improve Excellon parsing coverage
Add some not so used codes that were generating unknown stmt.
2015-11-13 03:31:32 -02:00
Paulo Henrique Silva
944c832922 Merge pull request #41 from curtacircuitos/read_from_memory
Read from memory
2015-10-14 15:37:02 -03:00
Hamilton Kibbe
10d9028e1f Python 3 fix 2015-10-10 17:02:45 -04:00
Hamilton Kibbe
dd63b169f1 Allow files to be read from strings per #37
Adds a loads() method to the top level module which generates a GerberFile or ExcellonFile from a string
2015-10-10 16:51:21 -04:00
Hamilton Kibbe
b81c9d4bf9 Merge pull request #40 from curtacircuitos/cairo-render-unification
Cairo render unification
2015-09-10 15:54:29 -04:00
Hamilton Kibbe
cb2fa34e88 Add support for arcs in regions.
This fixes the circular cutout issue described in #32.  Regions were previously stored as a collection of points, now they are stored as a collection of line and arc primitives.
2015-08-09 15:11:13 -04:00
Hamilton Kibbe
d4a8705708 Fix windows permission error
per #33
the issue was trying to re-open the temporary file. it works on everything but windows. I've changed it to seek to the beginning and read from the file without re-opening, which should fix the issue.
2015-07-25 09:48:58 -04:00
Hamilton Kibbe
39726e3936 Fix multiple layer issue in cairo-unification branch (see #33) 2015-07-22 22:13:09 -04:00
Paulo Henrique Silva
c92d2d9ea2 Merge pull request #31 from curtacircuitos/statement_link
Add support for tool reordering and drill path optimization example.
2015-07-14 13:32:17 -03:00
Paulo Henrique Silva
b3f6ec558c Fix arcs and ackground painting 2015-07-09 04:05:15 -03:00
Paulo Henrique Silva
5aaf18889c Initial patch to unify our render towards cairo
This branch allows a pure cairo based render for both PNG and SVG.

Cairo backend is mostly the same but with improved support for
configurable scale, orientation and inverted color drawing.

API is not yet final.
2015-07-09 03:54:47 -03:00
Hamilton Kibbe
15254a5bb7 Add tool path optimization example
Add example demonstrating use of tsp-solver with pcb-tools to optimize
tool paths in an excellon file. This is based on @koppi's script in #30
2015-07-06 12:13:59 -04:00
Hamilton Kibbe
ec2ca92da6 Python 3 fix
remove dict itervalues() calls
2015-06-11 14:00:40 -04:00
Hamilton Kibbe
94f3976915 Add keys to statements for linking to primitives. Add some API features to ExcellonFile, such as getting a tool path length and changing tool parameters. Excellonfiles write method generates statements based on the drill hits in the hits member, so drill hits in a generated file can be re-ordered by re-ordering the drill hits in ExcellonFile.hits. see #30 2015-06-11 11:20:56 -04:00
Paulo Henrique Silva
1a70064e10 Merge pull request #29 from curtacircuitos/eagle_netlist_fix
Fix IPC-D-356 parser. Handle too-long reference designators exported …
2015-06-02 00:29:36 -03:00
Hamilton Kibbe
faa44ab731 Fix IPC-D-356 parser. Handle too-long reference designators exported by eagle per #28. 2015-06-01 20:58:16 -04:00
Paulo Henrique Silva
9e36d7e21d G70/G71 are now interpreted as MOParamStmt.
Got a bunch of metric files with no MOMM but only G71, this
should be pretty mush harmless.
2015-05-21 17:15:54 -03:00
Paulo Henrique Silva
aff36a4dca Fix multiline read of mixed statements (%XXX*% followed by DNN*)
We now check if there is a %XXX*% command inside the line before
considering it a multiline statement.
2015-05-21 16:15:55 -03:00
Paulo Henrique Silva
2fe5f36db2 Fix ADD statement parsing for concatened statements.
ADDxxx param statements were too greedy on the mofidiers and were
matching more than it should in cases where there are no newlines after
the statement like:

'%ADD12C,0.305*%%LPD*%', in a single line. The '%' was not exluded form
modifiers so it got confused with the %LPD*% concatened.

top_copper.GTL example was changed to be in a single line now with no
spaces at all and it works well.
2015-05-21 15:54:32 -03:00