diff --git a/nhf/touhou/yasaka_kanako/onbashira.py b/nhf/touhou/yasaka_kanako/onbashira.py index b7f8f83..8f40f20 100644 --- a/nhf/touhou/yasaka_kanako/onbashira.py +++ b/nhf/touhou/yasaka_kanako/onbashira.py @@ -160,11 +160,22 @@ class Onbashira(Model): .circle(self.rotor_bind_bolt_diam/2, mode="s") ) def bearing_stator(self) -> Cq.Workplane: - return ( + result = ( Cq.Workplane() .placeSketch(self.profile_bearing_stator()) .extrude(self.bearing_disk_thickness) ) + for i in range(self.n_side): + angle = (i+0.5) * math.radians(360 / self.n_side) + result.faces(">Z").moveTo( + self.stator_bind_radius * math.cos(angle), + self.stator_bind_radius * math.sin(angle), + ).tagPlane(f"holeF{i}") + result.faces(" Cq.Sketch: bolt_angle = 180 / self.n_side @@ -236,7 +247,7 @@ class Onbashira(Model): ) return outer - inner - def assembly_rotor(self) -> Cq.Assembly: + def assembly_barrel(self) -> Cq.Assembly: z_lower = -self.bearing_disk_gap/2 - self.bearing_disk_thickness a = ( Cq.Assembly() @@ -665,6 +676,32 @@ class Onbashira(Model): result.tagAbsolute(f"holeRPO{i}", (dr, x, -py), direction="+X") #result.tagAbsolute(f"holeLSO{i}", locrot * Cq.Location(dr, -x, py), direction="+X") result.tagAbsolute(f"holeRSO{i}", locrot * Cq.Location(dr, -x, -py), direction="+X") + + th = math.pi / self.n_side + r = self.bulk_radius + flange = ( + Cq.Workplane() + .sketch() + .push([ + (r, r * math.tan(th)) + ]) + .circle(self.angle_joint_flange_radius) + .reset() + .regularPolygon(self.side_width_inner, self.n_side, mode="i") + .finalize() + .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 @target(name="angle-joint-chamber-back") @@ -737,7 +774,6 @@ class Onbashira(Model): .extrude(self.angle_joint_depth) .translate((0, 0, -self.angle_joint_depth/2)) .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(chamber_intersector) .cut(mating1n) @@ -777,6 +813,33 @@ class Onbashira(Model): result.tagAbsolute(f"holeLPO{i}", (dr, x, py), direction="+X") #result.tagAbsolute(f"holeLSO{i}", locrot * Cq.Location(dr, -x, py), direction="+X") result.tagAbsolute(f"holeLSO{i}", locrot * Cq.Location(dr, -x, py), direction="+X") + + th = math.pi / self.n_side + r = self.bulk_radius + flange_z = self.angle_joint_depth / 2 - self.side_thickness + flange = ( + Cq.Workplane() + .sketch() + .push([ + (r, r * math.tan(th)) + ]) + .circle(self.angle_joint_flange_radius) + .reset() + .regularPolygon(self.side_width_inner, self.n_side, mode="i") + .finalize() + .extrude(self.angle_joint_flange_thickness) + .translate((0, 0, -flange_z)) + ) + 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), -flange_z), + ) + result = result + flange - cyl + result.tagAbsolute("holeStatorL", (ri * math.cos(th), ri * math.sin(th), -flange_z+h/2), direction="+Z") + result.tagAbsolute("holeStatorR", (ri * math.cos(th), ri * math.sin(th), -flange_z-h/2), direction="-Z") return result @target(name="angle-joint") @@ -903,17 +966,15 @@ class Onbashira(Model): th = math.pi / self.n_side r = self.bulk_radius flange = ( - Cq.Sketch() + Cq.Workplane() + .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) + .finalize() .extrude(self.angle_joint_flange_thickness) .translate((0, 0, -self.angle_joint_flange_thickness/2)) ) @@ -979,6 +1040,7 @@ class Onbashira(Model): self.assembly_ring(self.angle_joint_chamber_back()), name="chamber_back", ) + .add(self.assembly_barrel(), name="barrel") ) for i in range(self.n_side): j = (i + 1) % self.n_side @@ -993,6 +1055,11 @@ class Onbashira(Model): f"chamber_back/side{i}?holeLSO{ih}", "Plane", ) + a = a.constrain( + f"barrel/stator2?holeB{i}", + f"ring1/side{i}?holeStatorR", + "Plane", + ) for (nl, nc, nr) in [ ("section1", "ring1", "section2"), ("section2", "ring2", "section3"), @@ -1009,7 +1076,5 @@ class Onbashira(Model): f"{nc}/side{i}?holeRSM{ih}", "Plane", ) - - a = a.add(self.assembly_rotor(), name="rotor") return a.solve()