fix: Adjustments for ease of assembly

This commit is contained in:
Leni Aniva 2025-07-08 23:50:02 -07:00
parent de829577aa
commit 332db357ad
Signed by: aniva
GPG Key ID: D5F96287843E8DFB
1 changed files with 42 additions and 36 deletions

View File

@ -273,7 +273,7 @@ class Onbashira(Model):
chamber_side_length: float = 400.0
chamber_side_width_ex: float = 20.0
# Circular hole to hold a switch
chamber_front_switch_diam: float = 20.0
hatch_switch_diam: float = 20.0
# Dimensions of gun barrels
barrel_diam: float = 25.4 * 1.5
@ -347,8 +347,12 @@ class Onbashira(Model):
motor_coupler_conn_dx: float = 30.0
motor_coupler_wall_thickness: float = 5.0
motor_coupler_inner_gap: float = 1.0
turning_bar_parent_hole_diam: float = 8.0
turning_bar_child_hole_diam: float = 4.0
turning_bar_width: float = 15.0
electronic_mount_dx: float = 50.0
turning_bar_height: float = 30.0
electronics_panel_width_ratio: float = 0.7
electronics_mount_dx: float = 40.0
material_side: Material = Material.WOOD_BIRCH
material_bearing: Material = Material.PLASTIC_PLA
@ -1284,38 +1288,39 @@ class Onbashira(Model):
centered=(True, True, False)
)
)
h = self.turning_bar_height
flange = Cq.Solid.makeBox(
length=w,
width=t,
height=w/2,
).moved(-w/2, -t, -w/2) + Cq.Solid.makeCylinder(
height=w/2 + h,
).moved(-w/2, -t, -w/2-h) + Cq.Solid.makeCylinder(
radius=w/2,
height=t,
pnt=(0, -t, -w/2),
pnt=(0, -t, -w/2-h),
dir=(0, 1, 0),
)
remover = Cq.Solid.makeCylinder(
radius=BOLT_COMMON.diam_thread/2,
holeC = Cq.Solid.makeCylinder(
radius=self.turning_bar_child_hole_diam/2,
height=w,
)
removerf = Cq.Solid.makeCylinder(
radius=BOLT_COMMON.diam_thread/2,
holeP = Cq.Solid.makeCylinder(
radius=self.turning_bar_parent_hole_diam/2,
height=w*2,
pnt=(0, -w, -w/2),
pnt=(0, -w, -w/2-h),
dir=(0, 1, 0),
)
dxe = self.electronic_mount_dx
dxe = self.electronics_mount_dx
result = (
result
+ flange.moved(dx, w/2, 0)
+ flange.moved(-dx, w/2, 0)
- remover.moved(dxe, 0, 0)
- remover.moved(-dxe, 0, 0)
- removerf.moved(dx, 0, 0)
- removerf.moved(-dx, 0, 0)
- holeC.moved(dxe, 0, 0)
- holeC.moved(-dxe, 0, 0)
- holeP.moved(dx, 0, 0)
- holeP.moved(-dx, 0, 0)
)
result.tagAbsolute("holeBO1", (dx, w/2, -w/2), direction="+Y")
result.tagAbsolute("holeBO2", (-dx, w/2, -w/2), direction="+Y")
result.tagAbsolute("holeBO1", (dx, w/2, -w/2-h), direction="+Y")
result.tagAbsolute("holeBO2", (-dx, w/2, -w/2-h), direction="+Y")
result.tagAbsolute("holeMO1", (dxe, 0, t))
result.tagAbsolute("holeMO2", (-dxe, 0, t))
return result
@ -1323,10 +1328,10 @@ class Onbashira(Model):
@target(name="electronics-panel1", kind=TargetKind.DXF)
def profile_electronics_panel1(self) -> Cq.Sketch:
hole_dy = self.turning_bar_hole_dy
hole_dx = self.electronic_mount_dx
hole_dx = self.electronics_mount_dx
l = self.side_length3 - hole_dy * 2 + 12
y = self.side_length3 - hole_dy * 2
w = self.side_width
w = self.side_width * self.electronics_panel_width_ratio
controller_holes = [
self.controller_loc * Cq.Location.from2d(*h).flip_y()
for h in self.controller.holes
@ -1341,7 +1346,7 @@ class Onbashira(Model):
.rect(l, w)
.rect(y, hole_dx * 2, mode="c", tag="corner")
.vertices(tag="corner")
.circle(BOLT_COMMON.diam_thread/2, mode="s")
.circle(self.turning_bar_child_hole_diam/2, mode="s")
.reset()
.push([
h.to2d_pos() for h in controller_holes
@ -1354,7 +1359,7 @@ class Onbashira(Model):
def electronics_panel1(self) -> Cq.Workplane:
hole_dy = self.turning_bar_hole_dy
hole_dx = self.electronic_mount_dx
hole_dx = self.electronics_mount_dx
l = self.side_length3
t = self.side_thickness
result = (
@ -1475,7 +1480,7 @@ class Onbashira(Model):
.translate((0, 0, -self.front_bracket_depth/2))
)
hole_subtractor = Cq.Solid.makeCylinder(
radius=BOLT_COMMON.diam_thread/2,
radius=BOLT_COMMON.diam_thread/2 * 1.5,
height=self.bulk_radius,
dir=(1, 0, 0)
)
@ -1789,9 +1794,10 @@ class Onbashira(Model):
return a
@target(name="chamber-front", kind=TargetKind.DXF)
def profile_chamber_front(self) -> Cq.Sketch:
def profile_hatch(self) -> Cq.Sketch:
"""
Front chamber must allow access to the electronics section
Front chamber must allow access to the electronics section. This is the
wall sitting on the 3rd ring which connects to the previous section.
"""
l = self.side_width
h = self.side_width
@ -1801,18 +1807,18 @@ class Onbashira(Model):
.reset()
.rect(l, h, mode="s")
.push([
(l/2 + gap + self.chamber_front_switch_diam/2, 0)
(l/2 + gap + self.hatch_switch_diam/2, 0)
])
.circle(self.chamber_front_switch_diam/2, mode="s")
.circle(self.hatch_switch_diam/2, mode="s")
.reset()
.push([
(0, h/2 + gap),
(0, -h/2 - gap),
(gap, h/2 + gap),
(gap, -h/2 - gap),
])
.rect(l/4, gap, mode="s")
)
def chamber_front(self) -> Cq.Sketch:
sketch = self.profile_chamber_front()
def hatch(self) -> Cq.Sketch:
sketch = self.profile_hatch()
result = (
Cq.Workplane()
.placeSketch(sketch)
@ -2462,15 +2468,15 @@ class Onbashira(Model):
f"{name_bolt}?root",
"Plane",
)
if has_part(parts, "chamber_front"):
if has_part(parts, "hatch"):
a = a.addS(
self.chamber_front(),
name="chamber_front",
self.hatch(),
name="hatch",
material=self.material_side,
role=Role.STRUCTURE | Role.DECORATION,
)
for i in range(self.n_side):
name_bolt = f"chamber_front{i}boltFPI{i}"
name_bolt = f"hatch{i}boltFPI{i}"
a = a.addS(
BOLT_COMMON.generate(),
name=name_bolt,
@ -2478,7 +2484,7 @@ class Onbashira(Model):
role=Role.CONNECTION,
)
a = a.constrain(
f"chamber_front?holeF{i}",
f"hatch?holeF{i}",
f"{name_bolt}?root",
"Plane",
)
@ -2575,7 +2581,7 @@ class Onbashira(Model):
)
a = a.constrain(
f"ring3/side{i}?holeStatorR",
f"chamber_front?holeB{i}",
f"hatch?holeB{i}",
"Plane",
)