cosplay: Touhou/Houjuu Nue #4

Open
aniva wants to merge 189 commits from touhou/houjuu-nue into main
1 changed files with 10 additions and 4 deletions
Showing only changes of commit 056f6bb085 - Show all commits

View File

@ -73,6 +73,8 @@ class BayonetMount(Mount):
# Angular span (in degrees) of the slider # Angular span (in degrees) of the slider
pin_span: float = 15 pin_span: float = 15
pin_height: float = 5 pin_height: float = 5
# Wall at the bottom of the slot
gap: float = 3
# Angular span (in degrees) of the slot # Angular span (in degrees) of the slot
slot_span: float = 90 slot_span: float = 90
@ -80,6 +82,7 @@ class BayonetMount(Mount):
# Number of pins equally distributed along a circle # Number of pins equally distributed along a circle
n_pin: int = 2 n_pin: int = 2
def __post_init__(self): def __post_init__(self):
assert self.diam_outer > self.diam_inner assert self.diam_outer > self.diam_inner
assert self.n_pin * self.slot_span < 360 assert self.n_pin * self.slot_span < 360
@ -91,7 +94,7 @@ class BayonetMount(Mount):
return self.diam_inner return self.diam_inner
def external_thread(self, length: float): def external_thread(self, length: float):
assert length > self.pin_height assert length > self.pin_height + self.gap
pin = ( pin = (
Cq.Workplane('XY') Cq.Workplane('XY')
.cylinder( .cylinder(
@ -109,17 +112,18 @@ class BayonetMount(Mount):
) )
result = ( result = (
Cq.Workplane('XY') Cq.Workplane('XY')
.workplane(offset=self.gap)
.polarArray(radius=0, startAngle=0, angle=360, count=self.n_pin) .polarArray(radius=0, startAngle=0, angle=360, count=self.n_pin)
.eachpoint(lambda loc: pin.located(loc), combine='a') .eachpoint(lambda loc: pin.located(loc), combine='a')
.clean() .clean()
) )
return result return result
def internal_thread(self, length: float): def internal_thread(self, length: float):
assert length > self.pin_height assert length > self.pin_height + self.gap
slot = ( slot = (
Cq.Workplane('XY') Cq.Workplane('XY')
.cylinder( .cylinder(
height=length, height=length - self.gap,
radius=self.diam_outer / 2, radius=self.diam_outer / 2,
angle=self.pin_span, angle=self.pin_span,
centered=(True, True, False) centered=(True, True, False)
@ -140,7 +144,9 @@ class BayonetMount(Mount):
radius=self.diam_outer / 2, radius=self.diam_outer / 2,
centered=(True, True, False), centered=(True, True, False),
) )
.polarArray(radius=0, startAngle=-self.slot_span+self.pin_span, angle=360, count=self.n_pin) .copyWorkplane(Cq.Workplane('XY'))
.workplane(offset=self.gap)
.polarArray(radius=0, startAngle=self.slot_span, angle=360, count=self.n_pin)
.cutEach(lambda loc: slot.located(loc)) .cutEach(lambda loc: slot.located(loc))
.clean() .clean()
.copyWorkplane(Cq.Workplane('XY')) .copyWorkplane(Cq.Workplane('XY'))