Files
pirouette/standoff.py
Arnaud Morin d241613ed9 Finish standoff
Signed-off-by: Arnaud Morin <arnaud.gfpv@mailops.fr>
2026-09-14 22:00:56 +02:00

47 lines
933 B
Python

# @author Arnaud Morin <arnaud.gfpv@mailops.fr>
# SPDX-License-Identifier: Apache-2.0
#
import cadquery as cq
from frame_params import PLATE_GAP
OD = 3.5 # round M2 standoff
ALU_DENSITY = 2.70e-3 # g/mm3, for mass reporting
PLATE_GAP=16
def standoff():
p = (cq.Workplane("XY")
.circle(OD / 2.0)
.extrude(PLATE_GAP)
)
cut = (cq.Workplane("XY")
.circle(1)
.extrude(PLATE_GAP)
)
p = p.cut(cut)
return p
result = standoff()
assert result.solids().size() == 1, "standoff is not one solid"
if "show_object" not in globals(): # running outside CQ-editor
def show_object(*args, **kwargs):
pass
show_object(result)
if __name__ == "__main__":
solid = result.val()
print("standoff %.3f g each, %.3f g for four"
% (solid.Volume() * ALU_DENSITY,
4 * solid.Volume() * ALU_DENSITY))