Optimize angle joint geometry; Mirror stub

This commit is contained in:
Leni Aniva 2025-05-13 09:11:28 -07:00
parent b88d52f4be
commit 5b5ccee94e
Signed by: aniva
GPG Key ID: D5F96287843E8DFB
3 changed files with 53 additions and 4 deletions

View File

@ -2,12 +2,14 @@ from dataclasses import dataclass, field
import cadquery as Cq
from nhf.build import Model, TargetKind, target, assembly, submodel
import nhf.touhou.yasaka_kanako.onbashira as MO
import nhf.touhou.yasaka_kanako.mirror as MM
import nhf.utils
@dataclass
class Parameters(Model):
onbashira: MO.Onbashira = field(default_factory=lambda: MO.Onbashira())
mirror: MM.Mirror = field(default_factory=lambda: MM.Mirror())
def __post_init__(self):
super().__init__(name="yasaka-kanako")
@ -15,6 +17,9 @@ class Parameters(Model):
@submodel(name="onbashira")
def submodel_onbashira(self) -> Model:
return self.onbashira
@submodel(name="mirror")
def submodel_mirror(self) -> Model:
return self.mirror
if __name__ == '__main__':

View File

@ -0,0 +1,43 @@
from dataclasses import dataclass, field
import cadquery as Cq
from nhf.build import Model, TargetKind, target, assembly, submodel
import nhf.touhou.yasaka_kanako.onbashira as MO
import nhf.utils
@dataclass
class Mirror(Model):
"""
Kanako's mirror, made of three levels.
"""
width: float = 50.0
height: float = 70.0
wall_thickness: float = 10.0
@target(name="core", kind=TargetKind.DXF)
def profile_core(self) -> Cq.Sketch:
return Cq.Sketch().ellipse(self.width/2, self.height/2)
@target(name="casing-bot", kind=TargetKind.DXF)
def profile_casing(self) -> Cq.Sketch:
"""
Base of the casing with no holes carved out
"""
dx = self.wall_thickness
return (
Cq.Sketch()
.ellipse(self.width/2+dx, self.height/2+dx)
)
@target(name="casing-top", kind=TargetKind.DXF)
def profile_casing_top(self) -> Cq.Sketch:
"""
Base of the casing with no holes carved out
"""
return (
self.profile_casing()
.ellipse(self.width/2, self.height/2, mode="s")
)
@assembly()
def assembly(self) -> Cq.Assembly:
pass

View File

@ -277,10 +277,10 @@ class Onbashira(Model):
self.side_width,
self.n_side
)
.regularPolygon(
self.side_width_inner,
self.n_side, mode="s",
)
#.regularPolygon(
# self.side_width_inner,
# self.n_side, mode="s",
#)
)
slot = (
Cq.Workplane()
@ -476,6 +476,7 @@ class Onbashira(Model):
)
return a
@assembly()
def assembly(self) -> Cq.Assembly:
a = Cq.Assembly()
a = (