feat: Add battery box item
This commit is contained in:
parent
c878f65b47
commit
d898df6165
|
@ -206,6 +206,70 @@ class MountingBracket(Item):
|
||||||
result.copyWorkplane(Cq.Workplane('XY')).tagPlane("conn_mid")
|
result.copyWorkplane(Cq.Workplane('XY')).tagPlane("conn_mid")
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
@dataclass(frozen=True)
|
||||||
|
class BatteryBox18650(Item):
|
||||||
|
"""
|
||||||
|
A number of 18650 batteries in series
|
||||||
|
"""
|
||||||
|
mass: float = 17.4 + 68.80 * 3
|
||||||
|
length: float = 75.70
|
||||||
|
width_base: float = 61.46 - 18.48 - 20.18 * 2
|
||||||
|
battery_dist: float = 20.18
|
||||||
|
height: float = 19.66
|
||||||
|
# space from bottom to battery begin
|
||||||
|
thickness: float = 1.66
|
||||||
|
battery_diam: float = 18.48
|
||||||
|
battery_height: float = 68.80
|
||||||
|
n_batteries: int = 3
|
||||||
|
|
||||||
|
def __post_init__(self):
|
||||||
|
assert 2 * self.thickness < min(self.length, self.height)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def name(self) -> str:
|
||||||
|
return f"BatteryBox 18650*{self.n_batteries}"
|
||||||
|
|
||||||
|
@property
|
||||||
|
def role(self) -> Role:
|
||||||
|
return Role.ELECTRONIC
|
||||||
|
|
||||||
|
def generate(self) -> Cq.Workplane:
|
||||||
|
width = self.width_base + self.battery_dist * (self.n_batteries - 1) + self.battery_diam
|
||||||
|
return (
|
||||||
|
Cq.Workplane('XY')
|
||||||
|
.box(
|
||||||
|
length=self.length,
|
||||||
|
width=width,
|
||||||
|
height=self.height,
|
||||||
|
centered=(True, True, False),
|
||||||
|
)
|
||||||
|
.copyWorkplane(Cq.Workplane('XY', origin=(0, 0, self.thickness)))
|
||||||
|
.box(
|
||||||
|
length=self.length - self.thickness*2,
|
||||||
|
width=width - self.thickness*2,
|
||||||
|
height=self.height - self.thickness,
|
||||||
|
centered=(True, True, False),
|
||||||
|
combine='cut',
|
||||||
|
)
|
||||||
|
.copyWorkplane(Cq.Workplane('XY', origin=(-self.battery_height/2, 0, self.thickness + self.battery_diam/2)))
|
||||||
|
.rarray(
|
||||||
|
xSpacing=1,
|
||||||
|
ySpacing=self.battery_dist,
|
||||||
|
xCount=1,
|
||||||
|
yCount=self.n_batteries,
|
||||||
|
center=True,
|
||||||
|
)
|
||||||
|
.cylinder(
|
||||||
|
radius=self.battery_diam/2,
|
||||||
|
height=self.battery_height,
|
||||||
|
direct=(1, 0, 0),
|
||||||
|
centered=(True, True, False),
|
||||||
|
combine=True,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
LINEAR_ACTUATOR_50 = LinearActuator(
|
LINEAR_ACTUATOR_50 = LinearActuator(
|
||||||
mass=34.0,
|
mass=34.0,
|
||||||
|
@ -254,6 +318,8 @@ LINEAR_ACTUATOR_BOLT = FlatHeadBolt(
|
||||||
)
|
)
|
||||||
LINEAR_ACTUATOR_BRACKET = MountingBracket()
|
LINEAR_ACTUATOR_BRACKET = MountingBracket()
|
||||||
|
|
||||||
|
BATTERY_BOX = BatteryBox18650()
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class Flexor:
|
class Flexor:
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in New Issue