mirror of
git://projects.qi-hardware.com/ben-counterweight.git
synced 2025-01-15 21:51:06 +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
66
cvr.py
66
cvr.py
@ -1,5 +1,8 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
|
||||||
|
import shape
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# gnuplot the outline
|
# gnuplot the outline
|
||||||
#
|
#
|
||||||
@ -10,6 +13,12 @@ def outline_gnuplot(points):
|
|||||||
print
|
print
|
||||||
|
|
||||||
|
|
||||||
|
def gnuplot_line(x0, y0, x1, y1):
|
||||||
|
print x0, y0
|
||||||
|
print x1, y1
|
||||||
|
print
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# make a HeeksCAD sketch of the outline
|
# make a HeeksCAD sketch of the outline
|
||||||
#
|
#
|
||||||
@ -48,6 +57,10 @@ def open_outline(*args):
|
|||||||
do(list(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
|
# 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:
|
||||||
@ -111,19 +124,42 @@ def outline():
|
|||||||
|
|
||||||
|
|
||||||
def label():
|
def label():
|
||||||
|
u = 2
|
||||||
|
x = 40
|
||||||
|
y = 66
|
||||||
# C
|
# C
|
||||||
open_outline(
|
open_outline(
|
||||||
25+5, 55+10,
|
x+u, y+2*u,
|
||||||
25, 55+10,
|
x, y+2*u,
|
||||||
25, 55,
|
x, y,
|
||||||
25+5, 55)
|
x+u, y)
|
||||||
|
|
||||||
|
x += u*1.6
|
||||||
# W
|
# W
|
||||||
open_outline(
|
open_outline(
|
||||||
33, 55+10,
|
x, y+2*u,
|
||||||
33, 55,
|
x, y,
|
||||||
33+2.5, 55+5,
|
x+0.5*u, y+u,
|
||||||
33+5, 55,
|
x+u, y,
|
||||||
33+5, 55+10)
|
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__":
|
if __name__ == "__main__":
|
||||||
@ -134,3 +170,15 @@ else:
|
|||||||
|
|
||||||
outline()
|
outline()
|
||||||
label()
|
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