Onbashira dimension update and flanges

This commit is contained in:
Leni Aniva 2025-05-12 23:33:20 -07:00
parent 4dcd97613b
commit 44cd6ee960
Signed by: aniva
GPG Key ID: D5F96287843E8DFB
1 changed files with 54 additions and 10 deletions

View File

@ -11,12 +11,13 @@ class Onbashira(Model):
n_side: int = 6 n_side: int = 6
# Dimensions of each side panel # Dimensions of each side panel
side_width: float = 200.0 side_width: float = 170.0
# Side panels have different lengths # Side panels have different lengths
side_length1: float = 200.0 side_length1: float = 200.0
side_length2: float = 350.0 side_length2: float = 350.0
side_length3: float = 400.0 side_length3: float = 400.0
side_length4: float = 400.0
side_thickness: float = 25.4 / 8 side_thickness: float = 25.4 / 8
@ -31,30 +32,32 @@ class Onbashira(Model):
# Position of the holes, with (0, 0) being the centre of each side # Position of the holes, with (0, 0) being the centre of each side
angle_joint_bolt_position: list[float] = field(default_factory=lambda: [ angle_joint_bolt_position: list[float] = field(default_factory=lambda: [
(20, 15), (20, 15),
(70, 15), (50, 15),
]) ])
angle_joint_flange_thickness: float = 7.8
angle_joint_flange_radius: float = 40.0
# Dimensions of gun barrels # Dimensions of gun barrels
barrel_diam: float = 25.4 * 2 barrel_diam: float = 25.4 * 2
barrel_length: float = 300.0 barrel_length: float = 300.0
# Radius from barrel centre to axis # Radius from barrel centre to axis
rotation_radius: float = 90.0 rotation_radius: float = 75.0
n_bearing_balls: int = 24 n_bearing_balls: int = 24
# Size of ball bearings # Size of ball bearings
bearing_ball_diam: float = 25.4 * 1/2 bearing_ball_diam: float = 25.4 * 1/2
bearing_ball_gap: float = .5 bearing_ball_gap: float = .5
# Thickness of bearing disks # Thickness of bearing disks
bearing_thickness: float = 20.0 bearing_thickness: float = 20.0
bearing_track_radius: float = 135.0 bearing_track_radius: float = 110.0
# Gap between the inner and outer bearing disks # Gap between the inner and outer bearing disks
bearing_gap: float = 10.0 bearing_gap: float = 10.0
bearing_disk_thickness: float = 25.4 / 8 bearing_disk_thickness: float = 25.4 / 8
rotor_inner_radius: float = 55.0 rotor_inner_radius: float = 40.0
rotor_bind_bolt_diam: float = 10.0 rotor_bind_bolt_diam: float = 10.0
rotor_bind_radius: float = 110.0 rotor_bind_radius: float = 85.0
stator_bind_radius: float = 170.0 stator_bind_radius: float = 140.0
material_side: Material = Material.WOOD_BIRCH material_side: Material = Material.WOOD_BIRCH
material_bearing: Material = Material.PLASTIC_PLA material_bearing: Material = Material.PLASTIC_PLA
@ -253,6 +256,7 @@ class Onbashira(Model):
return result return result
@target(name="angle-joint")
def angle_joint(self) -> Cq.Workplane: def angle_joint(self) -> Cq.Workplane:
""" """
Angular joint between two side panels. This sits at the intersection of Angular joint between two side panels. This sits at the intersection of
@ -358,6 +362,37 @@ class Onbashira(Model):
result.tagAbsolute(f"holeRSI{i}", locrot * Cq.Location(dri, -x, -py), direction="-X") result.tagAbsolute(f"holeRSI{i}", locrot * Cq.Location(dri, -x, -py), direction="-X")
return result return result
@target(name="angle-joint-flanged")
def angle_joint_flanged(self) -> Cq.Workplane:
result = self.angle_joint()
th = math.pi / self.n_side
r = self.bulk_radius
flange = (
Cq.Sketch()
.push([
(r, r * math.tan(th))
])
.circle(self.angle_joint_flange_radius)
.reset()
.regularPolygon(self.side_width_inner, self.n_side, mode="i")
)
flange = (
Cq.Workplane()
.placeSketch(flange)
.extrude(self.angle_joint_flange_thickness)
.translate((0, 0, -self.angle_joint_flange_thickness/2))
)
ri = self.stator_bind_radius
h = self.angle_joint_flange_thickness
cyl = Cq.Solid.makeCylinder(
radius=self.rotor_bind_bolt_diam/2,
height=h,
pnt=(ri * math.cos(th), ri * math.sin(th), -h/2),
)
result = result + flange - cyl
result.tagAbsolute("holeStatorL", (ri * math.cos(th), ri * math.sin(th), h/2), direction="+Z")
result.tagAbsolute("holeStatorR", (ri * math.cos(th), ri * math.sin(th), -h/2), direction="-Z")
return result
def bearing_ball(self) -> Cq.Solid: def bearing_ball(self) -> Cq.Solid:
return Cq.Solid.makeSphere(radius=self.bearing_ball_diam/2, angleDegrees1=-90) return Cq.Solid.makeSphere(radius=self.bearing_ball_diam/2, angleDegrees1=-90)
@ -427,9 +462,9 @@ class Onbashira(Model):
loc=Cq.Location.rot2d(i*360/self.n_side) * Cq.Location(-r,0,0,90,0,90), loc=Cq.Location.rot2d(i*360/self.n_side) * Cq.Location(-r,0,0,90,0,90),
) )
return a return a
def assembly_ring(self) -> Cq.Assembly: def assembly_ring(self, flanged=False) -> Cq.Assembly:
a = Cq.Assembly() a = Cq.Assembly()
side = self.angle_joint() side = self.angle_joint_flanged() if flanged else self.angle_joint()
r = self.bulk_radius r = self.bulk_radius
for i in range(self.n_side): for i in range(self.n_side):
a = a.addS( a = a.addS(
@ -450,7 +485,7 @@ class Onbashira(Model):
name="section1", name="section1",
) )
.add( .add(
self.assembly_ring(), self.assembly_ring(flanged=True),
name="ring1", name="ring1",
) )
.add( .add(
@ -465,10 +500,19 @@ class Onbashira(Model):
self.assembly_section(length=self.side_length3, hasFrontHole=True, hasBackHole=True), self.assembly_section(length=self.side_length3, hasFrontHole=True, hasBackHole=True),
name="section3", name="section3",
) )
.add(
self.assembly_ring(),
name="ring3",
)
.add(
self.assembly_section(length=self.side_length4, hasFrontHole=True, hasBackHole=False),
name="section4",
)
) )
for (nl, nc, nr) in [ for (nl, nc, nr) in [
("section1", "ring1", "section2"), ("section1", "ring1", "section2"),
("section2", "ring2", "section3"), ("section2", "ring2", "section3"),
("section3", "ring3", "section4"),
]: ]:
for i in range(self.n_side): for i in range(self.n_side):
j = (i + 1) % self.n_side j = (i + 1) % self.n_side