mirror of
git://projects.qi-hardware.com/ben-counterweight.git
synced 2025-01-15 04:01: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
|
# gnuplot the outline
|
||||||
#
|
#
|
||||||
|
|
||||||
def outline_gnuplot(points):
|
def outline_gnuplot(sk, points):
|
||||||
while len(points):
|
while len(points):
|
||||||
print points.pop(0), points.pop(0)
|
print points.pop(0), points.pop(0)
|
||||||
print
|
print
|
||||||
@ -29,10 +29,7 @@ def cad_line(sk, x0, y0, x1, y1):
|
|||||||
cad.add(sk, cad.getlastobj())
|
cad.add(sk, cad.getlastobj())
|
||||||
|
|
||||||
|
|
||||||
def outline_cad(points):
|
def outline_cad(sk, points):
|
||||||
cad.sketch()
|
|
||||||
sk = cad.getlastobj()
|
|
||||||
|
|
||||||
last_x = points.pop(0)
|
last_x = points.pop(0)
|
||||||
last_y = points.pop(0)
|
last_y = points.pop(0)
|
||||||
while len(points):
|
while len(points):
|
||||||
@ -46,15 +43,15 @@ def outline_cad(points):
|
|||||||
return sk
|
return sk
|
||||||
|
|
||||||
|
|
||||||
def closed_outline(*args):
|
def closed_outline(sk, *args):
|
||||||
l = list(args)
|
l = list(args)
|
||||||
l.append(args[0])
|
l.append(args[0])
|
||||||
l.append(args[1])
|
l.append(args[1])
|
||||||
do(l)
|
do(sk, l)
|
||||||
|
|
||||||
|
|
||||||
def open_outline(*args):
|
def open_outline(sk, *args):
|
||||||
do(list(args))
|
do(sk, list(args))
|
||||||
|
|
||||||
|
|
||||||
def line(*args):
|
def line(*args):
|
||||||
@ -97,8 +94,8 @@ def line(*args):
|
|||||||
#
|
#
|
||||||
|
|
||||||
|
|
||||||
def outline():
|
def outline(sk):
|
||||||
closed_outline(
|
closed_outline(sk,
|
||||||
# counterweight corners: (16, 46) and (15, 60)
|
# counterweight corners: (16, 46) and (15, 60)
|
||||||
13, 46,
|
13, 46,
|
||||||
# (15, 69.5)
|
# (15, 69.5)
|
||||||
@ -123,12 +120,12 @@ def outline():
|
|||||||
26, 46)
|
26, 46)
|
||||||
|
|
||||||
|
|
||||||
def label():
|
def label(sk):
|
||||||
u = 2
|
u = 2
|
||||||
x = 40
|
x = 40
|
||||||
y = 66
|
y = 66
|
||||||
# C
|
# C
|
||||||
open_outline(
|
open_outline(sk,
|
||||||
x+u, y+2*u,
|
x+u, y+2*u,
|
||||||
x, y+2*u,
|
x, y+2*u,
|
||||||
x, y,
|
x, y,
|
||||||
@ -136,7 +133,7 @@ def label():
|
|||||||
|
|
||||||
x += u*1.6
|
x += u*1.6
|
||||||
# W
|
# W
|
||||||
open_outline(
|
open_outline(sk,
|
||||||
x, y+2*u,
|
x, y+2*u,
|
||||||
x, y,
|
x, y,
|
||||||
x+0.5*u, y+u,
|
x+0.5*u, y+u,
|
||||||
@ -164,12 +161,17 @@ def rect_outline(x0, y0, z0, x1, y1, z1):
|
|||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
do = outline_gnuplot
|
do = outline_gnuplot
|
||||||
|
sk = None
|
||||||
else:
|
else:
|
||||||
import HeeksPython as cad
|
import HeeksPython as cad
|
||||||
do = outline_cad
|
|
||||||
|
|
||||||
outline()
|
do = outline_cad
|
||||||
label()
|
cad.sketch()
|
||||||
|
sk = cad.getlastobj()
|
||||||
|
|
||||||
|
|
||||||
|
outline(sk)
|
||||||
|
label(sk)
|
||||||
|
|
||||||
shape.rect = rect_outline
|
shape.rect = rect_outline
|
||||||
shape.make_base()
|
shape.make_base()
|
||||||
@ -178,7 +180,5 @@ if __name__ == "__main__":
|
|||||||
for e in lines:
|
for e in lines:
|
||||||
gnuplot_line(*e)
|
gnuplot_line(*e)
|
||||||
else:
|
else:
|
||||||
cad.sketch()
|
|
||||||
sk = cad.getlastobj()
|
|
||||||
for e in lines:
|
for e in lines:
|
||||||
cad_line(sk, *e)
|
cad_line(sk, *e)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user