1
0
mirror of git://projects.qi-hardware.com/ben-counterweight.git synced 2025-02-21 14:14:42 +02:00

cvr.py: added "CW" label

This commit is contained in:
Werner Almesberger 2010-08-05 23:42:08 -03:00
parent 891ad69331
commit 16b7cc9562

37
cvr.py
View File

@ -5,11 +5,9 @@
# #
def outline_gnuplot(points): def outline_gnuplot(points):
x0 = points[0]
y0 = points[1]
while len(points): while len(points):
print points.pop(0), points.pop(0) print points.pop(0), points.pop(0)
print x0, y0 print
# #
@ -26,26 +24,30 @@ def outline_cad(points):
cad.sketch() cad.sketch()
sk = cad.getlastobj() sk = cad.getlastobj()
x0 = points.pop(0) last_x = points.pop(0)
y0 = points.pop(0) last_y = points.pop(0)
last_x = x0
last_y = y0
while len(points): while len(points):
x = points.pop(0) x = points.pop(0)
y = points.pop(0) y = points.pop(0)
cad_line(sk, last_x, last_y, x, y) cad_line(sk, last_x, last_y, x, y)
last_x = x last_x = x
last_y = y last_y = y
cad_line(sk, last_x, last_y, x0, y0)
cad.reorder(sk) cad.reorder(sk)
return sk return sk
def closed_outline(*args): def closed_outline(*args):
l = list(args)
l.append(args[0])
l.append(args[1])
do(l)
def open_outline(*args):
do(list(args)) do(list(args))
# #
# Make the cover sheet 2 mm larger than the counterweight on all sides. We need # Make the cover sheet 2 mm larger than the counterweight on all sides. We need
# the following exceptions to avoid mechanical interference: # the following exceptions to avoid mechanical interference:
@ -108,6 +110,22 @@ def outline():
26, 46) 26, 46)
def label():
# C
open_outline(
25+5, 55+10,
25, 55+10,
25, 55,
25+5, 55)
# W
open_outline(
33, 55+10,
33, 55,
33+2.5, 55+5,
33+5, 55,
33+5, 55+10)
if __name__ == "__main__": if __name__ == "__main__":
do = outline_gnuplot do = outline_gnuplot
else: else:
@ -115,3 +133,4 @@ else:
do = outline_cad do = outline_cad
outline() outline()
label()