diff --git a/__pycache__/uchwyt.cpython-312.pyc b/__pycache__/uchwyt.cpython-312.pyc index ff2939c..87a8248 100644 Binary files a/__pycache__/uchwyt.cpython-312.pyc and b/__pycache__/uchwyt.cpython-312.pyc differ diff --git a/uchwyt.py b/uchwyt.py index 342bbd1..9de426f 100644 --- a/uchwyt.py +++ b/uchwyt.py @@ -1,5 +1,5 @@ from build123d import * -from ocp_vscode import * +# from ocp_vscode import * dlugosc = 44 @@ -20,37 +20,33 @@ with BuildPart() as uchwyt: 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: +with BuildPart() as uchwyt_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())) + 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) -sciana.joints["mount"].connect_to(polaczone.part.joints["tylna_sciana"]) - -show(polaczone,sciana, render_joints=True ) +# show_o(polaczone,sciana, tylna) +# show_object(polaczone) +# debug(sciana)