mirror of
git://projects.qi-hardware.com/ben-counterweight.git
synced 2025-01-15 16:51:05 +02:00
Draw counterweight shape also on cover.
- cvr.py: run shape.make_base to draw counterweight shape - cvr.py (label): parametrized position and size of label - cvr.py (label): counterweight outline collided with label; shrink label and move it to an unoccupied area
This commit is contained in:
parent
7da2d7ce52
commit
64ae378bf5
68
cvr.py
68
cvr.py
@ -1,5 +1,8 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
import shape
|
||||
|
||||
|
||||
#
|
||||
# gnuplot the outline
|
||||
#
|
||||
@ -10,6 +13,12 @@ def outline_gnuplot(points):
|
||||
print
|
||||
|
||||
|
||||
def gnuplot_line(x0, y0, x1, y1):
|
||||
print x0, y0
|
||||
print x1, y1
|
||||
print
|
||||
|
||||
|
||||
#
|
||||
# make a HeeksCAD sketch of the outline
|
||||
#
|
||||
@ -47,7 +56,11 @@ def closed_outline(*args):
|
||||
def open_outline(*args):
|
||||
do(list(args))
|
||||
|
||||
|
||||
|
||||
def line(*args):
|
||||
do_line(*args)
|
||||
|
||||
|
||||
#
|
||||
# Make the cover sheet 2 mm larger than the counterweight on all sides. We need
|
||||
# the following exceptions to avoid mechanical interference:
|
||||
@ -111,19 +124,42 @@ def outline():
|
||||
|
||||
|
||||
def label():
|
||||
u = 2
|
||||
x = 40
|
||||
y = 66
|
||||
# C
|
||||
open_outline(
|
||||
25+5, 55+10,
|
||||
25, 55+10,
|
||||
25, 55,
|
||||
25+5, 55)
|
||||
x+u, y+2*u,
|
||||
x, y+2*u,
|
||||
x, y,
|
||||
x+u, y)
|
||||
|
||||
x += u*1.6
|
||||
# W
|
||||
open_outline(
|
||||
33, 55+10,
|
||||
33, 55,
|
||||
33+2.5, 55+5,
|
||||
33+5, 55,
|
||||
33+5, 55+10)
|
||||
x, y+2*u,
|
||||
x, y,
|
||||
x+0.5*u, y+u,
|
||||
x+u, y,
|
||||
x+u, y+2*u)
|
||||
|
||||
|
||||
# ----- Counterweight outline -------------------------------------------------
|
||||
|
||||
|
||||
lines = []
|
||||
|
||||
|
||||
def rect_outline(x0, y0, z0, x1, y1, z1):
|
||||
global lines
|
||||
|
||||
lines.append((x0, y0, x0, y1))
|
||||
lines.append((x1, y0, x1, y1))
|
||||
lines.append((x0, y0, x1, y0))
|
||||
lines.append((x0, y1, x1, y1))
|
||||
|
||||
|
||||
# ----- Main ------------------------------------------------------------------
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
@ -134,3 +170,15 @@ else:
|
||||
|
||||
outline()
|
||||
label()
|
||||
|
||||
shape.rect = rect_outline
|
||||
shape.make_base()
|
||||
|
||||
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