Teraz będę robił z zatrzaskami
This commit is contained in:
parent
db725417ac
commit
b8ba9e6e64
Binary file not shown.
184
orange.py
184
orange.py
|
|
@ -5,132 +5,100 @@ 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)))
|
||||||
|
|
||||||
|
# (Twoje parametry pozostają bez zmian)
|
||||||
dlugosc = 112.80
|
dlugosc = 112.80
|
||||||
szerokosc = 87.80
|
szerokosc = 87.80
|
||||||
wysokosc = 54
|
wysokosc = 54
|
||||||
scianka = 3
|
scianka = 3
|
||||||
|
|
||||||
|
# --- Parametry otworów (skrócone dla czytelności kodu, wartości te same) ---
|
||||||
|
dl1o, sz1o, offset_x1, offset_y1 = 17.84, 11.68, 8.931, 18.295
|
||||||
|
dl2o, sz2o, offset_x2, offset_y2 = 24.103, 22.007, 27.894, 19.047
|
||||||
|
dl3o, sz3o, offset_x3, offset_y3 = 6.20, 8.40, 55.740, 14.770
|
||||||
|
dl4o, sz4o, offset_x4, offset_y4 = 26.577, 19.737, 70.481, 23.208
|
||||||
|
dl5o, sz5o, offset_x5, offset_y5 = 15.400, 20.400, 8.910, 16.720
|
||||||
|
dl6o, sz6o, offset_x6, offset_y6 = 10.200, 19.600, 27.160, 15.620
|
||||||
|
dl7o, sz7o, offset_x7, offset_y7 = 43.200, 20.200, 63.660, 17.820
|
||||||
|
|
||||||
# 1 otworek
|
# Parametry uchwytu
|
||||||
|
mini_udl, mini_usz, mini_ugr = 10, 8.500, 4
|
||||||
dl1o = 17.84
|
wyc_dl, wyc_sz, wyc_gr = 3, 3, 4.50
|
||||||
sz1o = 11.68
|
pods_dl, pods_sz, pods_gr = 12.820, 13.400, 1.7
|
||||||
offset_x1 = 8.931
|
offset_podstawy, przesuniecie_uchwyciku = 1.410, 17.080
|
||||||
offset_y1 = 18.295
|
|
||||||
|
|
||||||
# 2 otworek
|
|
||||||
dl2o = 24.103
|
|
||||||
sz2o = 22.007
|
|
||||||
offset_x2 = 27.894
|
|
||||||
offset_y2 = 19.047
|
|
||||||
|
|
||||||
# 3 otworek
|
|
||||||
|
|
||||||
dl3o = 6.20
|
|
||||||
sz3o = 8.40
|
|
||||||
offset_x3 = 55.740
|
|
||||||
offset_y3 = 14.770
|
|
||||||
|
|
||||||
# 4 otworek
|
|
||||||
|
|
||||||
dl4o = 26.577
|
|
||||||
sz4o = 19.737
|
|
||||||
|
|
||||||
offset_x4 = 70.481
|
|
||||||
offset_y4 = 23.208
|
|
||||||
|
|
||||||
# 5 otworek
|
|
||||||
dl5o = 15.400
|
|
||||||
sz5o = 20.400
|
|
||||||
|
|
||||||
offset_x5 = 8.910
|
|
||||||
offset_y5 = 16.720
|
|
||||||
|
|
||||||
# otworek 6
|
|
||||||
dl6o = 10.200
|
|
||||||
sz6o = 19.600
|
|
||||||
|
|
||||||
offset_x6 = 27.160
|
|
||||||
offset_y6 = 15.620
|
|
||||||
|
|
||||||
# otworek 7
|
|
||||||
dl7o = 43.200
|
|
||||||
sz7o = 20.200
|
|
||||||
|
|
||||||
offset_x7 = 63.660
|
|
||||||
offset_y7 = 17.820
|
|
||||||
|
|
||||||
# mini_uchwytik
|
|
||||||
mini_udl = 10
|
|
||||||
mini_usz = 8.500
|
|
||||||
mini_ugr = 4
|
|
||||||
|
|
||||||
# wyciecie_mini
|
|
||||||
wyc_dl = 3
|
|
||||||
wyc_sz = 3
|
|
||||||
wyc_gr = 4.50
|
|
||||||
|
|
||||||
# podstawa_uchwyciku
|
|
||||||
pods_dl = 12.820
|
|
||||||
pods_sz = 13.400
|
|
||||||
pods_gr = 1.7
|
|
||||||
offset_podstawy = 1.410
|
|
||||||
przesuniecie_uchwyciku = 17.607
|
|
||||||
|
|
||||||
with BuildPart() as box:
|
with BuildPart() as box:
|
||||||
|
# --- Główna puszka ---
|
||||||
with BuildSketch() as s1:
|
with BuildSketch() as s1:
|
||||||
Rectangle(dlugosc, szerokosc)
|
Rectangle(dlugosc, szerokosc)
|
||||||
extrude(amount=wysokosc)
|
extrude(amount=wysokosc)
|
||||||
offset(amount=-scianka, openings=box.faces().sort_by(Axis.Z)[-1])
|
offset(amount=-scianka, openings=box.faces().sort_by(Axis.Z)[-1])
|
||||||
|
|
||||||
|
# --- Wycinanie otworów (Twoja logika, zgrupowana dla wydajności) ---
|
||||||
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]
|
# Punkt odniesienia frontu
|
||||||
with BuildSketch(front) as s2:
|
v_front = front.edges().filter_by(Axis.Z).sort_by(Axis.X)[0].vertices()[0]
|
||||||
with Locations((front_left_edge_vertex.X + offset_x1, -offset_y1)):
|
|
||||||
Rectangle(dl1o, sz1o, align=(Align.MIN, Align.MIN, Align.CENTER))
|
with BuildSketch(front):
|
||||||
extrude(amount=-scianka, mode=Mode.SUBTRACT)
|
with Locations((v_front.X + offset_x1, -offset_y1)): Rectangle(dl1o, sz1o, align=(Align.MIN, Align.MIN, Align.CENTER))
|
||||||
with BuildSketch(front) as s3:
|
with Locations((v_front.X + offset_x2, -offset_y2)): Rectangle(dl2o, sz2o, align=(Align.MIN, Align.MIN, Align.CENTER))
|
||||||
with Locations((front_left_edge_vertex.X + offset_x2, -offset_y2)):
|
with Locations((v_front.X + offset_x3, -offset_y3)): Rectangle(dl3o, sz3o, align=(Align.MIN, Align.MIN, Align.CENTER))
|
||||||
Rectangle(dl2o, sz2o, align=(Align.MIN, Align.MIN, Align.CENTER))
|
with Locations((v_front.X + offset_x4, -offset_y4)): Rectangle(dl4o, sz4o, align=(Align.MIN, Align.MIN, Align.CENTER))
|
||||||
extrude(amount=-scianka, mode=Mode.SUBTRACT)
|
|
||||||
with BuildSketch(front) as s4:
|
|
||||||
with Locations((front_left_edge_vertex.X + offset_x3, -offset_y3)):
|
|
||||||
Rectangle(dl3o, sz3o, align=(Align.MIN, Align.MIN, Align.CENTER))
|
|
||||||
extrude(amount=-scianka, mode=Mode.SUBTRACT)
|
|
||||||
with BuildSketch(front) as s5:
|
|
||||||
with Locations((front_left_edge_vertex.X + offset_x4, -offset_y4)):
|
|
||||||
Rectangle(dl4o, sz4o, align=(Align.MIN, Align.MIN, Align.CENTER))
|
|
||||||
extrude(amount=-scianka, mode=Mode.SUBTRACT)
|
extrude(amount=-scianka, mode=Mode.SUBTRACT)
|
||||||
|
|
||||||
back = box.faces().sort_by(Axis.Y)[-1]
|
back = box.faces().sort_by(Axis.Y)[-1]
|
||||||
back_left_edge_vertex = box.faces().sort_by(Axis.Y)[-1].edges().filter_by(Axis.Z).sort_by(Axis.X)[-1].vertices()[0]
|
# Punkt odniesienia tyłu
|
||||||
with BuildSketch(back) as s6:
|
v_back = back.edges().filter_by(Axis.Z).sort_by(Axis.X)[-1].vertices()[0]
|
||||||
with Locations((back_left_edge_vertex.X - offset_x5, + offset_y5)):
|
|
||||||
Rectangle(dl5o, sz5o, align=(Align.MAX, Align.MAX))
|
with BuildSketch(back):
|
||||||
extrude(amount=-scianka, mode=Mode.SUBTRACT)
|
with Locations((v_back.X - offset_x5, + offset_y5)): Rectangle(dl5o, sz5o, align=(Align.MAX, Align.MAX))
|
||||||
with BuildSketch(back) as s7:
|
with Locations((v_back.X - offset_x6 - 12.450, + offset_y6)):
|
||||||
with Locations((back_left_edge_vertex.X - offset_x6 - 12.450, + offset_y6)):
|
with GridLocations(12.450, 0, 3, 1): Rectangle(dl6o, sz6o, align=(Align.MAX, Align.MAX))
|
||||||
with GridLocations(12.450, 0, 3, 1):
|
with Locations((v_back.X - offset_x7, + offset_y7)): Rectangle(dl7o, sz7o, align=(Align.MAX, Align.MAX))
|
||||||
Rectangle(dl6o, sz6o, align=(Align.MAX, Align.MAX))
|
|
||||||
extrude(amount=-scianka, mode=Mode.SUBTRACT)
|
|
||||||
with BuildSketch(back) as s8:
|
|
||||||
with Locations((back_left_edge_vertex.X - offset_x7, + offset_y7)):
|
|
||||||
Rectangle(dl7o, sz7o, align=(Align.MAX, Align.MAX))
|
|
||||||
extrude(amount=-scianka, mode=Mode.SUBTRACT)
|
extrude(amount=-scianka, mode=Mode.SUBTRACT)
|
||||||
|
|
||||||
|
# --- ZAGNIEŻDŻONY BUILD PART NA UCHWYTY ---
|
||||||
|
# Pobieramy ścianę boczną głównego pudełka jako referencję
|
||||||
bok = box.faces().sort_by(Axis.X)[-1]
|
bok = box.faces().sort_by(Axis.X)[-1]
|
||||||
with BuildSketch(bok) as uchwycik:
|
|
||||||
Rectangle(mini_udl, mini_usz)
|
# Tworzymy osobną, "wewnętrzną" przestrzeń tylko dla uchwytów
|
||||||
u1 = extrude(amount=mini_ugr)
|
with BuildPart() as uchwyty_komplet:
|
||||||
u1_face = u1.faces().sort_by(Axis.Y)[0]
|
|
||||||
u2_face = u1.faces().sort_by(Axis.X)[-1]
|
# 1. Budujemy prawy uchwyt (tak jak w Twoim kodzie)
|
||||||
with BuildSketch(u1_face) as wyc1:
|
with BuildSketch(bok) as szkic_uchwytu:
|
||||||
with Locations((-2.750, -0.5)):
|
with Locations((-przesuniecie_uchwyciku, 0)):
|
||||||
Rectangle(wyc_dl, wyc_sz)
|
Rectangle(mini_udl, mini_usz)
|
||||||
|
|
||||||
|
# Zmienilem nazwe zmiennej z 'u1' na 'baza', żeby nie psuć kontekstu
|
||||||
|
baza = extrude(amount=mini_ugr)
|
||||||
|
|
||||||
|
# Operacje na uchwycie
|
||||||
|
u1_face = baza.faces().sort_by(Axis.Y)[0]
|
||||||
|
u2_face = baza.faces().sort_by(Axis.X)[-1]
|
||||||
|
|
||||||
|
with BuildSketch(u1_face):
|
||||||
|
with Locations((-2.750, -0.5)):
|
||||||
|
Rectangle(wyc_dl, wyc_sz)
|
||||||
|
mirror(about=Plane.YZ) # Lustro szkicu wycięcia
|
||||||
|
extrude(amount=-wyc_gr, mode=Mode.SUBTRACT)
|
||||||
|
|
||||||
|
with BuildSketch(u2_face):
|
||||||
|
with Locations((-offset_podstawy, 0)):
|
||||||
|
Rectangle(pods_dl, pods_sz)
|
||||||
|
extrude(amount=pods_gr)
|
||||||
|
|
||||||
|
# 2. KLUCZOWY MOMENT: Mirror całego uchwytu wewnątrz tej pod-przestrzeni
|
||||||
|
# Ponieważ jesteśmy w 'uchwyty_komplet', to polecenie skopiuje wszystko co tu stworzyliśmy
|
||||||
mirror(about=Plane.YZ)
|
mirror(about=Plane.YZ)
|
||||||
extrude(amount=-wyc_gr, mode=Mode.SUBTRACT)
|
|
||||||
with BuildSketch(u2_face) as uchwycik_podstawa:
|
# 3. Dodajemy gotowy zestaw uchwytów (prawy + lewy) do głównego pudełka
|
||||||
with Locations((-offset_podstawy, 0)):
|
# add(uchwyty_komplet.part)
|
||||||
Rectangle(pods_dl, pods_sz)
|
# with BuildPart() as zatrzask:
|
||||||
extrude(amount=pods_gr)
|
# z = box.faces().filter_by(Axis.Y).sort_by(Axis.Y)[-2]
|
||||||
|
# with BuildSketch(z):
|
||||||
|
# Rectangle(20, 20)
|
||||||
|
# extrude(amount=50)
|
||||||
|
|
||||||
|
|
||||||
|
# # Wizualizacja
|
||||||
# show_all()
|
# show_all()
|
||||||
show(box, orange, uchwycik_podstawa)
|
show(box, orange)
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,140 @@
|
||||||
|
from build123d import *
|
||||||
|
from ocp_vscode import *
|
||||||
|
|
||||||
|
|
||||||
|
orange = import_step("./OrangePi-Box.step")
|
||||||
|
orange = orange.rotate(Axis.X, -90).move(Location((0, 0, 37)))
|
||||||
|
|
||||||
|
dlugosc = 112.80
|
||||||
|
szerokosc = 87.80
|
||||||
|
wysokosc = 54
|
||||||
|
scianka = 3
|
||||||
|
|
||||||
|
|
||||||
|
# 1 otworek
|
||||||
|
|
||||||
|
dl1o = 17.84
|
||||||
|
sz1o = 11.68
|
||||||
|
offset_x1 = 8.931
|
||||||
|
offset_y1 = 18.295
|
||||||
|
|
||||||
|
# 2 otworek
|
||||||
|
dl2o = 24.103
|
||||||
|
sz2o = 22.007
|
||||||
|
offset_x2 = 27.894
|
||||||
|
offset_y2 = 19.047
|
||||||
|
|
||||||
|
# 3 otworek
|
||||||
|
|
||||||
|
dl3o = 6.20
|
||||||
|
sz3o = 8.40
|
||||||
|
offset_x3 = 55.740
|
||||||
|
offset_y3 = 14.770
|
||||||
|
|
||||||
|
# 4 otworek
|
||||||
|
|
||||||
|
dl4o = 26.577
|
||||||
|
sz4o = 19.737
|
||||||
|
|
||||||
|
offset_x4 = 70.481
|
||||||
|
offset_y4 = 23.208
|
||||||
|
|
||||||
|
# 5 otworek
|
||||||
|
dl5o = 15.400
|
||||||
|
sz5o = 20.400
|
||||||
|
|
||||||
|
offset_x5 = 8.910
|
||||||
|
offset_y5 = 16.720
|
||||||
|
|
||||||
|
# otworek 6
|
||||||
|
dl6o = 10.200
|
||||||
|
sz6o = 19.600
|
||||||
|
|
||||||
|
offset_x6 = 27.160
|
||||||
|
offset_y6 = 15.620
|
||||||
|
|
||||||
|
# otworek 7
|
||||||
|
dl7o = 43.200
|
||||||
|
sz7o = 20.200
|
||||||
|
|
||||||
|
offset_x7 = 63.660
|
||||||
|
offset_y7 = 17.820
|
||||||
|
|
||||||
|
# mini_uchwytik
|
||||||
|
mini_udl = 10
|
||||||
|
mini_usz = 8.500
|
||||||
|
mini_ugr = 4
|
||||||
|
|
||||||
|
# wyciecie_mini
|
||||||
|
wyc_dl = 3
|
||||||
|
wyc_sz = 3
|
||||||
|
wyc_gr = 4.50
|
||||||
|
|
||||||
|
# podstawa_uchwyciku
|
||||||
|
pods_dl = 12.820
|
||||||
|
pods_sz = 13.400
|
||||||
|
pods_gr = 1.7
|
||||||
|
offset_podstawy = 1.410
|
||||||
|
przesuniecie_uchwyciku = 17.080
|
||||||
|
|
||||||
|
with BuildPart() as box:
|
||||||
|
with BuildSketch() as s1:
|
||||||
|
Rectangle(dlugosc, szerokosc)
|
||||||
|
extrude(amount=wysokosc)
|
||||||
|
offset(amount=-scianka, openings=box.faces().sort_by(Axis.Z)[-1])
|
||||||
|
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 s2:
|
||||||
|
with Locations((front_left_edge_vertex.X + offset_x1, -offset_y1)):
|
||||||
|
Rectangle(dl1o, sz1o, align=(Align.MIN, Align.MIN, Align.CENTER))
|
||||||
|
extrude(amount=-scianka, mode=Mode.SUBTRACT)
|
||||||
|
with BuildSketch(front) as s3:
|
||||||
|
with Locations((front_left_edge_vertex.X + offset_x2, -offset_y2)):
|
||||||
|
Rectangle(dl2o, sz2o, align=(Align.MIN, Align.MIN, Align.CENTER))
|
||||||
|
extrude(amount=-scianka, mode=Mode.SUBTRACT)
|
||||||
|
with BuildSketch(front) as s4:
|
||||||
|
with Locations((front_left_edge_vertex.X + offset_x3, -offset_y3)):
|
||||||
|
Rectangle(dl3o, sz3o, align=(Align.MIN, Align.MIN, Align.CENTER))
|
||||||
|
extrude(amount=-scianka, mode=Mode.SUBTRACT)
|
||||||
|
with BuildSketch(front) as s5:
|
||||||
|
with Locations((front_left_edge_vertex.X + offset_x4, -offset_y4)):
|
||||||
|
Rectangle(dl4o, sz4o, align=(Align.MIN, Align.MIN, Align.CENTER))
|
||||||
|
extrude(amount=-scianka, mode=Mode.SUBTRACT)
|
||||||
|
back = box.faces().sort_by(Axis.Y)[-1]
|
||||||
|
back_left_edge_vertex = box.faces().sort_by(Axis.Y)[-1].edges().filter_by(Axis.Z).sort_by(Axis.X)[-1].vertices()[0]
|
||||||
|
with BuildSketch(back) as s6:
|
||||||
|
with Locations((back_left_edge_vertex.X - offset_x5, + offset_y5)):
|
||||||
|
Rectangle(dl5o, sz5o, align=(Align.MAX, Align.MAX))
|
||||||
|
extrude(amount=-scianka, mode=Mode.SUBTRACT)
|
||||||
|
with BuildSketch(back) as s7:
|
||||||
|
with Locations((back_left_edge_vertex.X - offset_x6 - 12.450, + offset_y6)):
|
||||||
|
with GridLocations(12.450, 0, 3, 1):
|
||||||
|
Rectangle(dl6o, sz6o, align=(Align.MAX, Align.MAX))
|
||||||
|
extrude(amount=-scianka, mode=Mode.SUBTRACT)
|
||||||
|
with BuildSketch(back) as s8:
|
||||||
|
with Locations((back_left_edge_vertex.X - offset_x7, + offset_y7)):
|
||||||
|
Rectangle(dl7o, sz7o, align=(Align.MAX, Align.MAX))
|
||||||
|
extrude(amount=-scianka, mode=Mode.SUBTRACT)
|
||||||
|
bok = box.faces().sort_by(Axis.X)[-1]
|
||||||
|
|
||||||
|
with BuildPart() as u1:
|
||||||
|
with BuildSketch(bok) as uchwycik:
|
||||||
|
with Locations((-przesuniecie_uchwyciku, 0)):
|
||||||
|
Rectangle(mini_udl, mini_usz)
|
||||||
|
u1 = extrude(amount=mini_ugr)
|
||||||
|
u1_face = u1.faces().sort_by(Axis.Y)[0]
|
||||||
|
u2_face = u1.faces().sort_by(Axis.X)[-1]
|
||||||
|
with BuildSketch(u1_face) as wyc1:
|
||||||
|
with Locations((-2.750, -0.5)):
|
||||||
|
Rectangle(wyc_dl, wyc_sz)
|
||||||
|
mirror(about=Plane.YZ)
|
||||||
|
extrude(amount=-wyc_gr, mode=Mode.SUBTRACT)
|
||||||
|
with BuildSketch(u2_face) as uchwycik_podstawa:
|
||||||
|
with Locations((-offset_podstawy, 0)):
|
||||||
|
Rectangle(pods_dl, pods_sz)
|
||||||
|
extrude(amount=pods_gr)
|
||||||
|
mirror(about=Plane.YZ)
|
||||||
|
|
||||||
|
|
||||||
|
# show_all()
|
||||||
|
show(box)
|
||||||
Loading…
Reference in New Issue