From e29f86fa70e9f3b0f5eacd911630b7e8986b6acc Mon Sep 17 00:00:00 2001 From: Arnaud Morin Date: Mon, 21 Sep 2026 22:22:01 +0200 Subject: [PATCH] Inscread plate strap size Also fix mass printing on all objects Signed-off-by: Arnaud Morin --- arm.py | 6 ++---- camera_mount.py | 9 +++------ fc.py | 14 +++----------- frame_params.py | 17 ++++++++++------- lollipop.py | 6 +++--- motor_base.py | 9 ++------- plate.py | 25 ++++++++++++++----------- spar.py | 9 ++------- standoff.py | 12 +++--------- 9 files changed, 42 insertions(+), 65 deletions(-) diff --git a/arm.py b/arm.py index 0a58f18..869ad7c 100644 --- a/arm.py +++ b/arm.py @@ -147,7 +147,5 @@ if "show_object" not in globals(): # running outside CQ-editor show_object(result) if __name__ == "__main__": - vol = result.val().Volume() - m = vol * CF_DENSITY - print(f"arm mass {m:.2f} g each, {4*m:.2f} g for four") - + v = result.val().Volume() + print("%-12s %.2f g" % ("arm", v * CF_DENSITY)) diff --git a/camera_mount.py b/camera_mount.py index 11209fb..b3114a4 100644 --- a/camera_mount.py +++ b/camera_mount.py @@ -4,6 +4,7 @@ import cadquery as cq from math import sqrt +from frame_params import TPU_DENSITY def camera_mount(): @@ -130,9 +131,5 @@ if "show_object" not in globals(): # running outside CQ-editor show_object(result) if __name__ == "__main__": - TPU_DENSITY = 1.21e-3 # g/mm3 - - solid = result.val() - - print("camera_mount %.2f g in TPU" - % (solid.Volume() * TPU_DENSITY)) + v = result.val().Volume() + print("%-12s %.2f g" % ("camera mount", v * TPU_DENSITY)) diff --git a/fc.py b/fc.py index d9484c7..edef4ba 100644 --- a/fc.py +++ b/fc.py @@ -3,13 +3,7 @@ # import cadquery as cq - -# A flight controller is not a material, it is a stack: two boards, their -# spacers, and everything soldered to them. This models only the envelope, as -# one solid, so the density is FR4's -- bare PCB -- and the dense parts (FETs, -# inductors, connectors) stand in for the air between the boards. It lands the -# block at about 12 g, which is what a real 25.5 mm FC plus 4-in-1 ESC weighs. -PCB_DENSITY = 1.85e-3 # g/mm3, FR4 +from frame_params import PCB_DENSITY def fc(): @@ -76,8 +70,6 @@ if "show_object" not in globals(): # running outside CQ-editor show_object(result) - if __name__ == "__main__": - - print("fc %.2f g" % (result.val().Volume() * PCB_DENSITY)) - + v = result.val().Volume() + print("%-12s %.2f g" % ("fc", v * PCB_DENSITY)) diff --git a/frame_params.py b/frame_params.py index 116d02b..9f9f535 100644 --- a/frame_params.py +++ b/frame_params.py @@ -7,24 +7,27 @@ from math import cos, radians, sin, sqrt # --- material --------------------------------------------------------------- THICKNESS = 2.0 -CF_DENSITY = 1.55e-3 # g/mm3, for mass reporting +CF_DENSITY = 1.55e-3 # g/mm3 +TPU_DENSITY = 1.21e-3 # g/mm3 +PCB_DENSITY = 1.85e-3 # g/mm3 +ALU_DENSITY = 2.70e-3 # g/mm3, for mass reporting # --- joint fit -------------------------------------------------------------- FIT = 0.2 # a mortise is its tenon's length + FIT (0.1 per # side); the width is a snug match, no FIT added -TBONE_D = 1.0 # T-bone relief circle = one cutter diameter +TBONE_D = 1.0 # T-bone relief circle = one cutter diameter TENON_L = 4.0 # every tenon in the frame is this long -- the arm's # tip block and the spar's own tenon both key off it # --- overall layout --------------------------------------------------------- SPAR_H = 4.0 -SPAR_OFFSET = 2.5 # spar centreline clears the motor axis by this much, - # outboard -- feeds R_SPAR_LINE below. motor_base.py - # and spar.py each hold their own matching copy of - # this value now, not linked by import any more, so - # keep them in step by hand +SPAR_OFFSET = 2.5 # spar centreline clears the motor axis by this much, + # outboard -- feeds R_SPAR_LINE below. motor_base.py + # and spar.py each hold their own matching copy of + # this value now, not linked by import any more, so + # keep them in step by hand # clear gap between the two plates PLATE_GAP = 15.0 diff --git a/lollipop.py b/lollipop.py index 3e45ae0..218920b 100644 --- a/lollipop.py +++ b/lollipop.py @@ -3,6 +3,7 @@ # import cadquery as cq +from frame_params import TPU_DENSITY def lollipop(): @@ -126,6 +127,5 @@ show_object(result) if __name__ == "__main__": - TPU_DENSITY = 1.21e-3 # g/mm3 - - print("lollipop %.2f g in TPU" % (result.val().Volume() * TPU_DENSITY)) + v = result.val().Volume() + print("%-12s %.2f g" % ("lollipop", v * TPU_DENSITY)) diff --git a/motor_base.py b/motor_base.py index d3d8c2c..9aafb0d 100644 --- a/motor_base.py +++ b/motor_base.py @@ -114,11 +114,6 @@ if "show_object" not in globals(): # running outside CQ-editor show_object(result) -# Mass report -def report(): - vol = result.val().Volume() - print(f" Mass = {vol * CF_DENSITY:5.2f} g") - print(f" Mass x4 = {4 * vol * CF_DENSITY:5.2f} g") - if __name__ == "__main__": - report() + v = result.val().Volume() + print("%-12s %.2f g" % ("motor base", v * CF_DENSITY)) diff --git a/plate.py b/plate.py index 352f138..0209576 100644 --- a/plate.py +++ b/plate.py @@ -106,33 +106,37 @@ def plate(): p = p.cut(bones.rotate((0, 0, 0), (0, 0, 1), a).translate((x, y, 0))) # Triangle cuts to reduce weight + # the small one near center cut1 = ( cq.Workplane("XY") .polyline([ - (6.5, -9), - (6.5, 9), - (1, 0), + (7, -7), + (7, 7), + (1.5, 0), ]).close() .extrude(THICKNESS) .edges("|Z") .fillet(1.0) ) + # strap holes cut2 = ( cq.Workplane("XY") .polyline([ - (9.5, -9), - (9.5, 9), - (15, 0), + (11, -8), + (11, 8), + (13, 8), + (13, -8), ]).close() .extrude(THICKNESS) .edges("|Z") - .fillet(1.0) + .fillet(0.99) ) + # the big one cut3 = ( cq.Workplane("XY") .polyline([ - (11, 15), - (-11, 15), + (10, 15), + (-10, 15), (0, 4), ]).close() .extrude(THICKNESS) @@ -168,6 +172,5 @@ show_object(result) if __name__ == "__main__": - v = result.val().Volume() - print("plate mass %.2f g each, %.2f g for two" % (v * CF_DENSITY, 2 * v * CF_DENSITY)) + print("%-12s %.2f g" % ("plate", v * CF_DENSITY)) diff --git a/spar.py b/spar.py index 4ff58da..a44860c 100644 --- a/spar.py +++ b/spar.py @@ -111,12 +111,6 @@ result = spar() assert result.solids().size() == 1, "spar is not one solid" -# Mass report -def report(): - vol = result.val().Volume() - print(f" Mass = {vol * CF_DENSITY:5.2f} g") - print(f" Mass x4 = {4 * vol * CF_DENSITY:5.2f} g") - # Running outside CQ-editor if "show_object" not in globals(): def show_object(*args, **kwargs): @@ -125,4 +119,5 @@ if "show_object" not in globals(): show_object(result) if __name__ == "__main__": - report() + v = result.val().Volume() + print("%-12s %.2f g" % ("spar", v * CF_DENSITY)) diff --git a/standoff.py b/standoff.py index e6b5581..c754d57 100644 --- a/standoff.py +++ b/standoff.py @@ -4,12 +4,9 @@ import cadquery as cq -from frame_params import PLATE_GAP +from frame_params import (ALU_DENSITY, 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") @@ -39,8 +36,5 @@ 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)) + v = result.val().Volume() + print("%-12s %.2f g" % ("standoff", v * ALU_DENSITY))