summaryrefslogtreecommitdiff
path: root/gerber/gerber_statements.py
diff options
context:
space:
mode:
authorPaulo Henrique Silva <ph.silva@gmail.com>2016-11-18 13:26:35 -0200
committerGitHub <noreply@github.com>2016-11-18 13:26:35 -0200
commitc15033a7834b825999e9da5ef4a5135cfb125b25 (patch)
tree0f9df38f0369902c55be3e801602e8e0c1866025 /gerber/gerber_statements.py
parent521fe89150c6aaa0ff0954cc8d32e4b6f8009324 (diff)
parentc1b29035218467b496fffed76ea85390461150c7 (diff)
downloadgerbonara-c15033a7834b825999e9da5ef4a5135cfb125b25.tar.gz
gerbonara-c15033a7834b825999e9da5ef4a5135cfb125b25.tar.bz2
gerbonara-c15033a7834b825999e9da5ef4a5135cfb125b25.zip
Merge pull request #59 from curtacircuitos/render_updates
Render updates
Diffstat (limited to 'gerber/gerber_statements.py')
-rw-r--r--gerber/gerber_statements.py24
1 files changed, 19 insertions, 5 deletions
diff --git a/gerber/gerber_statements.py b/gerber/gerber_statements.py
index 7322b3c..43596be 100644
--- a/gerber/gerber_statements.py
+++ b/gerber/gerber_statements.py
@@ -279,22 +279,36 @@ class ADParamStmt(ParamStmt):
return cls('AD', dcode, 'R', ([width, height],))
@classmethod
- def circle(cls, dcode, diameter, hole_diameter):
+ def circle(cls, dcode, diameter, hole_diameter=None, hole_width=None, hole_height=None):
'''Create a circular aperture definition statement'''
- if hole_diameter != None:
+ if hole_diameter is not None and hole_diameter > 0:
return cls('AD', dcode, 'C', ([diameter, hole_diameter],))
+ elif (hole_width is not None and hole_width > 0
+ and hole_height is not None and hole_height > 0):
+ return cls('AD', dcode, 'C', ([diameter, hole_width, hole_height],))
return cls('AD', dcode, 'C', ([diameter],))
@classmethod
- def obround(cls, dcode, width, height):
+ def obround(cls, dcode, width, height, hole_diameter=None, hole_width=None, hole_height=None):
'''Create an obround aperture definition statement'''
+ if hole_diameter is not None and hole_diameter > 0:
+ return cls('AD', dcode, 'O', ([width, height, hole_diameter],))
+ elif (hole_width is not None and hole_width > 0
+ and hole_height is not None and hole_height > 0):
+ return cls('AD', dcode, 'O', ([width, height, hole_width, hole_height],))
return cls('AD', dcode, 'O', ([width, height],))
@classmethod
- def polygon(cls, dcode, diameter, num_vertices, rotation, hole_diameter):
+ def polygon(cls, dcode, diameter, num_vertices, rotation, hole_diameter=None, hole_width=None, hole_height=None):
'''Create a polygon aperture definition statement'''
- return cls('AD', dcode, 'P', ([diameter, num_vertices, rotation, hole_diameter],))
+ if hole_diameter is not None and hole_diameter > 0:
+ return cls('AD', dcode, 'P', ([diameter, num_vertices, rotation, hole_diameter],))
+ elif (hole_width is not None and hole_width > 0
+ and hole_height is not None and hole_height > 0):
+ return cls('AD', dcode, 'P', ([diameter, num_vertices, rotation, hole_width, hole_height],))
+ return cls('AD', dcode, 'P', ([diameter, num_vertices, rotation],))
+
@classmethod
def macro(cls, dcode, name):