Cosplay/nhf/touhou/yasaka_kanako/mirror.py

44 lines
1.2 KiB
Python

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