fix: Type missing in dataclass
This commit is contained in:
parent
2af1499bd5
commit
e75e640623
|
@ -5,7 +5,7 @@ from dataclasses import dataclass
|
|||
import cadquery as Cq
|
||||
import nhf.metric_threads as NMt
|
||||
|
||||
@dataclass(frozen=True)
|
||||
@dataclass
|
||||
class Handle:
|
||||
"""
|
||||
Characteristic of a tool handle
|
||||
|
|
|
@ -4,7 +4,7 @@ import cadquery as Cq
|
|||
import nhf.springs as NS
|
||||
from nhf import Role
|
||||
|
||||
@dataclass(frozen=True)
|
||||
@dataclass
|
||||
class HirthJoint:
|
||||
"""
|
||||
A Hirth joint attached to a cylindrical base
|
||||
|
@ -231,26 +231,26 @@ class TorsionJoint:
|
|||
"""
|
||||
|
||||
# Radius limit for rotating components
|
||||
radius = 40
|
||||
disk_height = 10
|
||||
radius: float = 40
|
||||
disk_height: float = 10
|
||||
|
||||
radius_spring = 15
|
||||
radius_axle = 6
|
||||
radius_spring: float = 15
|
||||
radius_axle: float = 6
|
||||
|
||||
# Offset of the spring hole w.r.t. surface
|
||||
spring_hole_depth = 4
|
||||
spring_hole_depth: float = 4
|
||||
|
||||
# Also used for the height of the hole for the spring
|
||||
spring_thickness = 2
|
||||
spring_height = 15
|
||||
spring_thickness: float = 2
|
||||
spring_height: float = 15
|
||||
|
||||
spring_tail_length = 40
|
||||
spring_tail_length: float = 40
|
||||
|
||||
groove_radius_outer = 35
|
||||
groove_radius_inner = 20
|
||||
groove_depth = 5
|
||||
rider_gap = 2
|
||||
n_slots = 8
|
||||
groove_radius_outer: float = 35
|
||||
groove_radius_inner: float = 20
|
||||
groove_depth: float = 5
|
||||
rider_gap: float = 2
|
||||
n_slots: float = 8
|
||||
|
||||
right_handed: bool = False
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ from root to tip s0 (root),
|
|||
s1, s2, s3. The joints are named (from root to tip)
|
||||
shoulder, elbow, wrist in analogy with human anatomy.
|
||||
"""
|
||||
from dataclasses import dataclass
|
||||
from dataclasses import dataclass, field
|
||||
import unittest
|
||||
import cadquery as Cq
|
||||
import nhf.joints
|
||||
|
@ -50,24 +50,24 @@ class Parameters:
|
|||
harness_height: float = 400
|
||||
harness_fillet: float = 10
|
||||
|
||||
harness_wing_base_pos = [
|
||||
harness_wing_base_pos: list[tuple[str, float, float]] = field(default_factory=lambda: [
|
||||
("r1", 70, 150),
|
||||
("l1", -70, 150),
|
||||
("r2", 100, 0),
|
||||
("l2", -100, 0),
|
||||
("r3", 70, -150),
|
||||
("l3", -70, -150),
|
||||
]
|
||||
])
|
||||
|
||||
# Holes drilled onto harness for attachment with HS joint
|
||||
harness_to_root_conn_diam = 6
|
||||
harness_to_root_conn_diam: float = 6
|
||||
|
||||
hs_hirth_joint: HirthJoint = HirthJoint(
|
||||
hs_hirth_joint: HirthJoint = field(default_factory=lambda: HirthJoint(
|
||||
radius=30,
|
||||
radius_inner=20,
|
||||
tooth_height=10,
|
||||
base_height=5
|
||||
)
|
||||
))
|
||||
|
||||
# Wing root properties
|
||||
#
|
||||
|
@ -94,7 +94,7 @@ class Parameters:
|
|||
wing_r2_height: float = 100
|
||||
wing_r3_height: float = 100
|
||||
|
||||
trident_handle: Handle = Handle(
|
||||
trident_handle: Handle = field(default_factory=lambda: Handle(
|
||||
diam=38,
|
||||
diam_inner=38-2 * 25.4/8,
|
||||
# M27-3
|
||||
|
@ -102,7 +102,7 @@ class Parameters:
|
|||
thread_pitch=3,
|
||||
diam_connector_internal=18,
|
||||
simplify_geometry=False,
|
||||
)
|
||||
))
|
||||
|
||||
def __post_init__(self):
|
||||
assert self.wing_root_radius > self.hs_hirth_joint.radius,\
|
||||
|
|
|
@ -12,7 +12,7 @@ class Test(unittest.TestCase):
|
|||
p = M.Parameters()
|
||||
obj = p.wing_root()
|
||||
#self.assertIsInstance(obj.solids(), Cq.Solid, msg="Wing root must be in one piece")
|
||||
bbox = obj.BoundingBox()
|
||||
bbox = obj.val().BoundingBox()
|
||||
|
||||
msg = "Must fix 256^3 bbox"
|
||||
self.assertLess(bbox.xlen, 255, msg=msg)
|
||||
|
|
Loading…
Reference in New Issue