Commit graph

52 commits

Author SHA1 Message Date
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
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
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
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
Paulo Henrique Silva
b93804ed9a Add unspecified FS D leading zeros format
FS D leading zero format (probably form Direct) is an unspecified
coordinate format where all numbers are specified with both leading
and trailing zeros.
2015-04-07 18:22:02 -03:00
Paulo Henrique Silva
adc1ff6d72 Fix for py3 2015-03-05 14:58:36 -03:00
Paulo Henrique Silva
a13b981c1c Fix tests for macros with no variables.
All AM*Primitive classes now handles float for all but the code
modifiers. This simplifies the reading/parsing.
2015-03-05 14:43:30 -03:00
Paulo Henrique Silva
670d3fbbd7 Add aperture macro parsing and evaluation.
Aperture macros can get complex with arithmetical operations,
variables and variables substitution.

Current pcb-tools code just read each macro block as an independent
unit, this cannot deal with variables that get changed after used.

This patch splits the task in two: first we parse all macro content
and creates a bytecode representation of all operations. This bytecode
representation will be executed when an AD command is issues passing
the required parameters.

Parsing is heavily based on gerbv using a Shunting Yard approach to
math parsing.

Integration with rs274x.py code is not finished as I need to figure out
how to integrate the final macro primitives with the graphical primitives
already in use.
2015-03-03 03:41:55 -03:00
Paulo Henrique Silva
5d764a6890 Fix GerberFile.bounds when board origin is negative 2015-02-20 13:58:08 -02:00
Hamilton Kibbe
5966d7830b Add offset operation 2015-02-18 23:13:23 -05:00
Hamilton Kibbe
288ac27084 Get unit conversion working for Gerber/Excellon files
Started operations module for file operations/transforms
2015-02-18 04:31:23 -05:00
Hamilton Kibbe
8f69c1dfa2 Update line primitive to take aperture parameter
This fixes the exception referenced in #12. Still need to add rendering
code for rectangle aperture lines and arcs.

Rectangle strokes will be drawn as polygons by the rendering backends.
2015-02-12 11:28:50 -05:00
Hamilton Kibbe
208149d676 merge upstream changes 2015-01-26 22:24:45 -05:00
Paulo Henrique Silva
cbb662491c Refactor AM aperture handling and add unit conversion support
* Add support to convert between metric/impertial
* AM primitives are now properly created and can be
  converted between metric/imperial.
  (only Outline primitive is supported, no rendering yet)
2015-01-14 03:15:52 -02:00
Paulo Henrique Silva
53ee756609 Fix region primitive creation 2015-01-13 23:12:27 -02:00
Paulo Henrique Silva
be5b94b8c0 Fix parsing for OrCAD.
* Modify the way we parse parameters to allow more than
  one parameter in a single line as in the following example:

  %FSLAX55Y55*MOIN*%
  %IR0*IPPOS*OFA0.00000B0.00000*MIA0B0*SFA1.00000B1.00000*%

  (this is from OrCAD 16 default output)

* Add missing deprecated parameters.

* Change API to use given FileSettings on output. This allows
  us to use pcb-tools to convert between FS formats.
2014-12-15 23:44:12 -02:00
Hamilton Kibbe
29deffcf77 add ipc2581 primitives 2014-12-05 23:59:28 -05:00
Paulo Henrique Silva
ab69ee0172 Bunch of small fixes to improve Gerber read/write. 2014-11-10 12:24:09 -02:00
Paulo Henrique Silva
171876bca0 style change 2014-10-26 22:27:12 -02:00
Paulo Henrique Silva
3ffa9238c4 Add simple hack to allow evaluation when gerber have macros and polygon 2014-10-26 22:26:50 -02:00
Paulo Henrique Silva
8f584d6396 Fix parsing for AM macros and support for zero sized circle primitives 2014-10-26 22:26:04 -02:00
Paulo Henrique Silva
777ffd385b Fix parsing of Unknown commands 2014-10-26 21:39:51 -02:00
Hamilton Kibbe
4f076d7b76 Merge aperture fixses from upstream 2014-10-26 17:59:57 -04:00
Hamilton Kibbe
18e3b87625 Test update 2014-10-19 22:23:00 -04:00