2024-11-18 00:36:39 -08:00
|
|
|
import math
|
|
|
|
from dataclasses import dataclass, field
|
2024-11-18 14:16:35 -08:00
|
|
|
from pathlib import Path
|
2024-11-18 00:36:39 -08:00
|
|
|
import cadquery as Cq
|
|
|
|
from nhf import Material, Role
|
|
|
|
from nhf.build import Model, target, assembly
|
|
|
|
import nhf.utils
|
|
|
|
|
|
|
|
@dataclass
|
|
|
|
class Epaulette(Model):
|
|
|
|
|
2024-11-18 14:16:35 -08:00
|
|
|
side: str
|
|
|
|
diam: float = 100.0
|
|
|
|
thickness_brass: float = 0.4 # 26 Gauge
|
|
|
|
thickness_fabric: float = 0.3
|
|
|
|
material: Material = Material.METAL_BRASS
|
|
|
|
|
2024-11-18 00:36:39 -08:00
|
|
|
def __post_init__(self):
|
2024-11-18 14:16:35 -08:00
|
|
|
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
|