mirror of
git://projects.qi-hardware.com/ben-counterweight.git
synced 2025-01-14 18:41:06 +02:00
Generate single sketch for cover sheet instead of one for each part.
- cvr.py (outline_cad): accept sketch as argument instead of creating a new one - cvr.py (outline_gnuplot): added dummy sketch argument - cvr.py (closed_outline, open_outlineoutline, label): pass sketch argument
This commit is contained in:
parent
64ae378bf5
commit
6bf49a167c
38
cvr.py
38
cvr.py
@ -7,7 +7,7 @@ import shape
|
||||
# gnuplot the outline
|
||||
#
|
||||
|
||||
def outline_gnuplot(points):
|
||||
def outline_gnuplot(sk, points):
|
||||
while len(points):
|
||||
print points.pop(0), points.pop(0)
|
||||
print
|
||||
@ -29,10 +29,7 @@ def cad_line(sk, x0, y0, x1, y1):
|
||||
cad.add(sk, cad.getlastobj())
|
||||
|
||||
|
||||
def outline_cad(points):
|
||||
cad.sketch()
|
||||
sk = cad.getlastobj()
|
||||
|
||||
def outline_cad(sk, points):
|
||||
last_x = points.pop(0)
|
||||
last_y = points.pop(0)
|
||||
while len(points):
|
||||
@ -46,15 +43,15 @@ def outline_cad(points):
|
||||
return sk
|
||||
|
||||
|
||||
def closed_outline(*args):
|
||||
def closed_outline(sk, *args):
|
||||
l = list(args)
|
||||
l.append(args[0])
|
||||
l.append(args[1])
|
||||
do(l)
|
||||
do(sk, l)
|
||||
|
||||
|
||||
def open_outline(*args):
|
||||
do(list(args))
|
||||
def open_outline(sk, *args):
|
||||
do(sk, list(args))
|
||||
|
||||
|
||||
def line(*args):
|
||||
@ -97,8 +94,8 @@ def line(*args):
|
||||
#
|
||||
|
||||
|
||||
def outline():
|
||||
closed_outline(
|
||||
def outline(sk):
|
||||
closed_outline(sk,
|
||||
# counterweight corners: (16, 46) and (15, 60)
|
||||
13, 46,
|
||||
# (15, 69.5)
|
||||
@ -123,12 +120,12 @@ def outline():
|
||||
26, 46)
|
||||
|
||||
|
||||
def label():
|
||||
def label(sk):
|
||||
u = 2
|
||||
x = 40
|
||||
y = 66
|
||||
# C
|
||||
open_outline(
|
||||
open_outline(sk,
|
||||
x+u, y+2*u,
|
||||
x, y+2*u,
|
||||
x, y,
|
||||
@ -136,7 +133,7 @@ def label():
|
||||
|
||||
x += u*1.6
|
||||
# W
|
||||
open_outline(
|
||||
open_outline(sk,
|
||||
x, y+2*u,
|
||||
x, y,
|
||||
x+0.5*u, y+u,
|
||||
@ -164,12 +161,17 @@ def rect_outline(x0, y0, z0, x1, y1, z1):
|
||||
|
||||
if __name__ == "__main__":
|
||||
do = outline_gnuplot
|
||||
sk = None
|
||||
else:
|
||||
import HeeksPython as cad
|
||||
do = outline_cad
|
||||
|
||||
outline()
|
||||
label()
|
||||
do = outline_cad
|
||||
cad.sketch()
|
||||
sk = cad.getlastobj()
|
||||
|
||||
|
||||
outline(sk)
|
||||
label(sk)
|
||||
|
||||
shape.rect = rect_outline
|
||||
shape.make_base()
|
||||
@ -178,7 +180,5 @@ if __name__ == "__main__":
|
||||
for e in lines:
|
||||
gnuplot_line(*e)
|
||||
else:
|
||||
cad.sketch()
|
||||
sk = cad.getlastobj()
|
||||
for e in lines:
|
||||
cad_line(sk, *e)
|
||||
|
Loading…
x
Reference in New Issue
Block a user