diff options
author | Hamilton Kibbe <hamilton.kibbe@gmail.com> | 2016-01-21 03:57:44 -0500 |
---|---|---|
committer | Garret Fick <garret@ficksworkshop.com> | 2016-09-24 02:28:36 +0800 |
commit | 5af19af190c1fb0f0c5be029d46d63e657dde4d9 (patch) | |
tree | dd60a0b21e1d1ca7258b9f978ce973354d96062c /gerber/excellon.py | |
parent | 8d5e782ccf220d77f0aad5a4e5605dc5cbe0f410 (diff) | |
download | gerbonara-5af19af190c1fb0f0c5be029d46d63e657dde4d9.tar.gz gerbonara-5af19af190c1fb0f0c5be029d46d63e657dde4d9.tar.bz2 gerbonara-5af19af190c1fb0f0c5be029d46d63e657dde4d9.zip |
Commit partial merge so I can work on the plane
Diffstat (limited to 'gerber/excellon.py')
-rwxr-xr-x | gerber/excellon.py | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/gerber/excellon.py b/gerber/excellon.py index a5da42a..0626819 100755 --- a/gerber/excellon.py +++ b/gerber/excellon.py @@ -80,7 +80,7 @@ def loads(data, settings = None, tools = None): settings = FileSettings(**detect_excellon_format(data))
return ExcellonParser(settings, tools).parse_raw(data)
-
+ class DrillHit(object): """Drill feature that is a single drill hole.
@@ -91,8 +91,7 @@ class DrillHit(object): position : tuple(float, float)
Center position of the drill.
- """
- + """ def __init__(self, tool, position):
self.tool = tool
self.position = position
@@ -194,7 +193,7 @@ class ExcellonFile(CamFile): self.hits = hits
@property
- def primitives(self):
+ def primitives(self): """
Gets the primitives. Note that unlike Gerber, this generates new objects
"""
@@ -262,7 +261,7 @@ class ExcellonFile(CamFile): for hit in self.hits:
if hit.tool.number == tool.number:
f.write(CoordinateStmt(
- *hit.position).to_excellon(self.settings) + '\n')
+ *hit.position).to_excellon(self.settings) + '\n') f.write(EndOfProgramStmt().to_excellon() + '\n') def to_inch(self):
@@ -276,7 +275,7 @@ class ExcellonFile(CamFile): for tool in iter(self.tools.values()):
tool.to_inch()
for primitive in self.primitives:
- primitive.to_inch()
+ primitive.to_inch() for hit in self.hits: hit.to_inch() @@ -298,7 +297,7 @@ class ExcellonFile(CamFile): for statement in self.statements:
statement.offset(x_offset, y_offset)
for primitive in self.primitives:
- primitive.offset(x_offset, y_offset)
+ primitive.offset(x_offset, y_offset) for hit in self. hits: hit.offset(x_offset, y_offset) @@ -359,7 +358,7 @@ class ExcellonParser(object): Parameters
----------
settings : FileSettings or dict-like
- Excellon file settings to use when interpreting the excellon file.
+ Excellon file settings to use when interpreting the excellon file. """ def __init__(self, settings=None, ext_tools=None): self.notation = 'absolute'
@@ -614,12 +613,12 @@ class ExcellonParser(object): stmt = ToolSelectionStmt.from_excellon(line)
self.statements.append(stmt)
- # T0 is used as END marker, just ignore
+ # T0 is used as END marker, just ignore if stmt.tool != 0: tool = self._get_tool(stmt.tool)
if not tool:
- # FIXME: for weird files with no tools defined, original calc from gerbv + # FIXME: for weird files with no tools defined, original calc from gerb if self._settings().units == "inch":
diameter = (16 + 8 * stmt.tool) / 1000.0
else:
|