build123d_uchwyt_termometr/uchwyt.py

57 lines
1.2 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 sciana:
with BuildSketch() as s1:
RectangleRounded(dlugosc + 20, 50 , zaokraglenie)
extrude(amount=1, both=True)
base_face = sciana.faces().sort_by(Axis.Z)[0]
sciana.joints["mount"] = RigidJoint(
label="mount",
to_part=sciana,
joint_location=Location(base_face.center()) # Centrum znalezionej ściany
)
with BuildPart() as polaczone:
add(uchwyt)
with Locations((0,-15,0)):
add(powiekszony, mode=Mode.SUBTRACT)
tylnias = polaczone.faces().sort_by(Axis.Z)[-1]
RigidJoint("tylna_sciana", joint_location=Location(tylnias.center()))
sciana.joints["mount"].connect_to(polaczone.part.joints["tylna_sciana"])
show(polaczone,sciana, render_joints=True )