Commit graph

72 commits

Author SHA1 Message Date
Hamilton Kibbe
ea0643dcf4 Merge pull request #67 from jmargeta/python_3_fix
Add GerberParser fix for Python 3.x
2017-07-04 01:31:32 -04:00
Jan Margeta
dd1676ad8a Add tolerance to center finding
In some cases, the computation of valid sweep angle hit numerical limits
and no centers are found.

This commit adds a small amount of tolerance.
2017-04-15 15:40:55 +02:00
Jan Margeta
5b67c82abc Replace sys.maxint with sys.maxsize
In Python 3, sys.maxint was removed, however its current use
can be safely substituted with sys.maxsize (also in Python 2)

See also: https://docs.python.org/3.1/whatsnew/3.0.html#integers
2017-04-15 11:13:31 +02:00
Hamilton Kibbe
a7f1f6ef0f Finish adding square hole support, fix some primitive calculations, etc. 2016-11-18 08:05:57 -05:00
Hamilton Kibbe
6b672e98ff Add support for IF (Include File) rs274x command 2016-11-18 08:02:22 -05:00
Hamilton Kibbe
422c86bcc6 Merge upstream changes 2016-11-06 14:44:40 -05:00
Hamilton Kibbe
724c2b3bce Finish Merge, most tests passing 2016-11-05 20:56:47 -04:00
Hamilton Kibbe
5af19af190 Commit partial merge so I can work on the plane 2016-09-24 02:28:36 +08:00
Hamilton Kibbe
8cd842a41a Manually mere rendering changes 2016-08-06 09:40:40 +08:00
Garret Fick
965d3ce23b Add more tests for rendering to PNG. Start adding tests for rendering to Gerber format. Changed definition of no hole to use None instead of 0 so we can differentiate when writing to Gerber format. Makde polygon use hole diameter instead of hole radius to match other primitives 2016-07-24 22:08:31 +08:00
Garret Fick
7cd6acf126 Add many render tests based on the Umaco gerger specification. Fix multiple rendering bugs, especially related to holes in flashed apertures 2016-07-24 17:08:47 +08:00
Garret Fick
34f20ee90f Manually merge af5541ac93 2016-07-17 21:04:15 +08:00
Garret Fick
0dded38353 Merge in negative soldermask. Still required further changes to support negatives for shapes that dont exist in the merge source 2016-07-17 10:42:03 +08:00
Garret Fick
b140f5e476 Don't flash G03-only commands 2016-06-28 23:15:20 +08:00
Garret Fick
ccb6eb7a76 Add support for polygon apertures 2016-06-25 16:46:44 +08:00
visualgui823@live.com
6e014c6117 compliant fs format as FS<L or T><A or I>[Nn][Gn]<Xn><Yn>[Dn][Mn] 2016-06-03 10:45:18 +00:00
Garret Fick
5a20b2b92d Fix converting amgroup units 2016-05-28 14:14:49 +08:00
Garret Fick
af86c5c5a2 Correctly find the center for single quadrant arcs 2016-04-23 13:32:32 +08:00
Garret Fick
ad29fac873 Merge pull request #2 from qaulau/master
Update rs274x.py
2016-03-27 14:37:46 +08:00
Garret Fick
82fed20310 D02 in the middle of a region starts a new region 2016-03-26 17:14:47 +08:00
Qau Lau
738bbc7edd Update rs274x.py
python 2.6 bug re incompatibility in sre, see https://bugs.python.org/issue214033
2016-03-22 17:30:20 +08:00
Garret Fick
a6c1862450 Correctly handle empty command statements 2016-03-19 11:28:45 +08:00
Robert Kirberich
d274b0823d Make sure apertures get a unit 2016-03-10 20:51:53 +00:00
Garret Fick
02dbc6a51e Additional bounding box calcuation that considers only actual positions, not the movement of the machine 2016-02-21 10:23:03 +08:00
Garret Fick
4bc7a6345b Keep aperature macros as single statement. Don't generate regions with no points 2016-02-16 22:24:03 +08:00
Garret Fick
991a3687ef Handle multiple commands on a single line 2016-02-16 21:57:25 +08:00
Garret Fick
a765f8aa2c Fix convertion of units for apertures and regions 2016-02-14 22:06:32 +08:00
Garret Fick
96bdd0f59d Keep track of quadrant mode so we can draw full circles 2016-01-31 15:24:57 +08: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
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
Garret Fick
83ae0670d1 More stability fixes for poorly constructed files 2016-01-08 00:19:47 +08:00
Garret Fick
ff1ad704d5 Work with Diptrace that calls things D3 not D03 2015-12-30 18:10:43 +08: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
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
Garret Fick
221f67d8fe Move the coordinate matching to the beginning since most of the items are coordinates. For large files, this decreases total time by 10-20% 2015-12-03 09:42:45 +08:00
Garret Fick
f2b075e338 Regions with arcs would crash if they occured before any command to set the aperture 2015-11-18 11:26:20 +08:00
Paulo Henrique Silva
6e29b9bcae Use Python's universal newlines to open files 2015-11-15 22:28:56 -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
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
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
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
Hamilton Kibbe
8ec3077be9 Add checks to ensure statement unit conversions are idempotent 2015-05-16 09:45:34 -04:00
Hamilton Kibbe
390838fc8b Fix for #25. Checking was happening at the gerber/excellon file level, but I added units checking at the primitive level so the use case shown in the example is covered. Might want to throw a bunch more assertions in the test code (i started doing a few) to cover multiple calls to unit conversion functions 2015-04-24 10:54:13 -04:00
Paulo Henrique Silva
a3cce62be7 Fix Gerber generation for coord blocks with implicit op code 2015-04-23 13:38:01 -03:00
Paulo Henrique Silva
d6bb61eec6 Fix issue where D01 and D03 are implicit.
Based on code from @rdprescott.
2015-04-13 16:55:03 -03:00
Paulo Henrique Silva
1ea7e14ba5 Fix CoordStmt with missing i/j offsets 2015-04-07 18:28:03 -03:00
Paulo Henrique Silva
d1c74317c8 Add some deprecated but still found statements 2015-04-07 18:26:33 -03:00