import math from dataclasses import dataclass, field from pathlib import Path import cadquery as Cq from nhf import Material, Role from nhf.build import Model, target, assembly import nhf.utils @dataclass class Epaulette(Model): side: str diam: float = 100.0 thickness_brass: float = 0.4 # 26 Gauge thickness_fabric: float = 0.3 material: Material = Material.METAL_BRASS def __post_init__(self): super().__init__(name=f"epaulette-{self.side}") def surface(self) -> Cq.Solid: path = Path(__file__).resolve().parent / f"epaulette-{self.side}.dxf" return ( Cq.importers.importDXF(path).wires().toPending().extrude(self.thickness_brass) ) def assembly(self) -> Cq.Assembly: assembly = ( Cq.Assembly() .addS( self.surface(), name="surface", material=self.material, role=Role.DECORATION, ) ) return assembly