This commit is contained in:
Rafał Paluch 2025-11-21 21:01:04 +01:00
parent cb2e2c179c
commit dd60c82db1
1 changed files with 13 additions and 18 deletions

View File

@ -1,4 +1,5 @@
from build123d import * from build123d import *
from ocp_vscode import *
orange = import_step("./OrangePi-Box.step") orange = import_step("./OrangePi-Box.step")
orange = orange.rotate(Axis.X, -90).move(Location((0, 0, 37))) orange = orange.rotate(Axis.X, -90).move(Location((0, 0, 37)))
@ -9,21 +10,14 @@ wysokosc = 54
scianka = 3 scianka = 3
# with BuildPart() as box: # 1 otworek
# Box(dlugosc, szerokosc, wysokosc)
# front = box.faces().sort_by(Axis.Y)[0]
# front_left_edge_vertex = box.faces().sort_by(Axis.Y)[0].edges().filter_by(Axis.Z).sort_by(Axis.X)[0].vertices()[0]
# with BuildSketch(front) as s1:
# with Locations((5, 0, 0)):
# test = Rectangle(11.68, 17.84, align=(Align.MIN, Align.MAX, Align.CENTER))
# extrude(amount=-scianka, mode=Mode.SUBTRACT)
# show_object(box, name="box") dl1o = 17.84
# # debug(orange) sz1o = 11.68
# debug(front_left_edge_vertex, name="vertex") offset_x1 = 8.931
# debug(s1.sketch) offset_y1 = 18.295
# debug(test, name="test")
# 2 otworek
with BuildPart() as box: with BuildPart() as box:
with BuildSketch() as s1: with BuildSketch() as s1:
@ -33,9 +27,10 @@ with BuildPart() as box:
front = box.faces().sort_by(Axis.Y)[0] front = box.faces().sort_by(Axis.Y)[0]
front_left_edge_vertex = box.faces().sort_by(Axis.Y)[0].edges().filter_by(Axis.Z).sort_by(Axis.X)[0].vertices()[0] front_left_edge_vertex = box.faces().sort_by(Axis.Y)[0].edges().filter_by(Axis.Z).sort_by(Axis.X)[0].vertices()[0]
with BuildSketch(front) as s2: with BuildSketch(front) as s2:
with Locations((front_left_edge_vertex.X, 0, 0)): with Locations((front_left_edge_vertex.X + offset_x1, -offset_y1)):
Rectangle(30, 20, align=(Align.MIN, Align.MIN, Align.CENTER)) Rectangle(dl1o, sz1o, align=(Align.MIN, Align.MIN, Align.CENTER))
extrude(amount=-scianka, mode=Mode.SUBTRACT)
show_object(box)
debug(s2.sketch) # show_all()
debug(orange) show(box)