diff --git a/nhf/touhou/yasaka_kanako/onbashira.py b/nhf/touhou/yasaka_kanako/onbashira.py index 8f219e2..a576050 100644 --- a/nhf/touhou/yasaka_kanako/onbashira.py +++ b/nhf/touhou/yasaka_kanako/onbashira.py @@ -22,7 +22,7 @@ class Onbashira(Model): side_thickness: float = 25.4 / 8 # Joints between two sets of side panels - angle_joint_thickness: float = 10.0 + angle_joint_thickness: float = 15.0 # Z-axis size of each angle joint angle_joint_depth: float = 60.0 # Gap of each angle joint to connect the outside to the inside @@ -37,6 +37,9 @@ class Onbashira(Model): ]) angle_joint_flange_thickness: float = 7.8 angle_joint_flange_radius: float = 40.0 + angle_joint_conn_thickness: float = 6.0 + angle_joint_conn_depth: float = 20.0 + angle_joint_conn_width: float = 20.0 # Dimensions of gun barrels barrel_diam: float = 25.4 * 1.5 @@ -77,6 +80,8 @@ class Onbashira(Model): for (x, y) in self.angle_joint_bolt_position: assert y < self.angle_joint_depth / 2 + assert self.angle_joint_depth / 2 > self.angle_joint_conn_depth + assert self.angle_joint_thickness > self.angle_joint_conn_thickness @property def angle_side(self) -> float: @@ -403,6 +408,23 @@ class Onbashira(Model): .extrude(self.angle_joint_depth*4) .translate((0, 0, -self.angle_joint_depth*2)) ) + # The mating structure + z1 = self.bulk_radius + (self.angle_joint_thickness - self.angle_joint_conn_thickness) / 2 + z2 = z1 + self.angle_joint_conn_thickness + mating1n = ( + Cq.Workplane() + .sketch() + .polygon([ + (z1, 0), + (z1, self.angle_joint_conn_width), + (z2, self.angle_joint_conn_width), + (z2, 0), + ]) + .finalize() + .extrude(self.angle_joint_conn_depth) + ) + mating1p = mating1n.rotate((0,0,0), (1,0,0), 180) + angle = 360 / self.n_side result = ( Cq.Workplane() .placeSketch(sketch) @@ -411,6 +433,10 @@ class Onbashira(Model): .cut(slot.translate((0, 0, self.angle_joint_gap/2))) .cut(slot.translate((0, 0, -self.angle_joint_depth-self.angle_joint_gap/2))) .intersect(intersector) + .cut(mating1n) + .union(mating1p) + .union(mating1n.rotate((0,0,0),(0,0,1),angle)) + .cut(mating1p.rotate((0,0,0),(0,0,1),angle)) ) h = self.bulk_radius + self.angle_joint_thickness hole_negative = Cq.Solid.makeCylinder(