2024-11-13 22:36:10 -08:00
|
|
|
from dataclasses import dataclass, field
|
|
|
|
import cadquery as Cq
|
|
|
|
from nhf import Material, Role
|
|
|
|
from nhf.build import Model, target, assembly
|
|
|
|
import nhf.utils
|
|
|
|
|
|
|
|
@dataclass
|
|
|
|
class Rod(Model):
|
|
|
|
|
2024-11-14 13:59:01 -08:00
|
|
|
width: float = 120.0
|
|
|
|
length: float = 550.0
|
|
|
|
length_tip: float = 100.0
|
|
|
|
width_tail: float = 60.0
|
|
|
|
|
2024-11-13 22:36:10 -08:00
|
|
|
@target(name="surface")
|
|
|
|
def top_profile(self) -> Cq.Sketch:
|
|
|
|
sketch = (
|
|
|
|
Cq.Sketch()
|
|
|
|
.polygon([
|
2024-11-14 13:59:01 -08:00
|
|
|
(self.length, 0),
|
|
|
|
(self.length - self.length_tip, self.width/2),
|
|
|
|
(0, self.width_tail / 2),
|
|
|
|
(0, -self.width_tail / 2),
|
|
|
|
(self.length - self.length_tip, -self.width/2),
|
2024-11-13 22:36:10 -08:00
|
|
|
])
|
|
|
|
)
|
|
|
|
return sketch
|
|
|
|
|
|
|
|
@assembly()
|
|
|
|
def assembly(self) -> Cq.Assembly:
|
|
|
|
a = (
|
|
|
|
Cq.Assembly()
|
|
|
|
)
|
|
|
|
return a
|