cosplay: Touhou/Shiki Eiki #7
|
@ -200,8 +200,52 @@ class Crown(Model):
|
||||||
.circle(self.margin / 2)
|
.circle(self.margin / 2)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def profile_front_wing(self, mirror: bool) -> Cq.Sketch:
|
||||||
|
# Add the two wings to the base profile
|
||||||
|
hw = self.front_wing_height / math.cos(self.slot_theta)
|
||||||
|
hw0 = (self.front_wing_dh + self.slot_h0) / math.cos(self.slot_theta)
|
||||||
|
hw1 = hw0 + hw
|
||||||
|
y0 = self.slot_h0 / math.cos(self.slot_theta)
|
||||||
|
# Calculate angle of wing analogously to `this.slot_phi`. This arc's
|
||||||
|
# radius is hw0.
|
||||||
|
wing_arc = self.slot_r0 * math.radians(self.front_wing_angle)
|
||||||
|
phi_w = wing_arc / hw0
|
||||||
|
sign = -1 if mirror else 1
|
||||||
|
phi2 = self.slot_phi / 2
|
||||||
|
return (
|
||||||
|
Cq.Sketch()
|
||||||
|
.segment(
|
||||||
|
(sign * hw0 * math.sin(phi2), -y0 + hw0 * math.cos(phi2)),
|
||||||
|
(sign * hw1 * math.sin(phi2), -y0 + hw1 * math.cos(phi2)),
|
||||||
|
)
|
||||||
|
.segment(
|
||||||
|
(sign * hw0 * math.sin(phi2+phi_w), -y0 + hw0 * math.cos(phi2+phi_w)),
|
||||||
|
(sign * hw1 * math.sin(phi2+phi_w), -y0 + hw1 * math.cos(phi2+phi_w)),
|
||||||
|
)
|
||||||
|
.arc(
|
||||||
|
(sign * hw0 * math.sin(phi2), -y0 + hw0 * math.cos(phi2)),
|
||||||
|
(sign * hw0 * math.sin(phi2+phi_w/2), -y0 + hw0 * math.cos(phi2+phi_w/2)),
|
||||||
|
(sign * hw0 * math.sin(phi2+phi_w), -y0 + hw0 * math.cos(phi2+phi_w)),
|
||||||
|
)
|
||||||
|
.arc(
|
||||||
|
(sign * hw1 * math.sin(phi2), -y0 + hw1 * math.cos(phi2)),
|
||||||
|
(sign * hw1 * math.sin(phi2+phi_w/2), -y0 + hw1 * math.cos(phi2+phi_w/2)),
|
||||||
|
(sign * hw1 * math.sin(phi2+phi_w), -y0 + hw1 * math.cos(phi2+phi_w)),
|
||||||
|
)
|
||||||
|
.assemble()
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@target(name="front", kind=TargetKind.DXF)
|
@target(name="front", kind=TargetKind.DXF)
|
||||||
def profile_front(self) -> Cq.Sketch:
|
def profile_front(self) -> Cq.Sketch:
|
||||||
|
|
||||||
|
profile_base = (
|
||||||
|
self.profile_base()
|
||||||
|
.boolean(self.profile_front_wing(False), mode='a')
|
||||||
|
.boolean(self.profile_front_wing(True), mode='a')
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
dx_l = self.facet_width_lower
|
dx_l = self.facet_width_lower
|
||||||
dx_u = self.facet_width_upper
|
dx_u = self.facet_width_upper
|
||||||
dy = self.height
|
dy = self.height
|
||||||
|
@ -215,7 +259,7 @@ class Crown(Model):
|
||||||
window_p1 = Cq.Location.from2d(
|
window_p1 = Cq.Location.from2d(
|
||||||
dx_u/2 - self.margin - window_length * 0.4,
|
dx_u/2 - self.margin - window_length * 0.4,
|
||||||
dy/2 + self.margin/2,
|
dy/2 + self.margin/2,
|
||||||
math.degrees(math.atan2(dy/2, -dx_u/2)),
|
math.degrees(math.atan2(dy/2, -dx_u/2) * 0.95),
|
||||||
)
|
)
|
||||||
window_p2 = Cq.Location.from2d(
|
window_p2 = Cq.Location.from2d(
|
||||||
dx_l/2 - self.margin + window_length * 0.15,
|
dx_l/2 - self.margin + window_length * 0.15,
|
||||||
|
@ -224,7 +268,7 @@ class Crown(Model):
|
||||||
)
|
)
|
||||||
|
|
||||||
# Carve the scale
|
# Carve the scale
|
||||||
z = dy * 1/64 # "Pen" Thickness
|
z = dy * 1/32 # "Pen" Thickness
|
||||||
scale_pan_x = dx_l / 2 * 0.6
|
scale_pan_x = dx_l / 2 * 0.6
|
||||||
scale_pan_y = dy / 2 * 0.7
|
scale_pan_y = dy / 2 * 0.7
|
||||||
pan_dx = dx_l * 1/4
|
pan_dx = dx_l * 1/4
|
||||||
|
@ -365,7 +409,7 @@ class Crown(Model):
|
||||||
)
|
)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
self.profile_base()
|
profile_base
|
||||||
.boolean(window.moved(window_p1), mode='s')
|
.boolean(window.moved(window_p1), mode='s')
|
||||||
.boolean(window.moved(window_p1.flip_x()), mode='s')
|
.boolean(window.moved(window_p1.flip_x()), mode='s')
|
||||||
.boolean(window.moved(window_p2), mode='s')
|
.boolean(window.moved(window_p2), mode='s')
|
||||||
|
|
Loading…
Reference in New Issue