Merge branch 'main' into touhou/yasaka-kanako
This commit is contained in:
commit
3e0eab0cec
|
@ -106,6 +106,10 @@ class Crown(Model):
|
|||
rat = self.slot_r0 / (self.slot_r1 - self.slot_r0)
|
||||
return self.height * rat
|
||||
@property
|
||||
def slot_outer_h0(self):
|
||||
rat = (self.slot_r0 + self.side_guard_thickness) / (self.slot_r1 - self.slot_r0)
|
||||
return self.height * rat
|
||||
@property
|
||||
def slot_theta(self) -> float:
|
||||
"""
|
||||
Cone tilt, related to other quantities by
|
||||
|
@ -164,10 +168,12 @@ class Crown(Model):
|
|||
.assemble()
|
||||
)
|
||||
|
||||
@target(name="side", kind=TargetKind.DXF)
|
||||
def profile_side(self) -> Cq.Sketch:
|
||||
@target(name="eye", kind=TargetKind.DXF)
|
||||
def profile_eye(self) -> Cq.Sketch:
|
||||
"""
|
||||
deprecated
|
||||
"""
|
||||
dy = self.facet_width_upper * 0.1
|
||||
x_side = self.facet_width_upper
|
||||
y_tip = self.height - self.margin
|
||||
|
||||
eye = (
|
||||
|
@ -182,16 +188,19 @@ class Crown(Model):
|
|||
)
|
||||
.bezier([
|
||||
(dy, y_tip - dy),
|
||||
(dy/2, y_tip - dy*.6),
|
||||
(dy/4, y_tip - dy/2),
|
||||
(0, y_tip - dy/2),
|
||||
])
|
||||
.bezier([
|
||||
(0, y_tip - dy/2),
|
||||
(-dy/4, y_tip - dy/2),
|
||||
(-dy/2, y_tip - dy*.6),
|
||||
(-dy, y_tip - dy),
|
||||
])
|
||||
.assemble()
|
||||
)
|
||||
return (
|
||||
self.profile_base()
|
||||
.boolean(eye, mode='s')
|
||||
)
|
||||
return eye
|
||||
|
||||
@target(name="dot", kind=TargetKind.DXF)
|
||||
def profile_dot(self) -> Cq.Sketch:
|
||||
|
@ -201,7 +210,9 @@ class Crown(Model):
|
|||
)
|
||||
|
||||
def profile_front_wing(self, mirror: bool) -> Cq.Sketch:
|
||||
# Add the two wings to the base profile
|
||||
"""
|
||||
These two wings help the front profile attach
|
||||
"""
|
||||
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
|
||||
|
@ -238,7 +249,9 @@ class Crown(Model):
|
|||
|
||||
@target(name="front", kind=TargetKind.DXF)
|
||||
def profile_front(self) -> Cq.Sketch:
|
||||
|
||||
"""
|
||||
Front profile slots into holes on the side guards
|
||||
"""
|
||||
profile_base = (
|
||||
self.profile_base()
|
||||
.boolean(self.profile_front_wing(False), mode='a')
|
||||
|
@ -442,9 +455,9 @@ class Crown(Model):
|
|||
p_top5 = Cq.Location.from2d(0.54 * dx, 0.349 * dy)
|
||||
p_top5_c1 = p_top5 * Cq.Location.from2d(0.103 * dx, 0.017 * dy)
|
||||
p_top5_c2 = p_top5 * Cq.Location.from2d(0.158 * dx, 0.034 * dy)
|
||||
p_base_c = Cq.Location.from2d(1.245 * dx, 0.55 * dy)
|
||||
p_base_c = Cq.Location.from2d(1.5 * dx, 0.55 * dy)
|
||||
|
||||
y0 = self.slot_h0 / math.cos(self.slot_theta)
|
||||
y0 = self.slot_outer_h0 / math.cos(self.slot_theta)
|
||||
phi2 = self.slot_phi / 2
|
||||
p_base = Cq.Location.from2d(y0 * math.sin(phi2), -y0 + y0 * math.cos(phi2))
|
||||
|
||||
|
@ -743,48 +756,3 @@ class Crown(Model):
|
|||
)
|
||||
return a
|
||||
|
||||
def old_assembly(self) -> Cq.Assembly:
|
||||
front = (
|
||||
Cq.Workplane('XY')
|
||||
.placeSketch(self.profile_front())
|
||||
.extrude(self.thickness)
|
||||
)
|
||||
side = (
|
||||
Cq.Workplane('XY')
|
||||
.placeSketch(self.profile_side())
|
||||
.extrude(self.thickness)
|
||||
)
|
||||
side_guard = (
|
||||
Cq.Workplane('XY')
|
||||
.placeSketch(self.profile_side_guard())
|
||||
.extrude(self.thickness)
|
||||
)
|
||||
assembly = (
|
||||
Cq.Assembly()
|
||||
.addS(
|
||||
front,
|
||||
name="front",
|
||||
material=self.material,
|
||||
role=Role.DECORATION,
|
||||
)
|
||||
)
|
||||
for i, pos in enumerate([-2, -1, 1, 2]):
|
||||
x = self.facet_width_upper * pos
|
||||
assembly = (
|
||||
assembly
|
||||
.addS(
|
||||
side,
|
||||
name=f"side{i}",
|
||||
material=self.material,
|
||||
role=Role.DECORATION,
|
||||
loc=Cq.Location.from2d(x, 0),
|
||||
)
|
||||
.addS(
|
||||
side_guard,
|
||||
name=f"guard{i}",
|
||||
material=self.material,
|
||||
role=Role.DECORATION,
|
||||
loc=Cq.Location(x, 0, self.thickness),
|
||||
)
|
||||
)
|
||||
return assembly
|
||||
|
|
Loading…
Reference in New Issue