Motor and bolt models

This commit is contained in:
Leni Aniva 2025-05-28 08:01:14 -07:00
parent a8c80a307f
commit 40c32213e1
Signed by: aniva
GPG Key ID: D5F96287843E8DFB
2 changed files with 52 additions and 1 deletions

View File

@ -11,6 +11,7 @@ class FlatHeadBolt(Item):
height_head: float height_head: float
diam_thread: float diam_thread: float
height_thread: float height_thread: float
pitch: float = 1.0
@property @property
def name(self) -> str: def name(self) -> str:

View File

@ -1,11 +1,56 @@
from nhf.build import Model, TargetKind, target, assembly, submodel from nhf.build import Model, TargetKind, target, assembly, submodel
from nhf.materials import Role, Material from nhf.materials import Role, Material
import nhf.utils import nhf.utils
from nhf.parts.fasteners import FlatHeadBolt, HexNut, Washer
import math import math
from dataclasses import dataclass, field from dataclasses import dataclass, field
import cadquery as Cq import cadquery as Cq
NUT_COMMON = HexNut(
# FIXME: measure
mass=0.0,
diam_thread=6.0,
pitch=1.0,
thickness=5.0,
width=9.89,
)
WASHER_COMMON = Washer(
# FIXME: measure
mass=0.0,
diam_thread=6.0,
diam_outer=11.68,
thickness=1.5,
)
BOLT_COMMON = FlatHeadBolt(
# FIXME: measure
mass=0.0,
diam_head=12.8,
height_head=2.8,
diam_thread=6.0,
height_thread=30.0,
pitch=1.0,
)
@dataclass
class Motor(Model):
mass: float = 589.7
voltage: float = 12.0 # V
power: float = 30.0 # watts
diam_thread: float = 4.0
diam_body: float = 51.82
height_body: float = 70.87
height_shaft: float = 37.85
def __post_init__(self):
pass
def model(self) -> Cq.Workplane:
pass
@dataclass @dataclass
class Onbashira(Model): class Onbashira(Model):
@ -48,7 +93,9 @@ class Onbashira(Model):
# Dimensions of gun barrels # Dimensions of gun barrels
barrel_diam: float = 25.4 * 1.5 barrel_diam: float = 25.4 * 1.5
barrel_length: float = 300.0 barrel_wall_thickness: float = 25.4 / 8
barrel_length: float = 25.4 * 12
# Radius from barrel centre to axis # Radius from barrel centre to axis
rotation_radius: float = 66.0 rotation_radius: float = 66.0
n_bearing_balls: int = 12 n_bearing_balls: int = 12
@ -77,6 +124,7 @@ class Onbashira(Model):
material_bearing: Material = Material.PLASTIC_PLA material_bearing: Material = Material.PLASTIC_PLA
material_spacer: Material = Material.PLASTIC_PLA material_spacer: Material = Material.PLASTIC_PLA
material_bearing_ball: Material = Material.ACRYLIC_TRANSPARENT material_bearing_ball: Material = Material.ACRYLIC_TRANSPARENT
material_barrel: Material = Material.ACRYLIC_BLACK
material_brace: Material = Material.PLASTIC_PLA material_brace: Material = Material.PLASTIC_PLA
def __post_init__(self): def __post_init__(self):
@ -96,6 +144,8 @@ class Onbashira(Model):
# Ensure the stator could be printed on a 12x12in board # Ensure the stator could be printed on a 12x12in board
assert self.side_width * 2 < 12 * 25.4 assert self.side_width * 2 < 12 * 25.4
assert self.barrel_wall_thickness * 2 < self.barrel_diam
@property @property
def angle_side(self) -> float: def angle_side(self) -> float:
return 360 / self.n_side return 360 / self.n_side