build123d_uchwyt_termometr/uchwyt.py

53 lines
1.3 KiB
Python

from build123d import *
# from ocp_vscode import *
dlugosc = 44
szerokosc = 44
wysokosc = 12.2
zaokraglenie = 8
with BuildPart() as termometr:
with BuildSketch() as s1:
RectangleRounded(dlugosc, szerokosc, 8)
extrude(amount=wysokosc / 2, both=True)
with BuildPart() as uchwyt:
with BuildSketch() as s1:
RectangleRounded(dlugosc + 20, szerokosc - 10 , zaokraglenie)
extrude(amount=wysokosc / 2 + 5, both=True)
powiekszony = scale(termometr.part, by=1.05)
with BuildPart() as uchwyt_polaczone:
add(uchwyt)
with Locations((0,-15,0)):
add(powiekszony, mode=Mode.SUBTRACT)
with Locations((0,-7,0)):
Box(40,34.4,70, mode=Mode.SUBTRACT)
with BuildPart() as sciana:
vertex_przesuniecia = uchwyt_polaczone.part.faces().sort_by(Axis.Z)[-1].edges().filter_by(Axis.X).sort_by(Axis.Y)[-1].vertex()
tylna = uchwyt.part.faces().sort_by(Axis.Z)[-1]
with BuildSketch(tylna) as s1:
with Locations((0,vertex_przesuniecia.Y,0)):
RectangleRounded(dlugosc + 20, 50 , zaokraglenie, align=(Align.CENTER, Align.MAX))
extrude(amount=2)
with BuildPart() as polaczone:
add(uchwyt_polaczone)
add(sciana)
# debug(vertex_przesuniecia)
show_object(polaczone)
# show_o(polaczone,sciana, tylna)
# show_object(polaczone)
# debug(sciana)